How can I make a build number based on the dependencies' build numbers?
Our installer configuration depends on several program components, which are built in separate configurations. They all use different vcs roots. This means the build number of the installer reflects the latest change to the installer itself, not the latest change to the included components.
I am trying to set up a custom build number that fixes this issue, and my first idea was to use a python build step to iterate over the build numbers of all the dependencies and selecting the largest. This however requires me to pass all those in manualy, which is far from ideal. When someone copies the project (as we do when we create a new branch), they would have to update these manually, which they will forget. It's a long shot, but is there some way of passing several properties to the build step? Something like %dep.*.build.number%?
Another option would be for each configuration to create a file containing the build number, and add this to the artifacts. The installer could then iterate over the these files to set its build number. This has the advantage that no manual updates are needed after copying a project.
Since option one is probably impossbile and option two is cumbersone, do you have any other idea for how to do this? Ideally, this would be a TeamCity property, something like %build.largest_dependency_number%.
Please sign in to leave a comment.
I made a Python script that does this: https://github.com/knatten/scripts/blob/master/vcs_number.py
From the documentation: