使用Hudson持續整合Android專案
Hudson是一款持續整合引擎,架構在Subversion等版本控制工具上,依靠構建工具對專案進行整合構建,並且可以根據使用者需求提供相應的反饋,比如發郵件,總的來說是比較實用的。
這幾天在老師的要求下使用了Hudson,在純JAVA專案的情況下使用MAVEN配置起來還算簡單,無奈專案的客戶端是Android平臺的,在糾結了N天后還是配置不成功,最後改用Ant, 整個過程還是比較簡單,除了build.xml的編寫~~
注:下面的講述是在Hudson配置好的情況下實現的,換句話說你可以試試你的JAVA專案能否正確被Hudson持續整合
步驟:
1)首先按常理新建一個Android;
2)接著在該專案上右擊,新建一個build.xml(名字可以隨便取,這個在Hudson可以選擇構件所使用的專案檔案),然後將下面這段程式碼放入檔案
這幾天在老師的要求下使用了Hudson,在純JAVA專案的情況下使用MAVEN配置起來還算簡單,無奈專案的客戶端是Android平臺的,在糾結了N天后還是配置不成功,最後改用Ant, 整個過程還是比較簡單,除了build.xml的編寫~~
注:下面的講述是在Hudson配置好的情況下實現的,換句話說你可以試試你的JAVA專案能否正確被Hudson持續整合
步驟:
1)首先按常理新建一個Android;
2)接著在該專案上右擊,新建一個build.xml(名字可以隨便取,這個在Hudson可以選擇構件所使用的專案檔案),然後將下面這段程式碼放入檔案
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- 步驟:
3 第一.生成R.java
4 第二.JAVAC編譯JAVA檔案
5 第三.批處理生成classes.dex
6 第四.aapt打包資源
7 第五.apkbuilder包資源和類檔案為APK檔案
8 第六.jarsinger 對APK進行簽名 -->
9 <!-- 此處的專案名需修改為你的專案名 -->
10
11 <project name="SEOA_Client" basedir="." default="debug">
12
13 <!-- 此處應用系統的環境變數 -->
14
15 <property environment="env" />
16
17 <!-- SDK Locations -->
18
19 <!-- 獲取SDK的安裝目錄,注意在我的系統中環境變數的名稱為ANDROID_SDK_HOME,你可以修改成你的環境變數名稱 -->
20 <!-- 也可以直接指定路徑,下面採用的就是這種方式 -->
21 <property name="sdk2.2-folder" value="F:\sdk\android-sdk-windows" />
22
23 <!--如若你使用的android版本不一樣,可以在此處修改-->
24 <property name="sdk-folder" value="${sdk2.2-folder}/platforms/android-8" />
25
26 <property name="android.aidl" value="${sdk-folder}/framework.aidl" />
27 <property name="sdk-tools" value="${sdk-folder}/tools" />
28 <property name="android-tools" value="${sdk2.2-folder}/tools" />
29
30
31 <property name="verbose" value="false" />
32
33 <!-- 配置使用到的庫,只要保證路徑正確,不需修改-->
34
35 <path id="android.antlibs">
36 <pathelement location="${env.ANDROID_SDK_HOME}/tools/lib/anttasks.jar"/>
37 <pathelement location="${env.ANDROID_SDK_HOME}/tools/lib/sdklib.jar"/>
38 <pathelement location="${env.ANDROID_SDK_HOME}/tools/lib/androidprefs.jar"/>
39 </path>
40
41
42 <!-- step 1.generate R.java by aapt 2.compile java to class by javac 3.generate classes.dex by dx.bat -->
43 <!-- 4.package resources by aapt 5. package resource and classes.dex by apkbuilder.bat 6.sign apk by jarsinger -->
44
45 <!-- 配置在整個過程中使用到的Tools,不需修改 -->
46 <property name="aapt" value="${sdk-tools}/aapt.exe" />
47 <property name="dx" value="${sdk-tools}/dx.bat" />
48 <property name="apk-builder" value="${android-tools}/apkbuilder.bat" />
49 <property name="aidl" value="${sdk-tools}/aidl.exe" />
50 <property name="adb" value="${android-tools}/adb.exe" />
51 <property name="android-jar" value="${sdk-folder}/android.jar" />
52 <property name="jarsigner" value="${env.JAVA_HOME}/bin/jarsigner.exe" />
53
54 <!-- Android專案使用到所有庫,這個地方需修改-->
55 <path id="android.libraries.jars">
56 <pathelement location="${android-jar}"/>
57 <pathelement location="${basedir}/lib/commons-pool-1.5.4.jar"/>
58 </path>
59
60
61 <!-- Application Package Name,包名需修改 -->
62 <property name="application-package" value="com.android.ant" />
63
64 <!-- 以下都不需要修改 -->
65 <property name="useragent" value="byAndroidWeb" />
66 <property name="version" value="1.02" />
67 <!-- The intermediates directory -->
68
69 <!-- Eclipse uses "bin" for its own output, so we do the same. -->
70 <property name="outdir-bin" value="bin" />
71 <property name="outdir-gen" value="gen" />
72 <!-- source directories -->
73 <property name="resource-dir" value="res" />
74 <property name="asset-dir" value="assets" />
75 <property name="srcdir" value="src" />
76 <property name="srcdir-ospath" value="${basedir}/${srcdir}" />
77 <property name="external-libs" value="lib" />
78 <property name="external-libs-ospath" value="${basedir}/${external-libs}" />
79
80 <!-- dest directories -->
81 <property name="des-resource-dir" value="${outdir-bin}/res" />
82 <property name="des-asset-dir" value="${outdir-bin}/assets" />
83 <property name="des-srcdir" value="${outdir-bin}/src" />
84 <property name="des-srcdir-ospath" value="${basedir}/${outdir-bin}/${srcdir}" />
85 <property name="des-external-libs" value="${outdir-bin}/libs" />
86 <property name="des-external-libs-ospath" value="${basedir}/${outdir-bin}/${external-libs}" />
87
88 <!-- Output directories -->
89 <property name="outdir-classes" value="${outdir-bin}/src" />
90 <property name="outdir-obfuscate-classes" value="${outdir-bin}" />
91 <property name="outdir-obfuscate-classes-ospath" value="${basedir}/${outdir-obfuscate-classes}" />
92
93 <!-- Intermediate files -->
94 <property name="dex-file" value="classes.dex" />
95 <property name="intermediate-dex" value="${outdir-bin}/${dex-file}" />
96 <property name="intermediate-dex-ospath" value="${basedir}/${intermediate-dex}" />
97
98 <!-- The final package file to generate -->
99 <property name="resources-package" value="${outdir-bin}/${ant.project.name}" />
100 <property name="resources-package-ospath" value="${basedir}/${resources-package}" />
101 <property name="out-debug-package" value="${outdir-bin}/${ant.project.name}-debug.apk" />
102 <property name="out-debug-package-ospath" value="${basedir}/${out-debug-package}" />
103 <property name="out-unsigned-package" value="${outdir-bin}/${ant.project.name}-unsigned.apk" />
104 <property name="out-unsigned-package-ospath" value="${basedir}/${out-unsigned-package}" />
105 <property name="out-signed-package" value="${useragent}\${ant.project.name}.apk" />
106 <property name="out-signed-package-ospath" value="${basedir}\${out-signed-package}" />
107
108
109 <!-- init -->
110 <target name="init">
111 <echo>Creating all output directories </echo>
112 <delete dir="${outdir-bin}" />
113 <mkdir dir="${outdir-bin}" />
114 <mkdir dir="${outdir-classes}" />
115 </target>
116
117 <!-- copy original strings and modify useragent -->
118 <target name="copy" depends="init">
119 <echo>copy files to output folder</echo>
120 </target>
121
122
123 <!-- Generate the R.java file for this project's resources. -->
124
125 <target name="resource-src" depends="copy">
126 <echo>Generating R.java / Manifest.java from the resources</echo>
127 <echo>${aapt}</echo>
128 <exec executable="${aapt}" failonerror="true">
129 <arg value="package" />
130 <arg value="-m" />
131 <arg value="-J" />
132 <arg value="${outdir-gen}" />
133 <arg value="-M" />
134 <arg value="AndroidManifest.xml" />
135 <arg value="-S" />
136 <arg value="${resource-dir}" />
137 <arg value="-I" />
138
139 <arg value="${android-jar}" />
140 </exec>
141 </target>
142
143
144 <!-- Generate java classes from .aidl files. -->
145 <target name="aidl" depends="copy">
146 <echo>Compiling aidl files into Java classes</echo>
147 <apply executable="${aidl}" failonerror="true">
148 <arg value="-p${android.aidl}" />
149 <arg value="-I${srcdir}" />
150 <fileset dir="${srcdir}">
151 <include name="**/*.aidl"/>
152 </fileset>
153 </apply>
154 </target>
155
156 <!-- Compile this project's .java files into .class files. -->
157 <target name="compile" depends="copy, resource-src, aidl">
158 <javac encoding="ascii" target="1.6" debug="true" extdirs="" srcdir="." destdir="${outdir-classes}" bootclasspathref="android.libraries.jars">
159 <classpath>
160 <fileset dir="${external-libs}" includes="*.jar" />
161 </classpath>
162 </javac>
163 </target>
164
165 <!-- Convert this project's .class files into .dex files. -->
166 <target name="dex" depends="compile">
167 <echo>Converting compiled files and external libraries into ${outdir}/${dex-file}</echo>
168 <apply executable="${dx}" failonerror="true" parallel="false">
169 <arg value="--dex" />
170
171 <arg value="--output=${intermediate-dex-ospath}" />
172 <arg path="${outdir-obfuscate-classes-ospath}" />
173 <fileset dir="${external-libs}" includes="*.jar" />
174 </apply>
175 </target>
176
177 <!-- Put the project's resources into the output package file. -->
178 <target name="package-res-and-assets">
179 <echo>Packaging resources and assets</echo>
180 <exec executable="${aapt}" failonerror="true">
181 <arg value="package" />
182 <arg value="-f" />
183 <arg value="-M" />
184 <arg value="AndroidManifest.xml" />
185 <arg value="-S" />
186 <arg value="${resource-dir}" />
187 <arg value="-A" />
188 <arg value="${asset-dir}" />
189 <arg value="-I" />
190 <arg value="${android-jar}" />
191 <arg value="-F" />
192 <arg value="${resources-package}" />
193 </exec>
194 </target>
195
196 <!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
197 <target name="package-res-no-assets">
198 <echo>Packaging resources</echo>
199 <exec executable="${aapt}" failonerror="true">
200 <arg value="package" />
201 <arg value="-f" />
202 <arg value="-M" />
203 <arg value="AndroidManifest.xml" />
204 <arg value="-S" />
205 <arg value="${resource-dir}" />
206 <!-- No assets directory -->
207 <arg value="-I" />
208 <arg value="${android-jar}" />
209 <arg value="-F" />
210 <arg value="${resources-package}" />
211 </exec>
212 </target>
213
214 <!-- Invoke the proper target depending on whether or not
215 an assets directory is present. -->
216 <!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
217 only when the assets dir exists. -->
218 <target name="package-res">
219 <available file="${asset-dir}" type="dir" property="res-target" value="and-assets" />
220 <property name="res-target" value="no-assets" />
221 <antcall target="package-res-${res-target}" />
222 </target>
223
224 <!-- Package the application and sign it with a debug key.
225 This is the default target when building. It is used for debug. -->
226 <target name="debug" depends="dex, package-res">
227 <echo>Packaging ${out-debug-package}, and signing it with a debug key</echo>
228 <exec executable="${apk-builder}" failonerror="false">
229 <arg value="${out-debug-package-ospath}" />
230 <arg value="-z" />
231 <arg value="${resources-package-ospath}" />
232 <arg value="-f" />
233 <arg value="${intermediate-dex-ospath}" />
234 <arg value="-rf" />
235 <arg value="${srcdir-ospath}" />
236 <arg value="-rj" />
237 <arg value="${external-libs-ospath}" />
238 </exec>
239 </target>
240
241 <!-- Package the application without signing it.
242 This allows for the application to be signed later with an official publishing key. -->
243 <target name="package" depends="dex, package-res">
244 <echo>Packaging ${out-unsigned-package} for release</echo>
245 <exec executable="${apk-builder}" failonerror="true">
246 <arg value="${out-unsigned-package-ospath}" />
247 <arg value="-u" />
248 <arg value="-z" />
249 <arg value="${resources-package-ospath}" />
250 <arg value="-f" />
251 <arg value="${intermediate-dex-ospath}" />
252 <arg value="-rf" />
253 <arg value="${srcdir-ospath}" />
254 <arg value="-rj" />
255
256 <arg value="${external-libs-ospath}" />
257 </exec>
258 <echo>It will need to be signed with jarsigner before being published.</echo>
259 </target>
260
261 <target name="jarsigner" depends="package">
262 <echo>Packaging ${out-unsigned-package} for release</echo>
263 <exec executable="${jarsigner}" failonerror="true">
264 <arg value="-verbose" />
265 <arg value="-storepass" />
266 <arg value="byread002" />
267 <arg value="-keypass" />
268 <arg value="byread002" />
269 <arg value="-keystore" />
270 <arg value="bbyread.keystore" />
271 <arg value="-signedjar" />
272 <arg value="${out-signed-package-ospath}" />
273 <arg value="${out-unsigned-package-ospath}" />
274 <arg value="byread" />
275 </exec>
276 </target>
277
278 <target name="release" depends="jarsigner">
279 <echo>release for release</echo>
280 </target>
281
282 <!-- Install the package on the default emulator -->
283 <target name="install" depends="debug">
284 <echo>Installing ${out-debug-package} onto default emulator</echo>
285 <exec executable="${adb}" failonerror="true">
286 <arg value="install" />
287 <arg value="${out-debug-package}" />
288 </exec>
289 </target>
290
291 <target name="reinstall" depends="debug">
292 <echo>Installing ${out-debug-package} onto default emulator</echo>
293 <exec executable="${adb}" failonerror="true">
294 <arg value="install" />
295 <arg value="-r" />
296
297 <arg value="${out-debug-package}" />
298 </exec>
299 </target>
300
301 <!-- Uinstall the package from the default emulator -->
302 <target name="uninstall">
303 <echo>Uninstalling ${application-package} from the default emulator</echo>
304 <exec executable="${adb}" failonerror="true">
305 <arg value="uninstall" />
306 <arg value="${application-package}" />
307 </exec>
308 </target>
310 </project>
程式碼比較長,裡面有部分需要修改的地方,比如包的名字,比如安裝在伺服器上的SDK的路徑等,大家可以按照文字描述慢慢修改,之後就可以將專案提交,在Hudson上建立一個自由風格的專案,選擇使用Ant作為構建工具,選擇build.xml作為構件檔案,構建中很可能出現各種問題,大家可以根據Hudson的命令列輸出對build.xml檔案進行修改,具體做法目前我還不是很瞭解,例如: failonerror="true" ,我曾經把true改為false就跳過一個錯誤,大家儘量摸索一下吧
2 <!-- 步驟:
3 第一.生成R.java
4 第二.JAVAC編譯JAVA檔案
5 第三.批處理生成classes.dex
6 第四.aapt打包資源
7 第五.apkbuilder包資源和類檔案為APK檔案
8 第六.jarsinger 對APK進行簽名 -->
9 <!-- 此處的專案名需修改為你的專案名 -->
10
11 <project name="SEOA_Client" basedir="." default="debug">
12
13 <!-- 此處應用系統的環境變數 -->
14
15 <property environment="env" />
16
17 <!-- SDK Locations -->
18
19 <!-- 獲取SDK的安裝目錄,注意在我的系統中環境變數的名稱為ANDROID_SDK_HOME,你可以修改成你的環境變數名稱 -->
20 <!-- 也可以直接指定路徑,下面採用的就是這種方式 -->
21 <property name="sdk2.2-folder" value="F:\sdk\android-sdk-windows" />
22
23 <!--如若你使用的android版本不一樣,可以在此處修改-->
24 <property name="sdk-folder" value="${sdk2.2-folder}/platforms/android-8" />
25
26 <property name="android.aidl" value="${sdk-folder}/framework.aidl" />
27 <property name="sdk-tools" value="${sdk-folder}/tools" />
28 <property name="android-tools" value="${sdk2.2-folder}/tools" />
29
30
31 <property name="verbose" value="false" />
32
33 <!-- 配置使用到的庫,只要保證路徑正確,不需修改-->
34
35 <path id="android.antlibs">
36 <pathelement location="${env.ANDROID_SDK_HOME}/tools/lib/anttasks.jar"/>
37 <pathelement location="${env.ANDROID_SDK_HOME}/tools/lib/sdklib.jar"/>
38 <pathelement location="${env.ANDROID_SDK_HOME}/tools/lib/androidprefs.jar"/>
39 </path>
40
41
42 <!-- step 1.generate R.java by aapt 2.compile java to class by javac 3.generate classes.dex by dx.bat -->
43 <!-- 4.package resources by aapt 5. package resource and classes.dex by apkbuilder.bat 6.sign apk by jarsinger -->
44
45 <!-- 配置在整個過程中使用到的Tools,不需修改 -->
46 <property name="aapt" value="${sdk-tools}/aapt.exe" />
47 <property name="dx" value="${sdk-tools}/dx.bat" />
48 <property name="apk-builder" value="${android-tools}/apkbuilder.bat" />
49 <property name="aidl" value="${sdk-tools}/aidl.exe" />
50 <property name="adb" value="${android-tools}/adb.exe" />
51 <property name="android-jar" value="${sdk-folder}/android.jar" />
52 <property name="jarsigner" value="${env.JAVA_HOME}/bin/jarsigner.exe" />
53
54 <!-- Android專案使用到所有庫,這個地方需修改-->
55 <path id="android.libraries.jars">
56 <pathelement location="${android-jar}"/>
57 <pathelement location="${basedir}/lib/commons-pool-1.5.4.jar"/>
58 </path>
59
60
61 <!-- Application Package Name,包名需修改 -->
62 <property name="application-package" value="com.android.ant" />
63
64 <!-- 以下都不需要修改 -->
65 <property name="useragent" value="byAndroidWeb" />
66 <property name="version" value="1.02" />
67 <!-- The intermediates directory -->
68
69 <!-- Eclipse uses "bin" for its own output, so we do the same. -->
70 <property name="outdir-bin" value="bin" />
71 <property name="outdir-gen" value="gen" />
72 <!-- source directories -->
73 <property name="resource-dir" value="res" />
74 <property name="asset-dir" value="assets" />
75 <property name="srcdir" value="src" />
76 <property name="srcdir-ospath" value="${basedir}/${srcdir}" />
77 <property name="external-libs" value="lib" />
78 <property name="external-libs-ospath" value="${basedir}/${external-libs}" />
79
80 <!-- dest directories -->
81 <property name="des-resource-dir" value="${outdir-bin}/res" />
82 <property name="des-asset-dir" value="${outdir-bin}/assets" />
83 <property name="des-srcdir" value="${outdir-bin}/src" />
84 <property name="des-srcdir-ospath" value="${basedir}/${outdir-bin}/${srcdir}" />
85 <property name="des-external-libs" value="${outdir-bin}/libs" />
86 <property name="des-external-libs-ospath" value="${basedir}/${outdir-bin}/${external-libs}" />
87
88 <!-- Output directories -->
89 <property name="outdir-classes" value="${outdir-bin}/src" />
90 <property name="outdir-obfuscate-classes" value="${outdir-bin}" />
91 <property name="outdir-obfuscate-classes-ospath" value="${basedir}/${outdir-obfuscate-classes}" />
92
93 <!-- Intermediate files -->
94 <property name="dex-file" value="classes.dex" />
95 <property name="intermediate-dex" value="${outdir-bin}/${dex-file}" />
96 <property name="intermediate-dex-ospath" value="${basedir}/${intermediate-dex}" />
97
98 <!-- The final package file to generate -->
99 <property name="resources-package" value="${outdir-bin}/${ant.project.name}" />
100 <property name="resources-package-ospath" value="${basedir}/${resources-package}" />
101 <property name="out-debug-package" value="${outdir-bin}/${ant.project.name}-debug.apk" />
102 <property name="out-debug-package-ospath" value="${basedir}/${out-debug-package}" />
103 <property name="out-unsigned-package" value="${outdir-bin}/${ant.project.name}-unsigned.apk" />
104 <property name="out-unsigned-package-ospath" value="${basedir}/${out-unsigned-package}" />
105 <property name="out-signed-package" value="${useragent}\${ant.project.name}.apk" />
106 <property name="out-signed-package-ospath" value="${basedir}\${out-signed-package}" />
107
108
109 <!-- init -->
110 <target name="init">
111 <echo>Creating all output directories </echo>
112 <delete dir="${outdir-bin}" />
113 <mkdir dir="${outdir-bin}" />
114 <mkdir dir="${outdir-classes}" />
115 </target>
116
117 <!-- copy original strings and modify useragent -->
118 <target name="copy" depends="init">
119 <echo>copy files to output folder</echo>
120 </target>
121
122
123 <!-- Generate the R.java file for this project's resources. -->
124
125 <target name="resource-src" depends="copy">
126 <echo>Generating R.java / Manifest.java from the resources</echo>
127 <echo>${aapt}</echo>
128 <exec executable="${aapt}" failonerror="true">
129 <arg value="package" />
130 <arg value="-m" />
131 <arg value="-J" />
132 <arg value="${outdir-gen}" />
133 <arg value="-M" />
134 <arg value="AndroidManifest.xml" />
135 <arg value="-S" />
136 <arg value="${resource-dir}" />
137 <arg value="-I" />
138
139 <arg value="${android-jar}" />
140 </exec>
141 </target>
142
143
144 <!-- Generate java classes from .aidl files. -->
145 <target name="aidl" depends="copy">
146 <echo>Compiling aidl files into Java classes</echo>
147 <apply executable="${aidl}" failonerror="true">
148 <arg value="-p${android.aidl}" />
149 <arg value="-I${srcdir}" />
150 <fileset dir="${srcdir}">
151 <include name="**/*.aidl"/>
152 </fileset>
153 </apply>
154 </target>
155
156 <!-- Compile this project's .java files into .class files. -->
157 <target name="compile" depends="copy, resource-src, aidl">
158 <javac encoding="ascii" target="1.6" debug="true" extdirs="" srcdir="." destdir="${outdir-classes}" bootclasspathref="android.libraries.jars">
159 <classpath>
160 <fileset dir="${external-libs}" includes="*.jar" />
161 </classpath>
162 </javac>
163 </target>
164
165 <!-- Convert this project's .class files into .dex files. -->
166 <target name="dex" depends="compile">
167 <echo>Converting compiled files and external libraries into ${outdir}/${dex-file}</echo>
168 <apply executable="${dx}" failonerror="true" parallel="false">
169 <arg value="--dex" />
170
171 <arg value="--output=${intermediate-dex-ospath}" />
172 <arg path="${outdir-obfuscate-classes-ospath}" />
173 <fileset dir="${external-libs}" includes="*.jar" />
174 </apply>
175 </target>
176
177 <!-- Put the project's resources into the output package file. -->
178 <target name="package-res-and-assets">
179 <echo>Packaging resources and assets</echo>
180 <exec executable="${aapt}" failonerror="true">
181 <arg value="package" />
182 <arg value="-f" />
183 <arg value="-M" />
184 <arg value="AndroidManifest.xml" />
185 <arg value="-S" />
186 <arg value="${resource-dir}" />
187 <arg value="-A" />
188 <arg value="${asset-dir}" />
189 <arg value="-I" />
190 <arg value="${android-jar}" />
191 <arg value="-F" />
192 <arg value="${resources-package}" />
193 </exec>
194 </target>
195
196 <!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
197 <target name="package-res-no-assets">
198 <echo>Packaging resources</echo>
199 <exec executable="${aapt}" failonerror="true">
200 <arg value="package" />
201 <arg value="-f" />
202 <arg value="-M" />
203 <arg value="AndroidManifest.xml" />
204 <arg value="-S" />
205 <arg value="${resource-dir}" />
206 <!-- No assets directory -->
207 <arg value="-I" />
208 <arg value="${android-jar}" />
209 <arg value="-F" />
210 <arg value="${resources-package}" />
211 </exec>
212 </target>
213
214 <!-- Invoke the proper target depending on whether or not
215 an assets directory is present. -->
216 <!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
217 only when the assets dir exists. -->
218 <target name="package-res">
219 <available file="${asset-dir}" type="dir" property="res-target" value="and-assets" />
220 <property name="res-target" value="no-assets" />
221 <antcall target="package-res-${res-target}" />
222 </target>
223
224 <!-- Package the application and sign it with a debug key.
225 This is the default target when building. It is used for debug. -->
226 <target name="debug" depends="dex, package-res">
227 <echo>Packaging ${out-debug-package}, and signing it with a debug key</echo>
228 <exec executable="${apk-builder}" failonerror="false">
229 <arg value="${out-debug-package-ospath}" />
230 <arg value="-z" />
231 <arg value="${resources-package-ospath}" />
232 <arg value="-f" />
233 <arg value="${intermediate-dex-ospath}" />
234 <arg value="-rf" />
235 <arg value="${srcdir-ospath}" />
236 <arg value="-rj" />
237 <arg value="${external-libs-ospath}" />
238 </exec>
239 </target>
240
241 <!-- Package the application without signing it.
242 This allows for the application to be signed later with an official publishing key. -->
243 <target name="package" depends="dex, package-res">
244 <echo>Packaging ${out-unsigned-package} for release</echo>
245 <exec executable="${apk-builder}" failonerror="true">
246 <arg value="${out-unsigned-package-ospath}" />
247 <arg value="-u" />
248 <arg value="-z" />
249 <arg value="${resources-package-ospath}" />
250 <arg value="-f" />
251 <arg value="${intermediate-dex-ospath}" />
252 <arg value="-rf" />
253 <arg value="${srcdir-ospath}" />
254 <arg value="-rj" />
255
256 <arg value="${external-libs-ospath}" />
257 </exec>
258 <echo>It will need to be signed with jarsigner before being published.</echo>
259 </target>
260
261 <target name="jarsigner" depends="package">
262 <echo>Packaging ${out-unsigned-package} for release</echo>
263 <exec executable="${jarsigner}" failonerror="true">
264 <arg value="-verbose" />
265 <arg value="-storepass" />
266 <arg value="byread002" />
267 <arg value="-keypass" />
268 <arg value="byread002" />
269 <arg value="-keystore" />
270 <arg value="bbyread.keystore" />
271 <arg value="-signedjar" />
272 <arg value="${out-signed-package-ospath}" />
273 <arg value="${out-unsigned-package-ospath}" />
274 <arg value="byread" />
275 </exec>
276 </target>
277
278 <target name="release" depends="jarsigner">
279 <echo>release for release</echo>
280 </target>
281
282 <!-- Install the package on the default emulator -->
283 <target name="install" depends="debug">
284 <echo>Installing ${out-debug-package} onto default emulator</echo>
285 <exec executable="${adb}" failonerror="true">
286 <arg value="install" />
287 <arg value="${out-debug-package}" />
288 </exec>
289 </target>
290
291 <target name="reinstall" depends="debug">
292 <echo>Installing ${out-debug-package} onto default emulator</echo>
293 <exec executable="${adb}" failonerror="true">
294 <arg value="install" />
295 <arg value="-r" />
296
297 <arg value="${out-debug-package}" />
298 </exec>
299 </target>
300
301 <!-- Uinstall the package from the default emulator -->
302 <target name="uninstall">
303 <echo>Uninstalling ${application-package} from the default emulator</echo>
304 <exec executable="${adb}" failonerror="true">
305 <arg value="uninstall" />
306 <arg value="${application-package}" />
307 </exec>
308 </target>
310 </project>
相關文章
- Hudson:持續整合工具的安裝、使用
- Jenkins 持續整合 Android 專案JenkinsAndroid
- 使用 Jenkins 持續整合 Android 專案遇到的坑JenkinsAndroid
- Ccover在hudson持續整合中的應用
- 使用 Subversion、Hudson 和 Eclipse 構建持續整合系統Eclipse
- 持續整合工具Hudson安裝方法(非常簡單)
- Hudson之Asp.net持續整合設計方案。ASP.NET
- 使用Jenkins可持續整合maven專案JenkinsMaven
- 持續整合之hudson的構建任務排程
- Java專案持續整合檢查項Java
- iOS專案的持續整合與管理iOS
- (jenkins)hudson平臺搭建android專案持續化整合以及基於NativeDriver的UI自動化測試環境JenkinsAndroidUI
- 自動化專案Jenkins持續整合Jenkins
- Practice - iOS 專案持續整合實踐(一)iOS
- Practice – iOS 專案持續整合實踐(一)iOS
- 開始使用Travis CI持續整合你的專案吧
- 前端er,Jenkins持續化整合Webpack專案前端JenkinsWeb
- Framework專案持續整合(jenkins)及集合SonarQubeFrameworkJenkins
- vue + webpack 前端專案持續釋出整合部署VueWeb前端
- .net持續整合sonarqube篇之專案管理與使用者管理專案管理
- 使用Xcode5的Bots做持續整合專案實踐XCode
- 前端專案基於GitLab-CI的持續整合/持續部署(CI/CD)前端Gitlab
- 持續整合、持續部署、持續交付、持續釋出
- 持續整合持續部署持續交付_持續整合與持續部署之間的真正區別
- 持續整合、持續交付、持續部署簡介
- Jenkins實現持續整合 使用Ant指令碼構建ios專案Jenkins指令碼iOS
- iOS持續整合(一)——fastlane 使用iOSAST
- Jenkins 持續整合使用教程Jenkins
- 使用GitLabCI持續整合Gitlab
- 整合持續整合工具
- 使用流水線外掛實現持續整合、持續部署
- jenkins+gitlab+docker持續整合部署maven專案JenkinsGitlabDockerMaven
- 手把手教你利用Jenkins持續整合iOS專案JenkinsiOS
- OC中專案使用swift(持續更新中)Swift
- iOS 持續整合iOS
- iOS使用fastlane實現持續整合iOSAST
- 基於Gitlab-CI/CD Docker 持續整合 node 專案GitlabDocker
- 淺談持續整合(CI)、持續交付(CD)、持續部署(CD)