diff options
author | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-28 18:22:29 +0000 |
---|---|---|
committer | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-28 18:22:29 +0000 |
commit | d54f19b08781809524c67379a7de4348e16e8664 (patch) | |
tree | 081b405cb026cda8be1f11143b6db6832dd57df7 /build | |
parent | 55c566d7b3fa0133e20adb601167c2925fc9eb6a (diff) | |
download | chromium_src-d54f19b08781809524c67379a7de4348e16e8664.zip chromium_src-d54f19b08781809524c67379a7de4348e16e8664.tar.gz chromium_src-d54f19b08781809524c67379a7de4348e16e8664.tar.bz2 |
Add more generic support for java targets bundling multiple directories
Currently chromium_testshell_test_apk and content_shell_test_apk compile
and package java files from two different directories. Supporting this
in a good way is a requirement for using a single ant template for all
apks.
Introduce a new gyp variable for apk/jar targets, generated_src_dirs.
Now, generated_src_dirs is for directories that contain .java files that
are generated at build time and additional_src_dirs is for extra normal
directories to include in the jar/apk.
Change content_shell_test_apk and chromium_testshell_test_apk to use
additional_src_dirs for their extra dirs.
Add documentation for the gyp variables for jar/apk targets.
Reorder the ant defines in the java.gypi and java_apk.gypi.
BUG=136756,146056
Review URL: https://chromiumcodereview.appspot.com/10987083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/android/ant/chromium-jars.xml | 1 | ||||
-rw-r--r-- | build/java.gypi | 41 | ||||
-rw-r--r-- | build/java_aidl.gypi | 2 | ||||
-rw-r--r-- | build/java_apk.gypi | 39 |
4 files changed, 62 insertions, 21 deletions
diff --git a/build/android/ant/chromium-jars.xml b/build/android/ant/chromium-jars.xml index aac4064..7007df5 100644 --- a/build/android/ant/chromium-jars.xml +++ b/build/android/ant/chromium-jars.xml @@ -24,6 +24,7 @@ <path id="javac.srcdirs.additional"> <filelist files="${ADDITIONAL_SRC_DIRS}"/> + <filelist files="${GENERATED_SRC_DIRS}"/> </path> <property-value diff --git a/build/java.gypi b/build/java.gypi index 249f063..05e89c9 100644 --- a/build/java.gypi +++ b/build/java.gypi @@ -16,16 +16,25 @@ # 'includes': ['path/to/this/gypi/file'], # } # -# Note that this assumes that there's ant buildfile with package_name in -# java_in_dir. So if if you have package_name="base" and -# java_in_dir="base/android/java" you should have a directory structure like: +# The generated jar-file will be: +# <(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar # -# base/android/java/base.xml -# base/android/java/org/chromium/base/Foo.java -# base/android/java/org/chromium/base/Bar.java -# -# Finally, the generated jar-file will be: -# <(PRODUCT_DIR)/lib.java/chromium_base.jar +# Required variables: +# package_name - Used to name the intermediate output directory and in the +# names of some output files. +# java_in_dir - The top-level java directory. The src should be in +# <java_in_dir>/src. +# Optional/automatic variables: +# additional_input_paths - These paths will be included in the 'inputs' list to +# 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. +# 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 +# included in the 'inputs' list (unlike additional_src_dirs). +# input_jars_paths - The path to jars to be included in the classpath. This +# should be filled automatically by depending on the appropriate targets. { 'dependencies': [ @@ -40,6 +49,7 @@ 'input_jars_paths': [], 'additional_src_dirs': [], 'additional_input_paths': [], + 'generated_src_dirs': [], }, 'actions': [ { @@ -48,7 +58,7 @@ 'inputs': [ 'android/ant/common.xml', 'android/ant/chromium-jars.xml', - '<!@(find <(java_in_dir) -name "*.java")', + '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', '>@(input_jars_paths)', '>@(additional_input_paths)', ], @@ -57,15 +67,18 @@ ], 'action': [ 'ant', - '-DPRODUCT_DIR=<(ant_build_out)', - '-DPACKAGE_NAME=<(package_name)', - '-DINPUT_JARS_PATHS=>(input_jars_paths)', - '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', '-DANDROID_SDK=<(android_sdk)', '-DANDROID_SDK_ROOT=<(android_sdk_root)', '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', '-DANDROID_SDK_VERSION=<(android_sdk_version)', '-DANDROID_GDBSERVER=<(android_gdbserver)', + '-DPRODUCT_DIR=<(ant_build_out)', + + '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', + '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', + '-DINPUT_JARS_PATHS=>(input_jars_paths)', + '-DPACKAGE_NAME=<(package_name)', + '-Dbasedir=<(java_in_dir)', '-buildfile', '<(DEPTH)/build/android/ant/chromium-jars.xml' diff --git a/build/java_aidl.gypi b/build/java_aidl.gypi index 84e645e..9833256 100644 --- a/build/java_aidl.gypi +++ b/build/java_aidl.gypi @@ -32,7 +32,7 @@ { 'direct_dependent_settings': { 'variables': { - 'additional_src_dirs': ['<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/'], + 'generated_src_dirs': ['<(SHARED_INTERMEDIATE_DIR)/<(package_name)/aidl/'], }, }, 'rules': [ diff --git a/build/java_apk.gypi b/build/java_apk.gypi index a368bfc..8330342 100644 --- a/build/java_apk.gypi +++ b/build/java_apk.gypi @@ -26,13 +26,35 @@ # content/shell/android/java/content_shell_apk.xml # content/shell/android/java/src/chromium/base/Foo.java # content/shell/android/java/src/chromium/base/Bar.java +# +# Required variables: +# package_name - Used to name the intermediate output directory and in the +# names of some output files. +# apk_name - The final apk will be named <apk_name>-debug.apk (or -release) +# java_in_dir - The top-level java directory. The src should be in +# <java_in_dir>/src. +# resource_dir - The directory for resources. +# Optional/automatic variables: +# additional_input_paths - These paths will be included in the 'inputs' list to +# 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. +# 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 +# included in the 'inputs' list (unlike additional_src_dirs). +# input_jars_paths - The path to jars to be included in the classpath. This +# should be filled automatically by depending on the appropriate targets. +# native_libs_paths - The path to any native library to be included in this +# target. { 'variables': { 'input_jars_paths': [], 'native_libs_paths': [], - 'additional_src_dirs': [], 'additional_input_paths': [], + 'additional_src_dirs': [], + 'generated_src_dirs': [], }, 'actions': [ { @@ -43,7 +65,9 @@ '<(java_in_dir)/AndroidManifest.xml', '<(DEPTH)/build/android/ant/common.xml', '<(DEPTH)/build/android/ant/sdk-targets.xml', - '<!@(find <(java_in_dir) -name "*.java")', + # If there is a separate find for additonal_src_dirs, it will find the + # wrong .java files when additional_src_dirs is empty. + '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', '<!@(find <(java_in_dir)/<(resource_dir) -name "*")', '>@(input_jars_paths)', '>@(native_libs_paths)', @@ -54,7 +78,6 @@ ], 'action': [ 'ant', - '-DPRODUCT_DIR=<(ant_build_out)', '-DAPP_ABI=<(android_app_abi)', '-DANDROID_GDBSERVER=<(android_gdbserver)', '-DANDROID_SDK=<(android_sdk)', @@ -62,12 +85,16 @@ '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', '-DANDROID_SDK_VERSION=<(android_sdk_version)', '-DANDROID_TOOLCHAIN=<(android_toolchain)', - '-DPACKAGE_NAME=<(package_name)', + '-DCHROMIUM_SRC=<(ant_build_out)/../..', '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', - '-DINPUT_JARS_PATHS=>(input_jars_paths)', + '-DPRODUCT_DIR=<(ant_build_out)', + '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', - '-DCHROMIUM_SRC=<(ant_build_out)/../..', + '-DINPUT_JARS_PATHS=>(input_jars_paths)', + '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', + '-DPACKAGE_NAME=<(package_name)', '-DRESOURCE_DIR=<(resource_dir)', + '-buildfile', '<(java_in_dir)/<(package_name)_apk.xml' ] |