TFS + Gradle + app Versioning


(Raghu Bhagavatula) #1

We are using TFS to host and build Android code using Gradle Plugin. TFS has options to add Build number, Dates, Versions etc.

I would like to add build information to build.gradle. Has anyone done this yet? Not sure how to proceed with this


(James Justinic) #2

We have source code on multiple repositories and build on multiple CI servers. TFS is one of them, but there’s not really anything unique to TFS in this area. The process is the same on just about any build server. In the options that get passed to Gradle, provide arguments for the properties that you want to use, but where the value goes, use the specific value that the TFS documentation specifies.

In the case of TFS, the build number is provided as $(Build.BuildNumber). Add the argument for a project property to the the Options field: -PbuildNumber=$(Build.BuildNumber) and the actual number will be provided. Use it for whatever you want in build.gradle, just like any other project property: Gradle properties and system properties.