- removed test stuff from build.xml

- added new build-test.xml for test builds
This commit is contained in:
Philipp Schaefer
2013-10-22 13:09:55 +02:00
parent 48e4af33ea
commit 72e09e709a
2 changed files with 205 additions and 112 deletions

View File

@ -87,118 +87,6 @@
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- allow the package name to be overridden when building -->
<property name="override.package.name" value="com.cradle.iitc_mobile.test"/>
<!-- Puts the project's resources into the output package file
This actually can create multiple resource package in case
Some custom apk with specific configuration have been
declared in default.properties.
-->
<target name="-package-resources" depends="-crunch">
<!-- only package resources if *not* a library project -->
<do-only-if-not-library elseText="Library project: do not package resources..." >
<aapt executable="${aapt}"
command="package"
versioncode="${version.code}"
versionname="${version.name}"
debug="${build.is.packaging.debug}"
manifest="${out.manifest.abs.file}"
manifestpackage="${override.package.name}"
assets="${asset.absolute.dir}"
androidjar="${project.target.android.jar}"
apkfolder="${out.absolute.dir}"
nocrunch="${build.packaging.nocrunch}"
resourcefilename="${resource.package.file.name}"
resourcefilter="${aapt.resource.filter}"
libraryResFolderPathRefid="project.library.res.folder.path"
libraryPackagesRefid="project.library.packages"
libraryRFileRefid="project.library.bin.r.file.path"
previousBuildType="${build.last.target}"
buildType="${build.target}"
ignoreAssets="${aapt.ignore.assets}">
<res path="${out.res.absolute.dir}" />
<res path="${resource.absolute.dir}" />
<!-- <nocompress /> forces no compression on any files in assets or res/raw -->
<!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
</aapt>
</do-only-if-not-library>
</target>
<target name="-pre-build" depends="-custom-git-version,-custom-manifest-version,-test-setup">
</target>
<!-- Packages the application. -->
<target name="-post-build">
<antcall target="-custom-restore-manifest"/>
<antcall target="-test-revert"/>
</target>
<!-- Custom targets -->
<target name="-custom-git-version">
<exec executable="sh" outputproperty="git.commits">
<arg value="-c" />
<arg value="git log --pretty=format:'' | wc -l" />
</exec>
<echo>git.commits: ${git.commits}</echo>
<exec executable="git" outputproperty="git.version">
<arg value="rev-parse" />
<arg value="--short" />
<arg value="HEAD" />
</exec>
<echo>git.version: ${git.version}</echo>
</target>
<target name="-custom-manifest-version">
<echo>Creating backup of AndroidManifest.xml</echo>
<copy file="AndroidManifest.xml" tofile="AndroidManifest.xml.antbak" preservelastmodified="true" />
<replaceregexp
file="AndroidManifest.xml"
match='android:versionCode="(\d+)"'
replace='android:versionCode="${git.commits}"' />
<replaceregexp
file="AndroidManifest.xml"
match='android:versionName="(\d+\.\d+\.\d+)"'
replace='android:versionName="\1.${git.version}"' />
</target>
<target name="-custom-restore-manifest">
<echo>Restoring backup of AndroidManifest.xml</echo>
<move file="AndroidManifest.xml.antbak"
tofile="AndroidManifest.xml"
preservelastmodified="true"
overwrite="true" />
</target>
<target name="-test-setup">
<echo>Creating backup of strings.xml and preferences.xml</echo>
<copy file="res/values/strings.xml" tofile="strings.xml.antbak" preservelastmodified="true" />
<copy file="res/xml/preferences.xml" tofile="preferences.xml.antbak" preservelastmodified="true" />
<replaceregexp
file="res/values/strings.xml"
match='IITC Mobile'
replace='IITCm Test'/>
<replaceregexp
file="res/xml/preferences.xml"
match='targetPackage="com.cradle.iitc_mobile"'
replace='targetPackage="com.cradle.iitc_mobile.test"'/>
</target>
<target name="-test-revert">
<echo>Restoring backup of strings.xml and preferences.xml</echo>
<move file="strings.xml.antbak"
tofile="res/values/strings.xml"
preservelastmodified="true"
overwrite="true" />
<move file="preferences.xml.antbak"
tofile="res/xml/preferences.xml"
preservelastmodified="true"
overwrite="true" />
</target>
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />