This doesn't work - the second line "overrides" the first, so foo.dll only ends up in lib/.
bin/foo.dll => release!bin/
bin/foo.dll => release!lib/
I need to copy foo.dll to both bin/ and lib/ - is that possible?
Related
I'm working on multiple projects in go using modules.
Project 1: github.com/company/project1
/
- /auth
- service.go
- main.go
- go.mod
Project 2: github.com/company/project2
/
- /cart
- service.go
- main.go
- go.mod
If I have in my project2/go.mod next import: github.com/company/project1 and I already created both projects on Github.
How can I test both projects locally? I mean, without pushing test code (on project1) and using go get github.com/company/project1 previously because I just want to push my last commits when I finish both codes (project1 and project2).
As #CeriseLimón and #oakad pointed out in their comments, using replace in your go.mod files allow to use local copies of a repo instead of requiring to commit the project that is a dependency.
Project 2's go.mod:
module github.com/company/project2
require (
...
github.com/company/project1 v0.0.0
)
replace github.com/company/project1 => LOCAL_PATH
Replace LOCAL_PATH for your relative path from project2 to project1, for example, if both are find under $GOPATH/src, LOCAL_PATH would have to be replaced by ../project1 (considering that the project1 directory is named project1). You should also replace v0.0.0 to another version if it applies (this is, if project1 has different versions, the line inside the requirte block should point to the right version. The ellipsis (...) represents any other dependency of your project2.
NOTE: you should not push the replace github.com/company/project1 => LOCAL_PATH line to your VCS unless every developer uses the same relative path and you have some sort of automated or manual way of removing that line before releases, as you do not want that line to be present in releases.
I have a CMake project using Makefiles on Windows, with a folder structure that looks like this (the build takes place in build):
project
|- build
|- ...
|- otherfolder
|- stuff
|- more stuff
As a build step (pre- or post doesn't matter), I want to make a copy of project into build (excluding the build folder), like so:
project
|- build
|- ...
|- project
|- otherfolder
|- stuff
|- more stuff
|- otherfolder
|- stuff
|- more stuff
Other options might be acceptable as well, e.g. copying to a temporary directory outside the project root before moving it into place, but CMake seemingly has no builtin support for generating temporary directories.
Things I've tried: xcopy has support for excluding certain files and directories, but refuses to copy even if I explicitly exclude the build folder. cmake -E copy_directory does not (from what I'm able to find) support excluding certain directories.
CMake's file(COPY ... PATTERN build EXCLUDE ... copies successfully, but it runs at CMake configure time and I haven't been able to find a way to make it run at build time.
I might resort to using Python and shutil, but it would be nice if it could be done without additional dependencies, so I'd prefer a batch file solution.
There are several ways for doing selectable directory copiing.
You can use cmake -P for execute cmake script at any time. E.g:
copy_to_build.cmake:
file(COPY . DESTINATION build PATTERN build EXCLUDE)
CMakeLists.txt:
add_custom_command(... COMMAND cmake -P copy_to_build.cmake)
You can prepare list of subdirectories (and files) at configuration stage, and then copy every element of that list using xcopy. This approach uses fact, that everything outside of build directory is not changed. Here iteration is done on configuration stage (by CMake). I am not sure, whether "for" loop works under COMMAND of add_custom_command. If it works, you can use it for iterate over entries in the shell.
CMakeLists.txt:
# List of elements in source directory.
file(GLOB entries RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
# List of commands for pass to `add_custom_command` as is.
# `COMMAND` keyword is included into list.
set(copy_commands)
foreach(entry ${entries})
list(APPEND copy_commands COMMAND xcopy /s /i
${CMAKE_CURRENT_SOURCE_DIR}/${entry} ${CMAKE_CURRENT_SOURCE_DIR}/build/${entry}
endforeach()
add_custom_command(... ${copy_commands})
I have a TeamCity (9.0.2) build configuration which contains the following artefact path pattern:
App\Agent\**\bin\%env.Configuration%\** => Deployment\AgentBuildPackage.%env.ApplicationVersion.EMX%.%system.build.number%.zip
which will create a file named something like AgentBuildPackage.4.5.0.185.zip in an artefact folder named Deployment
The current structure is like this:
Deployment/
AgentBuildPackage.4.5.0.185.zip/
MyFirstServiceFolder/
bin/
Debug|Release/
All the Files
The artefact archive contains all the folders it finds under App\Agent which is great. What I can't figure out is how to flatten those individual folders so they no longer contain the /bin/Release sub-folders.
What I want is
Deployment/
AgentBuildPackage.4.5.0.185.zip/
MyFirstServiceFolder/
All the Files
Can anyone tell me how please?
You can specify target folders within your target archive by using the ! character after the name of the .zip file. Like this:
folderA\** => output.zip!/afolder/
Depending on how many service folders you have, this could be quite verbose, as you'll need to do it for each one, but it should do what you've described:
App\Agent\MyFirstServiceFolder\bin\%env.Configuration%\** => Deployment\AgentBuildPackage.%env.ApplicationVersion.EMX%.%system.build.number%.zip!/MyFirstServiceFolder/
Here's the documentation page on specifying artifact paths if you haven't seen it yet: https://confluence.jetbrains.com/display/TCD9/Configuring+General+Settings#ConfiguringGeneralSettings-PathsPatterns
I'm having trouble with a directory dependency in a parallel build in SCons.
Consider two projects with a single SConstruct in the following (simplified) hierarchy:
- SConstruct
- project1
- src
- project2
- src
- build
- project1
- project2
- dist
- project1
- project2
Each of project1 and project2 are supposed to be built under the relevant build directory (using variant dir) and several targets needs to be installed under the relevant dist directory.
Project 2 depends on Project 1's dist. I've states this dependency explicitly using the Depends() statement like so:
Depends('project2', 'dist/project1')
When I use a non-parallel build, there's no problem. Project 1 is fully built, targets are installed in the dist directory, and only then project 2 is built. However, when I use multiple jobs (4), project 2 is being built simultaneously to the Install() builder being run for the files needed to be installed in project 1's dist directory.
So, my questions are:
Does the Depends(project2, dist/project1) statement refers to the creation of the dist/project1 directory or to the completion of building all the directory's children?
How should I solve this issue?
Thank you very much,
BugoK.
Instead of specifying the actual directories as strings in the Depends() function, try specifying the actual targets as returned by the SCons project1 and project2 builders. Every SCons builder (or at least most of them) returns the affected target as an object, and its better to use this object instead of the file/directoy name since if you dont use the exact same file/directory path, it wont be considered as the same target.
Here is an example, fill in content accordingly:
project2Target = Install()
# Im not sure how you're building project1, so replace the builder
project1Target = Proj1DistBuiler()
Depends(project2Target, project1Target)
Can anyone give me an example of what the Artifact paths setting defined for a build configuration could look like if I want to create two artifacts dist and source where I am using the sln 2008 build runner and building my projects using the default bin/Release?
**/Source/Code/MyProject/bin/Release/*.* => dist
**/*.* => source
I get two artifact roots dist and source but under dist I get the whole directory structure (Source/Code/MyProject/bin/Release) which I don't want and under source I get the whole thing along with obj and bin/Release which I do not want.
Can you give some advice on how to do this correctly?
Do I need to change the target location for all the projects I am building to be able to get this thing to work?
So you'll just need:
Source\Code\MyProject\bin\Release\* => dist
Source\**\* => source
This will put all the files in release into a artifact folder called dist and everything in Source into a artifact folder called source.
If you have subfolders in Release try:
Source\Code\MyProject\bin\Release\**\* => dist
According to TeamCity documentation; it should be like this:
file_name|directory_name|Ant-like wildcard [ => target_directory ]
So..
Source\Code\MyProject\bin\Release|**\* => dist (| not \)