|
244 | 244 | <checkenv /> |
245 | 245 | </target> |
246 | 246 |
|
247 | | - <!-- target to disable building dependencies --> |
248 | | - <target name="nodeps"> |
249 | | - <property name="dont.do.deps" value="true" /> |
250 | | - </target> |
251 | | - |
252 | 247 | <!-- generic setup --> |
253 | 248 | <target name="-setup" depends="-check-env"> |
254 | 249 | <echo level="info">Project Name: ${ant.project.name}</echo> |
|
259 | 254 |
|
260 | 255 | </target> |
261 | 256 |
|
262 | | - <!-- empty default pre-clean target. Create a similar target in |
263 | | - your build.xml and it'll be called instead of this one. --> |
264 | | - <target name="-pre-clean"/> |
265 | | - |
266 | | - <!-- clean target --> |
267 | | - <target name="clean" depends="-setup, -pre-clean" |
268 | | - description="Removes output files created by other targets."> |
269 | | - <delete dir="${out.absolute.dir}" verbose="${verbose}" failonerror="false" /> |
270 | | - <delete dir="${gen.absolute.dir}" verbose="${verbose}" failonerror="false" /> |
271 | | - |
272 | | - <!-- get all the libraries --> |
273 | | - <if> |
274 | | - <condition><not><isset property="dont.do.deps" /></not></condition> |
275 | | - <then> |
276 | | - <getlibpath libraryFolderPathOut="project.library.folder.path" /> |
277 | | - <if> |
278 | | - <condition> |
279 | | - <isreference refid="project.library.folder.path" /> |
280 | | - </condition> |
281 | | - <then> |
282 | | - <!-- clean the libraries with nodeps since we already |
283 | | - know about all the libraries even the indirect one --> |
284 | | - <subant |
285 | | - buildpathref="project.library.folder.path" |
286 | | - antfile="build.xml" |
287 | | - failonerror="true"> |
288 | | - <target name="nodeps" /> |
289 | | - <target name="clean" /> |
290 | | - </subant> |
291 | | - </then> |
292 | | - </if> |
293 | | - </then> |
294 | | - </if> |
295 | | - </target> |
296 | | - |
297 | 257 | <!-- Pre build setup --> |
298 | 258 | <target name="-build-setup" depends="-setup"> |
299 | 259 | <!-- find location of build tools --> |
|
340 | 300 | targetApi="${project.target.apilevel}" |
341 | 301 | verbose="${verbose}" /> |
342 | 302 |
|
343 | | - <!-- compile the libraries if any --> |
344 | | - <if> |
345 | | - <condition> |
346 | | - <and> |
347 | | - <isreference refid="project.library.folder.path" /> |
348 | | - <not><isset property="dont.do.deps" /></not> |
349 | | - </and> |
350 | | - </condition> |
351 | | - <then> |
352 | | - <echo level="info">----------</echo> |
353 | | - <echo level="info">Building Libraries with '${project.libraries.target}'...</echo> |
354 | | - |
355 | | - <!-- TODO: print the library folder paths --> |
356 | | - <pathconvert property="pathconv" refid="project.library.folder.path" /> |
357 | | - <echo>${pathconv}</echo> |
358 | | - |
359 | | - <!-- no need to build the deps as we have already |
360 | | - the full list of libraries --> |
361 | | - <property name="project.libraries.target" value="release" /> |
362 | | - <subant failonerror="true" |
363 | | - buildpathref="project.library.folder.path" |
364 | | - antfile="build.xml"> |
365 | | - <target name="nodeps" /> |
366 | | - <target name="${project.libraries.target}" /> |
367 | | - </subant> |
368 | | - </then> |
369 | | - </if> |
370 | 303 | </target> |
371 | 304 |
|
372 | 305 | <!-- empty default pre-build target. Create a similar target in |
|
513 | 446 | <target name="-post-package" /> |
514 | 447 | <target name="-post-build" /> |
515 | 448 |
|
| 449 | + <!-- ******************************************************* --> |
| 450 | + <!-- **************** Clean specific targets *************** --> |
| 451 | + <!-- ******************************************************* --> |
| 452 | + |
| 453 | + <target name="-clean"> |
| 454 | + <delete dir="${out.absolute.dir}" verbose="${verbose}" failonerror="false" /> |
| 455 | + <delete dir="${gen.absolute.dir}" verbose="${verbose}" failonerror="false" /> |
| 456 | + </target> |
| 457 | + |
| 458 | + <target name="clean"> |
| 459 | + <computedeps src="." refid="project.library.folder.path" /> |
| 460 | + <subant failonerror="true" |
| 461 | + buildpathref="project.library.folder.path" |
| 462 | + antfile="build.xml"> |
| 463 | + <target name="-clean" /> |
| 464 | + </subant> |
| 465 | + </target> |
| 466 | + |
516 | 467 | <!-- ******************************************************* --> |
517 | 468 | <!-- **************** Site specific targets **************** --> |
518 | 469 | <!-- ******************************************************* --> |
|
522 | 473 | </target> |
523 | 474 |
|
524 | 475 | <!-- ******************************************************* --> |
525 | | - <!-- *************** Release specific targets ************** --> |
| 476 | + <!-- ***************** APK specific targets **************** --> |
526 | 477 | <!-- ******************************************************* --> |
527 | | - <target name="-set-release-mode"> |
| 478 | + |
| 479 | + <target name="-set-path"> |
528 | 480 | <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-0.apk" /> |
529 | 481 | <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}.apk" /> |
530 | 482 | </target> |
531 | 483 |
|
532 | | - <target name="-release-sign"> |
533 | | - <sequential> |
534 | | - <!-- Zip aligns the APK --> |
535 | | - <zipalign-helper |
536 | | - in.package="${out.packaged.file}" |
537 | | - out.package="${out.final.file}" /> |
538 | | - <echo level="info">Final Package: ${out.final.file}</echo> |
539 | | - </sequential> |
| 484 | + <target name="-zipalign"> |
| 485 | + <!-- Zip aligns the APK --> |
| 486 | + <zipalign-helper |
| 487 | + in.package="${out.packaged.file}" |
| 488 | + out.package="${out.final.file}" /> |
| 489 | + <echo level="info">Final Package: ${out.final.file}</echo> |
540 | 490 | </target> |
541 | 491 |
|
542 | | - <!-- This runs -package-release and -release-nosign first and then runs |
543 | | - only if release-sign is true (set in -release-check, |
544 | | - called by -release-no-sign)--> |
545 | | - <target name="do-release" |
546 | | - depends="-set-release-mode, -package, -post-package, -release-sign, -post-build, site" |
| 492 | + <target name="-do-apk" |
| 493 | + depends="-set-path, -package, -post-package, -zipalign, -post-build, site" |
547 | 494 | description="Builds the application in release mode."> |
548 | 495 | </target> |
549 | 496 |
|
550 | | - <target name="-check-release" depends="-set-release-mode, site"> |
551 | | - <uptodate property="release.nochanges" targetfile="${out.final.file}"> |
| 497 | + <target name="-uptodate" depends="-set-path, site"> |
| 498 | + <uptodate property="uptodate.nochanges" targetfile="${out.final.file}"> |
552 | 499 | <srcfiles dir="${source.absolute.dir}" includes="**/*.java"/> |
553 | 500 | <srcfiles dir="${resource.absolute.dir}" includes="**"/> |
554 | 501 | </uptodate> |
555 | 502 | </target> |
556 | 503 |
|
557 | | - <target name="release" |
558 | | - depends="-check-release" unless="release.nochanges"> |
| 504 | + <target name="-apk" |
| 505 | + depends="-uptodate" unless="uptodate.nochanges"> |
559 | 506 | <!-- Some changes in resources may cause issue. So rebuild this plugin --> |
560 | 507 | <delete dir="${out.absolute.dir}/a" verbose="${verbose}" failonerror="false" /> |
561 | 508 |
|
562 | | - <antcall target="do-release" /> |
| 509 | + <antcall target="-do-apk" /> |
563 | 510 | </target> |
564 | 511 |
|
| 512 | + <target name="release"> |
| 513 | + <computedeps src="." refid="project.library.folder.path" /> |
| 514 | + <subant failonerror="true" |
| 515 | + buildpathref="project.library.folder.path" |
| 516 | + antfile="build.xml"> |
| 517 | + <target name="-apk" /> |
| 518 | + </subant> |
| 519 | + </target> |
| 520 | + |
| 521 | + <!-- ******************************************************* --> |
| 522 | + <!-- ************** Run/Debug specific targets ************* --> |
| 523 | + <!-- ******************************************************* --> |
| 524 | + |
565 | 525 | <target name="run" |
566 | 526 | depends="release" |
567 | 527 | description="start app, upload codes, and launch."> |
|
0 commit comments