Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: build/android/ant/apk-build.xml

Issue 12598009: Simplify ant signing/zipalign code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delete_cruft2
Patch Set: Rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- 2 <!--
3 Copyright (C) 2005-2008 The Android Open Source Project 3 Copyright (C) 2005-2008 The Android Open Source Project
4 4
5 Licensed under the Apache License, Version 2.0 (the "License"); 5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License. 6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at 7 You may obtain a copy of the License at
8 8
9 http://www.apache.org/licenses/LICENSE-2.0 9 http://www.apache.org/licenses/LICENSE-2.0
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 For debug builds, the Android SDK tools create a key in ~/.android and sig n the build with it. 203 For debug builds, the Android SDK tools create a key in ~/.android and sig n the build with it.
204 This has caused all kinds of issues. Instead, the debug build should be si gned with a key in 204 This has caused all kinds of issues. Instead, the debug build should be si gned with a key in
205 build/android/ant. The SDK tools do not provide any support for overriding that behavior and so 205 build/android/ant. The SDK tools do not provide any support for overriding that behavior and so
206 instead one must use the hack below. 206 instead one must use the hack below.
207 --> 207 -->
208 <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium -debug.keystore"/> 208 <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium -debug.keystore"/>
209 <property name="key.store.password" value="chromium"/> 209 <property name="key.store.password" value="chromium"/>
210 <property name="key.alias" value="chromiumdebugkey"/> 210 <property name="key.alias" value="chromiumdebugkey"/>
211 <property name="key.alias.password" value="chromium"/> 211 <property name="key.alias.password" value="chromium"/>
212 212
213 <!-- properties for signing in release mode -->
214 <condition property="has.keystore">
215 <and>
216 <isset property="key.store" />
217 <length string="${key.store}" when="greater" length="0" />
218 <isset property="key.alias" />
219 </and>
220 </condition>
221 <condition property="has.password">
222 <and>
223 <isset property="has.keystore" />
224 <isset property="key.store.password" />
225 <isset property="key.alias.password" />
226 </and>
227 </condition>
228
229 <!-- properties for packaging --> 213 <!-- properties for packaging -->
230 <property name="build.packaging.nocrunch" value="true" /> 214 <property name="build.packaging.nocrunch" value="true" />
231 215
232 <!-- whether we need to fork javac. 216 <!-- whether we need to fork javac.
233 This is only needed on Windows when running Java < 7 --> 217 This is only needed on Windows when running Java < 7 -->
234 <condition else="false" property="need.javac.fork"> 218 <condition else="false" property="need.javac.fork">
235 <and> 219 <and>
236 <matches pattern="1\.[56]" string="${java.specification.version}"/> 220 <matches pattern="1\.[56]" string="${java.specification.version}"/>
237 <not> 221 <not>
238 <os family="unix"/> 222 <os family="unix"/>
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 </target> 837 </target>
854 838
855 <!-- SDK tools assume that out.packaged.file is signed and name it "...-unal igned" --> 839 <!-- SDK tools assume that out.packaged.file is signed and name it "...-unal igned" -->
856 <property name="out.packaged.file" 840 <property name="out.packaged.file"
857 value="${apks.dir}/${ant.project.name}-unsigned.apk" /> 841 value="${apks.dir}/${ant.project.name}-unsigned.apk" />
858 <property name="out.unaligned.file" 842 <property name="out.unaligned.file"
859 value="${apks.dir}/${ant.project.name}-unaligned.apk" /> 843 value="${apks.dir}/${ant.project.name}-unaligned.apk" />
860 844
861 <!-- By default, the SDK tools build only aligns the APK in the -do-debug ta rget. --> 845 <!-- By default, the SDK tools build only aligns the APK in the -do-debug ta rget. -->
862 <!-- Builds debug output package --> 846 <!-- Builds debug output package -->
847 <target name="-do-sign"
848 depends="-package, -post-package">
849 <sequential>
850 <!-- Signs the APK -->
851 <echo level="info">Signing final apk...</echo>
852 <signapk
853 input="${out.packaged.file}"
854 output="${out.unaligned.file}"
855 keystore="${key.store}"
856 storepass="${key.store.password}"
857 alias="${key.alias}"
858 keypass="${key.alias.password}"/>
859
860 <!-- Zip aligns the APK -->
861 <zipalign-helper
862 in.package="${out.unaligned.file}"
863 out.package="${out.final.file}" />
864 <echo level="info">Release Package: ${out.final.file}</echo>
865 </sequential>
866 </target>
867
863 <target name="-do-debug" 868 <target name="-do-debug"
864 depends="-set-debug-mode, -debug-obfuscation-check, -package, -post-pack age"> 869 depends="-set-debug-mode, -debug-obfuscation-check, -do-sign">
865 <!-- only create apk if *not* a library project -->
866 <do-only-if-not-library elseText="Library project: do not create apk..." >
867 <sequential>
868 <!-- Signs the APK -->
869 <echo level="info">Signing final apk...</echo>
870 <signapk
871 input="${out.packaged.file}"
872 output="${out.unaligned.file}"
873 keystore="${key.store}"
874 storepass="${key.store.password}"
875 alias="${key.alias}"
876 keypass="${key.alias.password}"/>
877
878 <!-- Zip aligns the APK -->
879 <zipalign-helper
880 in.package="${out.unaligned.file}"
881 out.package="${out.final.file}" />
882 <echo level="info">Release Package: ${out.final.file}</echo>
883 </sequential>
884 </do-only-if-not-library>
885 <record-build-info /> 870 <record-build-info />
886 </target> 871 </target>
887 872
888 <!-- Builds debug output package --> 873 <!-- Builds debug output package -->
889 <target name="debug" depends="-set-debug-files, -do-debug, -post-build" 874 <target name="debug" depends="-set-debug-files, -do-debug, -post-build"
890 description="Builds the application and signs it with a debug ke y."> 875 description="Builds the application and signs it with a debug ke y.">
891 </target> 876 </target>
892 877
893
894 <!-- ******************************************************* --> 878 <!-- ******************************************************* -->
895 <!-- *************** Release specific targets ************** --> 879 <!-- *************** Release specific targets ************** -->
896 <!-- ******************************************************* --> 880 <!-- ******************************************************* -->
897 881
898 <!-- called through target 'release'. Only executed if the keystore and
899 key alias are known but not their password. -->
900 <target name="-release-prompt-for-password" if="has.keystore" unless="has.pa ssword">
901 </target>
902
903 <!-- called through target 'release'. Only executed if there's no
904 keystore/key alias set -->
905 <target name="-release-nosign" unless="has.keystore">
906 <record-build-info />
907 </target>
908
909 <target name="-release-obfuscation-check"> 882 <target name="-release-obfuscation-check">
910 <echo level="info">proguard.config is ${proguard.config}</echo> 883 <echo level="info">proguard.config is ${proguard.config}</echo>
911 <condition property="proguard.enabled" value="true" else="false"> 884 <condition property="proguard.enabled" value="true" else="false">
912 <and> 885 <and>
913 <isset property="build.is.mode.release" /> 886 <isset property="build.is.mode.release" />
914 <isset property="proguard.config" /> 887 <isset property="proguard.config" />
915 </and> 888 </and>
916 </condition> 889 </condition>
917 <if condition="${proguard.enabled}"> 890 <if condition="${proguard.enabled}">
918 <then> 891 <then>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 </then> 924 </then>
952 <else> 925 <else>
953 <!-- property only set in release mode. 926 <!-- property only set in release mode.
954 Useful for if/unless attributes in target node 927 Useful for if/unless attributes in target node
955 when using Ant before 1.8 --> 928 when using Ant before 1.8 -->
956 <property name="build.is.mode.release" value="true"/> 929 <property name="build.is.mode.release" value="true"/>
957 </else> 930 </else>
958 </if> 931 </if>
959 </target> 932 </target>
960 933
961 <target name="-release-sign" if="has.keystore" > 934 <target name="-release-sign" depends="-do-sign" >
962 <!-- only create apk if *not* a library project -->
963 <do-only-if-not-library elseText="Library project: do not create apk..." >
964 <sequential>
965 <property name="out.unaligned.file" location="${out.absolute.dir }/${ant.project.name}-release-unaligned.apk" />
966
967 <!-- Signs the APK -->
968 <echo level="info">Signing final apk...</echo>
969 <signapk
970 input="${out.packaged.file}"
971 output="${out.unaligned.file}"
972 keystore="${key.store}"
973 storepass="${key.store.password}"
974 alias="${key.alias}"
975 keypass="${key.alias.password}"/>
976
977 <!-- Zip aligns the APK -->
978 <zipalign-helper
979 in.package="${out.unaligned.file}"
980 out.package="${out.final.file}" />
981 <echo level="info">Release Package: ${out.final.file}</echo>
982 </sequential>
983 </do-only-if-not-library>
984 <record-build-info /> 935 <record-build-info />
985 </target> 936 </target>
986 937
987 <!-- This runs -package-release and -release-nosign first and then runs 938 <!-- This runs -package-release first and then runs
988 only if release-sign is true (set in -release-check, 939 only if release-sign is true (set in -release-check,
989 called by -release-no-sign)--> 940 called by -release-no-sign)-->
990 <target name="release" 941 <target name="release"
991 depends="-set-release-mode, -release-obfuscation-check, -package , -post-package, -release-prompt-for-password, -release-nosign, -release-sign, - post-build" 942 depends="-set-release-mode, -release-obfuscation-check, -package , -post-package, -release-sign, -post-build"
992 description="Builds the application in release mode."> 943 description="Builds the application in release mode.">
993 </target> 944 </target>
994 945
995 </project> 946 </project>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698