| 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 29 matching lines...) Expand all Loading... |
| 40 # integer IDs) should be generated, e.g. org.chromium.content. | 40 # integer IDs) should be generated, e.g. org.chromium.content. |
| 41 # R_package_relpath - Same as R_package, but replace each '.' with '/'. | 41 # R_package_relpath - Same as R_package, but replace each '.' with '/'. |
| 42 # java_strings_grd - The name of the grd file from which to generate localized | 42 # java_strings_grd - The name of the grd file from which to generate localized |
| 43 # strings.xml files, if any. | 43 # strings.xml files, if any. |
| 44 | 44 |
| 45 { | 45 { |
| 46 'dependencies': [ | 46 'dependencies': [ |
| 47 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' | 47 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' |
| 48 ], | 48 ], |
| 49 'variables': { | 49 'variables': { |
| 50 'input_jars_paths': [], | 50 'android_jar': '<(android_sdk)/android.jar', |
| 51 'input_jars_paths': [ '<(android_jar)' ], |
| 51 'additional_src_dirs': [], | 52 'additional_src_dirs': [], |
| 52 'javac_includes': [], | 53 'javac_includes': [], |
| 53 'jar_name': '<(_target_name).jar', | 54 'jar_name': '<(_target_name).jar', |
| 54 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 55 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 56 'excluded_classes': [ '*/R.class', '*/R##*.class' ], |
| 55 'additional_input_paths': ['>@(additional_R_files)'], | 57 'additional_input_paths': ['>@(additional_R_files)'], |
| 56 'generated_src_dirs': ['>@(generated_R_dirs)'], | 58 'generated_src_dirs': ['>@(generated_R_dirs)'], |
| 57 'generated_R_dirs': [], | 59 'generated_R_dirs': [], |
| 58 'additional_R_files': [], | 60 'additional_R_files': [], |
| 59 'has_java_resources%': 0, | 61 'has_java_resources%': 0, |
| 60 'java_strings_grd%': '', | 62 'java_strings_grd%': '', |
| 63 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
| 64 'classes_dir': '<(intermediate_dir)/classes', |
| 65 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 61 }, | 66 }, |
| 62 # This all_dependent_settings is used for java targets only. This will add the | 67 # This all_dependent_settings is used for java targets only. This will add the |
| 63 # jar path to the classpath of dependent java targets. | 68 # jar path to the classpath of dependent java targets. |
| 64 'all_dependent_settings': { | 69 'all_dependent_settings': { |
| 65 'variables': { | 70 'variables': { |
| 66 'input_jars_paths': ['<(jar_path)'], | 71 'input_jars_paths': ['<(jar_path)'], |
| 67 }, | 72 }, |
| 68 }, | 73 }, |
| 69 'conditions': [ | 74 'conditions': [ |
| 70 ['has_java_resources == 1', { | 75 ['has_java_resources == 1', { |
| 71 'variables': { | 76 'variables': { |
| 72 'res_dir': '<(java_in_dir)/res', | 77 'res_dir': '<(java_in_dir)/res', |
| 73 'out_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/res', | 78 'out_res_dir': '<(intermediate_dir)/res', |
| 74 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/java_R', | 79 'R_dir': '<(intermediate_dir)/java_R', |
| 75 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | 80 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', |
| 76 'R_text_file': '<(R_dir)/R.txt', | 81 'R_text_file': '<(R_dir)/R.txt', |
| 77 'generated_src_dirs': ['<(R_dir)'], | 82 'generated_src_dirs': ['<(R_dir)'], |
| 78 'additional_input_paths': ['<(R_file)'], | 83 'additional_input_paths': ['<(R_file)'], |
| 79 # grit_grd_file is used by grit_action.gypi, included below. | 84 # grit_grd_file is used by grit_action.gypi, included below. |
| 80 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', | 85 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
| 81 }, | 86 }, |
| 82 'all_dependent_settings': { | 87 'all_dependent_settings': { |
| 83 'variables': { | 88 'variables': { |
| 84 # Dependent jars include this target's R.java file via | 89 # Dependent jars include this target's R.java file via |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 # (e.g. if a resource if removed), the command will be re-run. | 148 # (e.g. if a resource if removed), the command will be re-run. |
| 144 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 149 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 145 '--ignore', '>(_inputs)', | 150 '--ignore', '>(_inputs)', |
| 146 ], | 151 ], |
| 147 }, | 152 }, |
| 148 ], | 153 ], |
| 149 }], | 154 }], |
| 150 ], | 155 ], |
| 151 'actions': [ | 156 'actions': [ |
| 152 { | 157 { |
| 153 'action_name': 'ant_<(_target_name)', | 158 'action_name': 'javac_<(_target_name)', |
| 154 'message': 'Building <(_target_name) java sources.', | 159 'message': 'Compiling <(_target_name) java sources', |
| 160 'variables': { |
| 161 'all_src_dirs': [ |
| 162 '>@(java_in_dir)/src', |
| 163 '>@(additional_src_dirs)', |
| 164 '>@(generated_src_dirs)', |
| 165 ], |
| 166 }, |
| 155 'inputs': [ | 167 'inputs': [ |
| 156 'android/ant/common.xml', | 168 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 157 'android/ant/chromium-jars.xml', | 169 '<(DEPTH)/build/android/javac.py', |
| 158 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 170 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
| 159 '>@(input_jars_paths)', | 171 '>@(input_jars_paths)', |
| 160 '>@(additional_input_paths)', | 172 '>@(additional_input_paths)', |
| 161 ], | 173 ], |
| 162 'outputs': [ | 174 'outputs': [ |
| 175 '<(compile_stamp)', |
| 176 ], |
| 177 'action': [ |
| 178 'python', '<(DEPTH)/build/android/javac.py', |
| 179 '--output-dir=<(classes_dir)', |
| 180 '--classpath=>(input_jars_paths)', |
| 181 '--src-dirs=>(all_src_dirs)', |
| 182 '--javac-includes=<(javac_includes)', |
| 183 '--stamp=<(compile_stamp)', |
| 184 |
| 185 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
| 186 '--ignore=>!(echo >(_inputs) | md5sum)', |
| 187 ] |
| 188 }, |
| 189 { |
| 190 'action_name': 'jar_<(_target_name)', |
| 191 'message': 'Creating <(_target_name) jar', |
| 192 'inputs': [ |
| 193 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 194 '<(DEPTH)/build/android/jar.py', |
| 195 '<(compile_stamp)', |
| 196 ], |
| 197 'outputs': [ |
| 163 '<(jar_path)', | 198 '<(jar_path)', |
| 164 ], | 199 ], |
| 165 'action': [ | 200 'action': [ |
| 166 'ant', '-quiet', | 201 'python', '<(DEPTH)/build/android/jar.py', |
| 167 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', | 202 '--classes-dir=<(classes_dir)', |
| 168 '-DANDROID_SDK=<(android_sdk)', | 203 '--jar-path=<(jar_path)', |
| 169 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 204 '--excluded-classes=<(excluded_classes)', |
| 170 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', | |
| 171 '-DANDROID_SDK_VERSION=<(android_sdk_version)', | |
| 172 '-DANDROID_GDBSERVER=<(android_gdbserver)', | |
| 173 '-DPRODUCT_DIR=<(ant_build_out)', | |
| 174 | 205 |
| 175 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', | 206 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
| 176 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', | 207 '--ignore=>!(echo >(_inputs) | md5sum)', |
| 177 '-DINPUT_JARS_PATHS=>(input_jars_paths)', | |
| 178 '-DJAR_NAME=<(jar_name)', | |
| 179 '-DOUT_DIR=<(ant_build_out)/<(_target_name)', | |
| 180 '-DJAVAC_INCLUDES=>(javac_includes)', | |
| 181 | |
| 182 # Add list of inputs to the command line, so if inputs change | |
| 183 # (e.g. if a Java file is removed), the command will be re-run. | |
| 184 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | |
| 185 '-DTHIS_IS_IGNORED=>(_inputs)', | |
| 186 | |
| 187 '-Dbasedir=<(java_in_dir)', | |
| 188 '-buildfile', | |
| 189 '<(DEPTH)/build/android/ant/chromium-jars.xml' | |
| 190 ] | 208 ] |
| 191 }, | 209 }, |
| 192 ], | 210 ], |
| 193 } | 211 } |
| OLD | NEW |