Reputation: 1273
It seems that the TeamCity parameter ${build.counter} is not resolving in our ant build.xml. We have:
<replaceregexp
file="AndroidManifest.xml"
match='android:versionCode="(.*)"'
replace='android:versionCode="${build.counter}"'
/>
This throws the error:
String types not allowed (at 'versionCode' with value '${build.counter}')
It looks like it is taking the parameter "${build.counter}" as a literal string.
Using another TeamCity integer parameter in place of ${build.counter}, for example ${teamcity.build.id}, works fine.
Does anyone know why this might be?
Update
Thanks Biswajit_86 for the answer. Here also is my related discussion with JetBrains:
Upvotes: 1
Views: 1825
Reputation: 9392
Ant won't read teamctiy varaibles directly. You'll need to create a similar build.counter
property in your ant project like:
<property name="build.conuter" value=""/>
and pass its value from Teamcity build step like:
Upvotes: 0
Reputation: 3739
Your build files wont know the value of build.counter at all. They can only read system properties but build.counter is a config parameter.
To do this declare a system parameter named system.BUILD.COUNTER whoose value is %build.counter% and pass this into your target. If you change your abnt build.xml to read ${BUILD.COUNTER}, it will work fine
build parameters section system.BUILD.COUNTER %build.counter%
build xml file
<replaceregexp
file="AndroidManifest.xml"
match='android:versionCode="(.*)"'
replace='android:versionCode="${BUILD.COUNTER}"'
/>
Upvotes: 3