tor-android/custom_rules.xml

58 lines
2.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project>
<target name="-getgitdetails" >
<exec executable="git" outputproperty="git.describe">
<arg value="describe"/>
</exec>
<exec executable="git" outputproperty="git.revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>
<target name="rename-release-with-version-number" depends="-getgitdetails">
<xmlproperty file="AndroidManifest.xml"
prefix="themanifest"
collapseAttributes="true"/>
<!-- see ${sdk.dir}/tools/ant/build.xml -set-release-mode -->
<property name="out.packaged.file"
location="${out.absolute.dir}/${ant.project.name}-v${git.describe}-unsigned.apk" />
<property name="out.final.file"
location="${out.absolute.dir}/${ant.project.name}-v${git.describe}.apk" />
</target>
<target name="-set-release-mode"
depends="rename-release-with-version-number,android_rules.-set-release-mode">
<echo message="target: ${build.target}"></echo>
</target>
<target name="-post-package" depends="-getgitdetails">
<property file="${sdk.dir}/tools/source.properties"/>
<property name="meta.inf.dir" value="${out.dir}/META-INF"/>
<property name="build.manifest.file" value="${meta.inf.dir}/BUILD.MF"/>
<mkdir dir="${meta.inf.dir}"/>
<manifest file="${build.manifest.file}">
<attribute name="Implementation-Package-Name" value="${themanifest.manifest.package}"/>
<attribute name="Implementation-Version-Name" value="${themanifest.manifest.android:versionName}"/>
<attribute name="Implementation-Version-Code" value="${themanifest.manifest.android:versionCode}"/>
<attribute name="Git-Revision" value="${git.revision}"/>
<attribute name="Android-SDK-Release" value="${Pkg.Revision}"/>
<attribute name="Android-SDK-Host-OS" value="${Archive.HostOs}"/>
<attribute name="Android-SDK-aapt" value="${aapt}"/>
<attribute name="Android-SDK-zipalign" value="${zipalign}"/>
</manifest>
<condition property="build.is.debug" value="true" else="false">
<equals arg1="${build.target}" arg2="debug" />
</condition>
<!-- adding BUILD.MF breaks debug builds, but not releases -->
<if condition="${build.is.debug}">
<else>
<jar update="true" destfile="${out.packaged.file}">
<fileset dir="${out.dir}" includes="META-INF/BUILD.MF"/>
</jar>
</else>
</if>
</target>
</project>