From ce4c432363f4691ee4aae29334900adaab0b6223 Mon Sep 17 00:00:00 2001 From: "cjhopman@chromium.org" Date: Fri, 5 Oct 2012 16:51:32 +0000 Subject: [PATCH] Make apks build from a single ant .xml template The ant build files for each of the apks that we create consisted of only fairly straightforward boilerplate. With the recent changes to java_apk.gypi and the gyp targets we can now build these correctly from a single .xml with the differences in how the targets are built being reflected in the gyp files (and then passed into ant). TBR=joth BUG=145991 Review URL: https://chromiumcodereview.appspot.com/10959034 git-svn-id: http://src.chromium.org/svn/trunk/src/build@160396 4ff67af0-8c30-449e-8e8b-ad334ec8d88c --- android/ant/chromium-apk.xml | 54 ++++++++++++++++++++++++++++++++++++ android/ant/sdk-targets.xml | 49 ++++++++++++++++++++++++++------ java.gypi | 2 +- java_apk.gypi | 14 +++++++--- 4 files changed, 106 insertions(+), 13 deletions(-) create mode 100644 android/ant/chromium-apk.xml diff --git a/android/ant/chromium-apk.xml b/android/ant/chromium-apk.xml new file mode 100644 index 000000000..2779a5e6c --- /dev/null +++ b/android/ant/chromium-apk.xml @@ -0,0 +1,54 @@ + + + + + + Building ${ant.project.name}.apk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/ant/sdk-targets.xml b/android/ant/sdk-targets.xml index 7909daa32..5f323d7f0 100644 --- a/android/ant/sdk-targets.xml +++ b/android/ant/sdk-targets.xml @@ -34,18 +34,15 @@ name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile"> - + - + - - - - + - + @@ -105,8 +102,10 @@ - + Creating test jar file: ${ant.project.name}-debug.jar @@ -168,4 +167,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java.gypi b/java.gypi index 05e89c9d0..65cfe3db2 100644 --- a/java.gypi +++ b/java.gypi @@ -18,7 +18,6 @@ # # The generated jar-file will be: # <(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar -# # Required variables: # package_name - Used to name the intermediate output directory and in the # names of some output files. @@ -67,6 +66,7 @@ ], 'action': [ 'ant', + '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', '-DANDROID_SDK=<(android_sdk)', '-DANDROID_SDK_ROOT=<(android_sdk_root)', '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', diff --git a/java_apk.gypi b/java_apk.gypi index 8330342cd..4aa6ea8da 100644 --- a/java_apk.gypi +++ b/java_apk.gypi @@ -39,6 +39,8 @@ # ensure that this target is rebuilt when one of these paths changes. # additional_src_dirs - Additional directories with .java files to be compiled # and included in the output of this target. +# asset_location - The directory where assets are located (default: +# //assets). # generated_src_dirs - Same as additional_src_dirs except used for .java files # that are generated at build time. This should be set automatically by a # target's dependencies. The .java files in these directories are not @@ -50,9 +52,10 @@ { 'variables': { + 'asset_location': '', + 'additional_input_paths': [], 'input_jars_paths': [], 'native_libs_paths': [], - 'additional_input_paths': [], 'additional_src_dirs': [], 'generated_src_dirs': [], }, @@ -61,8 +64,8 @@ 'action_name': 'ant_<(package_name)_apk', 'message': 'Building <(package_name) apk.', 'inputs': [ - '<(java_in_dir)/<(package_name)_apk.xml', '<(java_in_dir)/AndroidManifest.xml', + '<(DEPTH)/build/android/ant/chromium-apk.xml', '<(DEPTH)/build/android/ant/common.xml', '<(DEPTH)/build/android/ant/sdk-targets.xml', # If there is a separate find for additonal_src_dirs, it will find the @@ -89,14 +92,17 @@ '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', '-DPRODUCT_DIR=<(ant_build_out)', + '-DAPK_NAME=<(apk_name)', + '-DASSET_DIR=<(asset_location)', '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', - '-DINPUT_JARS_PATHS=>(input_jars_paths)', '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', + '-DINPUT_JARS_PATHS=>(input_jars_paths)', '-DPACKAGE_NAME=<(package_name)', '-DRESOURCE_DIR=<(resource_dir)', + '-Dbasedir=<(java_in_dir)', '-buildfile', - '<(java_in_dir)/<(package_name)_apk.xml' + '<(DEPTH)/build/android/ant/chromium-apk.xml' ] }, ],