I need to exclude some files from TC's artifacts during my ASP MVC project's build. These files include web.debug.config files, but there are others as well.
At the moment the Artifact path setting in TC looks like this:
src/Project.Web/*.config => arch.zip
I need somehow to tell it to skip the web.debug.config file.
I tried this and doesn't work:
src/Project.Web/*.config => arch.zip
-src/Project.Web/*.debug.config
So, ideally I don't want these files from arch.zip that is created during the build.
Starting from TC10 it's possible. In your case it would be:
+:src/Project.Web/*.config => arch.zip
-:src/Project.Web/*.debug.config => arch.zip
This isn't possible the way you mentioned:
http://youtrack.jetbrains.com/issue/TW-5244
As a workaround until that issue is resolved, you can always create another build configuration with a snapshot dependency and an artefact dependency on your main build. Your main build outputs all of the files as artefacts. The configuration depending on this has an artefact dependency set to:
+:*.config => <replace with location>
-:*.debug.config
Then publish what you want from this configuration in the folder. Not ideal, but it will work.
Related
I really don't have much experience in developing let alone using build tools.
I was assigned a task to build dependencies locally and get the jar files.
say I have a list of deps (GAV) like this:-
1. org.jetbrains.kotlin:kotlin-stdlib:1.6.0-RC
2. com.auth0:java-jwt:3.18.2, etc
3. openapi4j:openapi-operation-validator:1.0.7, etc
So i was able to download the source code url from maven repository and source code from github programmatically, for example :-
org.jetbrains.kotlin:kotlin-stdlib:1.6.0-RC - https://github.com/JetBrains/kotlin
com.auth0:java-jwt:3.18.2 - https://github.com/auth0/java-jwt
openapi4j-openapi-operation-validator-1.0.7 https://github.com/openapi4j/openapi4j
but there are many build.gradle files in different directories, how do I know which directory should I move into before running the gradle build command.
Things I have already tried and failed:-
For deps like this openapi4j:openapi-operation-validator:1.0.7, i can directly go into the openapi-operation-validator folder in the Github repo (https://github.com/openapi4j/openapi4j ) and run the gradle build command, but not all projects are structured like that I guess?
For deps like this com.auth0:java-jwt:3.18.2, the artifactId (java-jwt
) is already present in the github path (https://github.com/auth0/java-jwt), so i can run the gradle build command on the root github repo.
From the spring guides , among all the Gradle.build files available I can check which file has:-
jar {
archiveBaseName = <artifactId>
archiveVersion = <version>
}
, then I can move to that dir and run Gradle build, but not all build.gradle files have this.
None of the above approaches are concrete, is there any other firm approach that I can use to tackle the problem?
Your approach is generally correct.
You need to find the source code in github/gitlab/wherever, read the readme file and try to build it with whatever build tool was used there.
This may or may not work.
I have a libgdx project that has multiple modules like 'core' and 'desktop' within the project root. I was missing the Gradle tab. I wanted to add new dependencies to the project and needed to sync the project.
Apparently reimporting is the way to fix that.
Issues:
Importing the project just gives me an empty project with a .gradle and .idea folder without any of my project.
Copying the projects manually just adds the modules as normal directories, the Gradle build fails.
Adding the modules through project structure adds them as separate project roots, the build fails again.
Errors:
Cause: invalid type code: 53
https://pastebin.com/d8VRbJp9
https://pastebin.com/hSzeW0ai
Build:
https://pastebin.com/BwkCJMaD
I noticed your build.gradle doesn't have any source setting going on.
The easiest way to remedy this is to create a new project using the setup tool (I personally prefer this one and then just copy your source files and assets across. After that, only change the build file to name the project etc. try not to fiddle with other things.
I am unsure as to whether this next method will work but you can try it. If you really want to keep your original project, try adding the following to the build.gradle under each specific project:
sourceSets.main.java.srcDirs 'src'
sourceSets.main.resources.srcDir 'assets'
So each project should look like:
project(":desktop") {
apply plugin: "java"
sourceSets.main.java.srcDirs 'src'
sourceSets.main.resources.srcDir 'assets'
...
}
If anyone tries this and it doesn't work, let me know and I'll remove it from the answer.
I'm trying to publish one of the output dll's to multiple artifact directories. But it seems, that teamcity is publishing that dll only to the last directory.
I would like to have something like this:
MyTool\MyTool.dll => MyZip.zip!/MyTool1/
MyTool\MyTool.dll => MyZip.zip!/MyTool2/
And on output:
MyZip.zip
MyTool1/MyTool.dll
MyTool2/MyTool.dll
But TeamCity returns me only last line:
MyZip.zip
MyTool2/MyTool.dll
Does anyone know how to publish one dll from builds output to multiple artifacts directories?
I spent some time looking for a workaround. It seems like the zip file is the sticking point. If it doesn't need to be zipped, then the following works fine:
MyTool\MyTool.dll => MyTool/MyTool1/
MyTool\MyTool.dll => MyTool/MyTool2/
Another option is to create a build step that moves the DLLs into the folder structure that you want, and then save that folder as the zipped artifact.
For a .NET Developer, the Teamcity artifact paths are not very straightforward.
Per project I do, I have a folder called BuildTools and, within it, folders called Drops and Inputs (drops being the reports and outputs inputs being the config files for various command line apps).
BuildTools/Drops/NDependOut => GenericSolution/Drops/NDepend
Is this correct? BuildTools is from the root of the (custom) checkout dir, and then GenericSolution is from the root of the artifacts path (Called "Artifacts" folder).
The other problem I have is that the NDepend report has a lot of images etc in the same folder as the .html file. How would I upload this? Do I upload the entire folder (in which case, is the syntax above correct?)
In general this is right. TeamCity has an option to zip artifacts before publish. For that use the following syntax
Folder/folder/*/ => destfolder/archive.zip
Another trick is to use TeamCity service message to publish artifacts dynamically from build script.
How do I copy files from a folder to the same folder in the target archive?
Below is what I came up with based on the documentation.
file_name|directory_name|wildcard [ => target_directory|target_archive ]
%env.PROJECT%/EnvironmentSpecificAppSettings/* =>EnvironmentSpecificAppSettings | ..\..\..\..\..\..\..\Artifacts\CI\Website.%system.build.number%.%system.build.vcs.number.PROJECT_CI%.CI.zip
I know of three options.
As sharma noted, you can use artifact paths in General Settings, which will allow you to describe a mapping of files on the buildAgent to files in the archive. You can use absolute or relative paths here. I don't think I've ever tried using property expansions there.
You can also use service messages - by emitting a message with a special format to output, you can issue a number of different commands to TeamCity, including a command to publishArtifacts
You can also use a simple file copy in your build to the appropriate directory in the archive. TeamCity sets properties with the names of the folders that you will need - teamcity.buildConfName, teamcity.projectName, teamcity.agent.dotnet.build_id, etc.
If you are talking about the artifact paths in General settings. Suppose you want the fodler 'Artifacts' in check out dir of the teamcity to be generated as artifacts in Artifacts.tgz then you may want to say:
%system.teamcity.build.checkoutDir%/Artifacts => Artifacts.tgz