I'm using Jenkins for building my projects. I'm using Ant to do the compilation itself.
When build finishes I'd like to copy files that were compiled in this build to some directory. Is this possible?
Yes, you could do this as part of your Ant project using the Ant copy task. Best practice is to clean the directory containing your compiled binaries at the start of each build, so you should just be able to copy the whole directory without filtering the contents.
If you want to specifically find changed files, you could take a recursive md5 over your Target directory before and after your build, and only copy those files which do not match the prebuild checksum.
This being said, if you've got a clean build directory you should just copy everything over; changed files will get copied as needed, and unchanged files will copy but won't impact the application.
Related
It it possible to copy certain files into / within the generated .jar AFTER it has been finished? E.g. I would like to simply rename one file after the compilation is done.
Ofc, one could also extract the jar, change the file and repack it again as a jar. Though I wonder whether this is optimal or not.
You can try to use shadow lib. It is plugin for Gradle.
Guide for it.
I am using X-Code 10 as a C IDE. I am doing a group project and we must use GitLab to share the code. To work in Xcode there are a lot of files to make Xcode work, but none that I need to share with my partners who are using their own IDE and who just need the .c files we are working on. How do I make Git not upload ALL files and just the .c?
There are ways to handle the excludes for a git project. There is the .gitignore file where you can create rules for what files should be excluded from your project. This file will be tracked by git, so you and your teammates will be sharing this file.
For your own personal excludes, you can put them into the .git/info/exclude file. This will not be tracked by git and will affect only your own local repository. This is a good place put rules that are specific to your own workflow.
I am starting to learn about CMake and have two questions:
1. Do I need to update the CMakeLists.txt file every time When I add a new file?
Assuming that the size of the project grows, the number of subdirectories and source files in the project will also increased greatly.
In such a case, I guess it is inconvenient to update the CMakelists.txt file whenever a new file or directory is added to the project.
Or is it part of the code management? How is it usually done?
2. In order to build a C Eclipse project(makefile) using CMake, should I write the CMakeList.txt manually?
There are many ways to import CMake projects into Eclipse, but I can't see how to build a C Eclipse project with CMake.
Do I need to update the CMakeLists.txt file every time When I add a new file?
CMake, like GNU make, allows to use wildcards to specify source files.
However, it's good practice to explicitly list files to build, in order to avoid silly mistakes (due, for example, to missing or unexpected files in source directory).
When file list becomes large, build definition files (like CMakeLists.txt) may be split into multiple files.
In order to build a / C Eclipse project(makefile) / using CMake, Should I write CMakelist.txt manually?
I don't know aboud Eclipse, but many IDEs partially/completely automate CMakelists.txt creation. Maybe Eclipse has such a tool too.
Yes write your CMakeLists.txt manually. This can barely be automated, beside adding new header files. There is a way to include all *.h files, but it is not enouraged.
And add every new header file manually. C files are not needed. Adding header files should not happen ofen.
Writing your own CMakeLists.txt files is recommended (at least you understand how CMake works). However, for larger projects it makes sense to automate it. I decided to post my own CMake generator https://github.com/Aenteas/cmake-generator so anyone who wants to implement their customized version could adopt some ideas from here (as it is not likely that my generator would suit your needs perfectly).
I am using the "VCS Trigger" trigger: "Triggers one build per each VCS check-in".
I have two Build steps:
One that runs the .sln file
Another that copies files to the destination webroot.
Is there a way to configure TeamCity so that it only copies to the destination webroot the files that were part of the commit that triggered the build process?
I would not recommend that, since .net solutions are bundled together so that files from one build may not work in another build. At least that is my experience...
I have an Eclipse project that I need to auto-generate some files before compiling it. I do not want to put this auto-generated files in my repository, so each time I compile the projetct I perform a pre-build to auto-generate this files.
The problem is that this auto-generated files are *.c and *.h files, and in the first time I compile the project, the following happens (in this order):
pre-build: auto-generate some *.c and *.h
build: eclipse will not build this auto-generated files
If I compile again, this files will be compiled. Maybe this is happening because of the discovery process of what files eclipse will compile. Before initing compilation, we do not have this auto-generated *.c and *.h files.
In the second time we compile, we already have this auto-generated files, so this files are compiled.
If you want full control over when exactly the custom build step takes place, which files need to be refreshed after it, the environment, the working directory etc.. do not specify it as a simple pre-build step. Go to the project properties -> Builders -> New... and choose "Program".
In the resulting dialog, you have much more control over the execution of your tool. For instance, you can make your tool run whenever the XML file is saved, and you can tell eclipse to refresh all the auto-generated files whenever it is run.
If I understand your question correctly, it seems that building your project the first time will auto-generate the necessary *.c and *.h source files, but the project will fail to fully build because these source files are not found immediately. After a small delay, Eclipse recognizes that there are new files added to the project and you can then build a second time and everything will proceed normally. Does that sound about right?
Assuming this is the case, my immediate thought is to write some sort of script or makefile so that all of these actions can take place in the proper order, with a single action. Depending on how dirty you want to get your hands, here's a link ;)
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/concepts/cdt_c_makefile.htm