Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
| 6 # to build Java in a consistent manner. | 6 # to build Java in a consistent manner. |
| 7 # | 7 # |
| 8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
| 9 # { | 9 # { |
| 10 # 'target_name': 'my-package_java', | 10 # 'target_name': 'my-package_java', |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 # additional_input_paths - These paths will be included in the 'inputs' list to | 27 # additional_input_paths - These paths will be included in the 'inputs' list to |
| 28 # ensure that this target is rebuilt when one of these paths changes. | 28 # ensure that this target is rebuilt when one of these paths changes. |
| 29 # additional_src_dirs - Additional directories with .java files to be compiled | 29 # additional_src_dirs - Additional directories with .java files to be compiled |
| 30 # and included in the output of this target. | 30 # and included in the output of this target. |
| 31 # generated_src_dirs - Same as additional_src_dirs except used for .java files | 31 # generated_src_dirs - Same as additional_src_dirs except used for .java files |
| 32 # that are generated at build time. This should be set automatically by a | 32 # that are generated at build time. This should be set automatically by a |
| 33 # target's dependencies. The .java files in these directories are not | 33 # target's dependencies. The .java files in these directories are not |
| 34 # included in the 'inputs' list (unlike additional_src_dirs). | 34 # included in the 'inputs' list (unlike additional_src_dirs). |
| 35 # input_jars_paths - The path to jars to be included in the classpath. This | 35 # input_jars_paths - The path to jars to be included in the classpath. This |
| 36 # should be filled automatically by depending on the appropriate targets. | 36 # should be filled automatically by depending on the appropriate targets. |
| 37 # has_java_resources - Set to 1 if the java target contains an | |
| 38 # Android-compatible resources folder named res. If 1, R_package and | |
| 39 # R_package_relpath must also be set. | |
| 40 # R_package - The java package in which the R class (which maps resources to | |
| 41 # integer IDs) should be generated, e.g. org.chromium.content. | |
| 42 # R_package_relpath - Same as R_package, but replace each '.' with '/'. | |
| 37 | 43 |
| 38 { | 44 { |
| 39 'dependencies': [ | 45 'dependencies': [ |
| 40 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' | 46 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' |
| 41 ], | 47 ], |
| 42 # This all_dependent_settings is used for java targets only. This will add the | 48 # This all_dependent_settings is used for java targets only. This will add the |
| 43 # chromium_<(package_name) jar to the classpath of dependent java targets. | 49 # chromium_<(package_name) jar to the classpath of dependent java targets. |
| 44 'all_dependent_settings': { | 50 'all_dependent_settings': { |
| 45 'variables': { | 51 'variables': { |
| 46 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar '], | 52 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar '], |
| 47 }, | 53 }, |
| 48 }, | 54 }, |
| 49 'variables': { | 55 'variables': { |
| 50 'input_jars_paths': [], | 56 'input_jars_paths': [], |
| 51 'additional_src_dirs': [], | 57 'additional_src_dirs': [], |
| 52 'additional_input_paths': [], | 58 'additional_input_paths': ['>@(additional_R_files)'], |
| 53 'generated_src_dirs': [], | 59 'generated_src_dirs': ['>@(generated_R_dirs)'], |
| 60 'generated_R_dirs': [], | |
| 61 'additional_R_files': [], | |
| 62 'has_java_resources%': 0, | |
| 54 }, | 63 }, |
| 55 'actions': [ | 64 'actions': [ |
| 56 { | 65 { |
| 57 'action_name': 'ant_<(package_name)', | 66 'action_name': 'ant_<(package_name)', |
| 58 'message': 'Building <(package_name) java sources.', | 67 'message': 'Building <(package_name) java sources.', |
| 59 'inputs': [ | 68 'inputs': [ |
| 60 'android/ant/common.xml', | 69 'android/ant/common.xml', |
| 61 'android/ant/chromium-jars.xml', | 70 'android/ant/chromium-jars.xml', |
| 62 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 71 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
| 63 '>@(input_jars_paths)', | 72 '>@(input_jars_paths)', |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 80 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', | 89 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', |
| 81 '-DINPUT_JARS_PATHS=>(input_jars_paths)', | 90 '-DINPUT_JARS_PATHS=>(input_jars_paths)', |
| 82 '-DPACKAGE_NAME=<(package_name)', | 91 '-DPACKAGE_NAME=<(package_name)', |
| 83 | 92 |
| 84 '-Dbasedir=<(java_in_dir)', | 93 '-Dbasedir=<(java_in_dir)', |
| 85 '-buildfile', | 94 '-buildfile', |
| 86 '<(DEPTH)/build/android/ant/chromium-jars.xml' | 95 '<(DEPTH)/build/android/ant/chromium-jars.xml' |
| 87 ] | 96 ] |
| 88 }, | 97 }, |
| 89 ], | 98 ], |
| 99 'conditions': [ | |
|
cjhopman
2012/11/14 00:34:41
I think this block should go before the previous a
newt (away)
2012/11/14 03:28:50
I just noticed that other gyp files tend to put co
cjhopman
2012/11/14 21:16:19
Yeah, I think it would be better to move it up.
| |
| 100 ['has_java_resources == 1', { | |
| 101 'variables': { | |
| 102 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', | |
| 103 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | |
| 104 'generated_src_dirs': ['<(R_dir)'], | |
| 105 'additional_input_paths': ['<(R_file)'], | |
| 106 }, | |
| 107 'all_dependent_settings': { | |
| 108 'variables': { | |
| 109 # Dependent jars include this target's R.java file via | |
| 110 # generated_R_dirs and additional_R_files. | |
| 111 'generated_R_dirs': ['<(R_dir)'], | |
| 112 'additional_R_files': ['<(R_file)'], | |
| 113 | |
| 114 # Dependent APKs include this target's resources via | |
| 115 # additional_res_dirs and additional_res_packages. | |
| 116 'additional_res_dirs': ['<(java_in_dir)/res'], | |
| 117 'additional_res_packages': ['<(R_package)'], | |
| 118 }, | |
| 119 }, | |
| 120 'actions': [ | |
| 121 # Generate R.java for the library. This R.java contains non-final | |
| 122 # constants and is used only while compiling the library jar (e.g. | |
| 123 # chromium_content.jar). When building an apk, a new R.java file with | |
| 124 # the correct resource -> ID mappings will be generated by merging the | |
| 125 # resources from all libraries and the main apk project. | |
| 126 { | |
| 127 'action_name': 'generate_r_java', | |
| 128 'message': 'generating R.java for <(package_name)', | |
| 129 'inputs': [ | |
| 130 '<(android_sdk_tools)/aapt', | |
| 131 '<(android_sdk)/android.jar', | |
| 132 '<(DEPTH)/build/android/AndroidManifest.xml', | |
| 133 '<!@(find <(java_in_dir)/res -type f)', | |
| 134 ], | |
| 135 'outputs': [ | |
| 136 '<(R_file)', | |
| 137 ], | |
| 138 'action': [ | |
| 139 '<(android_sdk_tools)/aapt', | |
| 140 'package', | |
| 141 '-m', | |
| 142 '--non-constant-id', | |
| 143 '--custom-package', '<(R_package)', | |
| 144 '-M', '<(DEPTH)/build/android/AndroidManifest.xml', | |
| 145 '-S', '<(java_in_dir)/res', | |
| 146 '-I', '<(android_sdk)/android.jar', | |
| 147 '-J', '<(R_dir)', | |
| 148 ], | |
| 149 }, | |
| 150 ], | |
| 151 }], | |
| 152 ], | |
| 90 } | 153 } |
| OLD | NEW |