| 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': [ '<(android_sdk_jar)' ], | 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)', |
| 55 'excluded_classes': [ '*/R.class', '*/R##*.class' ], | 56 'excluded_classes': [ '*/R.class', '*/R##*.class' ], |
| 56 'additional_input_paths': ['>@(additional_R_files)'], | 57 'additional_input_paths': [], |
| 57 'generated_src_dirs': ['>@(generated_R_dirs)'], | 58 'generated_src_dirs': ['>@(generated_R_dirs)'], |
| 58 'generated_R_dirs': [], | 59 'generated_R_dirs': [], |
| 59 'additional_R_files': [], | |
| 60 'has_java_resources%': 0, | 60 'has_java_resources%': 0, |
| 61 'java_strings_grd%': '', | 61 'java_strings_grd%': '', |
| 62 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', | 62 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
| 63 'classes_dir': '<(intermediate_dir)/classes', | 63 'classes_dir': '<(intermediate_dir)/classes', |
| 64 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 64 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 65 }, | 65 }, |
| 66 # This all_dependent_settings is used for java targets only. This will add the | 66 # This all_dependent_settings is used for java targets only. This will add the |
| 67 # jar path to the classpath of dependent java targets. | 67 # jar path to the classpath of dependent java targets. |
| 68 'all_dependent_settings': { | 68 'all_dependent_settings': { |
| 69 'variables': { | 69 'variables': { |
| 70 'input_jars_paths': ['<(jar_path)'], | 70 'input_jars_paths': ['<(jar_path)'], |
| 71 }, | 71 }, |
| 72 }, | 72 }, |
| 73 'conditions': [ | 73 'conditions': [ |
| 74 ['has_java_resources == 1', { | 74 ['has_java_resources == 1', { |
| 75 'variables': { | 75 'variables': { |
| 76 'res_dir': '<(java_in_dir)/res', | 76 'res_dir': '<(java_in_dir)/res', |
| 77 'out_res_dir': '<(intermediate_dir)/res', | 77 'out_res_dir': '<(intermediate_dir)/res', |
| 78 'R_dir': '<(intermediate_dir)/java_R', | 78 'R_dir': '<(intermediate_dir)/java_R', |
| 79 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | |
| 80 'R_text_file': '<(R_dir)/R.txt', | 79 'R_text_file': '<(R_dir)/R.txt', |
| 80 'R_stamp': '<(intermediate_dir)/resources.stamp', |
| 81 'generated_src_dirs': ['<(R_dir)'], | 81 'generated_src_dirs': ['<(R_dir)'], |
| 82 'additional_input_paths': ['<(R_file)'], | 82 'additional_input_paths': ['<(R_stamp)'], |
| 83 # grit_grd_file is used by grit_action.gypi, included below. | 83 # grit_grd_file is used by grit_action.gypi, included below. |
| 84 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', | 84 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
| 85 'resource_input_paths': [], |
| 85 }, | 86 }, |
| 86 'all_dependent_settings': { | 87 'all_dependent_settings': { |
| 87 'variables': { | 88 'variables': { |
| 88 # Dependent jars include this target's R.java file via | 89 # Dependent jars include this target's R.java file via |
| 89 # generated_R_dirs and additional_R_files. | 90 # generated_R_dirs and additional_R_files. |
| 90 'generated_R_dirs': ['<(R_dir)'], | 91 'generated_R_dirs': ['<(R_dir)'], |
| 91 'additional_R_files': ['<(R_file)'], | 92 'additional_input_paths': ['<(R_stamp)'], |
| 92 'additional_R_text_files': ['<(R_text_file)'], | 93 'additional_R_text_files': ['<(R_text_file)'], |
| 93 | 94 |
| 94 # Dependent APKs include this target's resources via | 95 # Dependent APKs include this target's resources via |
| 95 # additional_res_dirs and additional_res_packages. | 96 # additional_res_dirs and additional_res_packages. |
| 96 'additional_res_dirs': ['<(out_res_dir)', '<(res_dir)'], | 97 'additional_res_dirs': ['<(out_res_dir)', '<(res_dir)'], |
| 97 'additional_res_packages': ['<(R_package)'], | 98 'additional_res_packages': ['<(R_package)'], |
| 98 }, | 99 }, |
| 99 }, | 100 }, |
| 100 'conditions': [ | 101 'conditions': [ |
| 101 ['java_strings_grd != ""', { | 102 ['java_strings_grd != ""', { |
| 103 'variables': { |
| 104 'resource_input_paths': [ |
| 105 # TODO(newt): replace this with .../values/strings.xml once |
| 106 # the English strings.xml is generated as well? That would be |
| 107 # simpler and faster and should be equivalent. |
| 108 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(out_res_
dir)" <(grit_grd_file))', |
| 109 ], |
| 110 }, |
| 102 'actions': [ | 111 'actions': [ |
| 103 { | 112 { |
| 104 'action_name': 'generate_localized_strings_xml', | 113 'action_name': 'generate_localized_strings_xml', |
| 105 'variables': { | 114 'variables': { |
| 106 'grit_out_dir': '<(out_res_dir)', | 115 'grit_out_dir': '<(out_res_dir)', |
| 107 # resource_ids is unneeded since we don't generate .h headers. | 116 # resource_ids is unneeded since we don't generate .h headers. |
| 108 'grit_resource_ids': '', | 117 'grit_resource_ids': '', |
| 109 }, | 118 }, |
| 110 'includes': ['../build/grit_action.gypi'], | 119 'includes': ['../build/grit_action.gypi'], |
| 111 }, | 120 }, |
| 112 ], | 121 ], |
| 113 }], | 122 }], |
| 114 ], | 123 ], |
| 115 'actions': [ | 124 'actions': [ |
| 116 # Generate R.java and crunch image resources. | 125 # Generate R.java and crunch image resources. |
| 117 { | 126 { |
| 118 'action_name': 'process_resources', | 127 'action_name': 'process_resources', |
| 119 'message': 'processing resources for <(_target_name)', | 128 'message': 'processing resources for <(_target_name)', |
| 120 'conditions': [ | 129 'variables': { |
| 121 ['java_strings_grd != ""', { | 130 'android_manifest': '<(DEPTH)/build/android/AndroidManifest.xml', |
| 122 'inputs': [ | 131 }, |
| 123 # TODO(newt): replace this with .../values/strings.xml once | |
| 124 # the English strings.xml is generated as well? That would be | |
| 125 # simpler and faster and should be equivalent. | |
| 126 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(out_re
s_dir)" <(grit_grd_file))', | |
| 127 ], | |
| 128 }], | |
| 129 ], | |
| 130 'inputs': [ | 132 'inputs': [ |
| 133 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 131 '<(DEPTH)/build/android/process_resources.py', | 134 '<(DEPTH)/build/android/process_resources.py', |
| 132 '<!@(find <(res_dir) -type f)', | 135 '<!@(find <(res_dir) -type f)', |
| 136 '<@(resource_input_paths)', |
| 133 ], | 137 ], |
| 134 'outputs': [ | 138 'outputs': [ |
| 135 '<(R_file)', | 139 '<(R_stamp)', |
| 136 ], | 140 ], |
| 137 'action': [ | 141 'action': [ |
| 138 '<(DEPTH)/build/android/process_resources.py', | 142 '<(DEPTH)/build/android/process_resources.py', |
| 139 '--android-sdk', '<(android_sdk)', | 143 '--android-sdk', '<(android_sdk)', |
| 140 '--android-sdk-tools', '<(android_sdk_tools)', | 144 '--android-sdk-tools', '<(android_sdk_tools)', |
| 141 '--R-package', '<(R_package)', | |
| 142 '--R-dir', '<(R_dir)', | 145 '--R-dir', '<(R_dir)', |
| 143 '--res-dir', '<(res_dir)', | 146 '--res-dir', '<(res_dir)', |
| 144 '--out-res-dir', '<(out_res_dir)', | 147 '--out-res-dir', '<(out_res_dir)', |
| 148 '--android-manifest', '<(android_manifest)', |
| 149 '--non-constant-id', |
| 150 '--custom-package', '<(R_package)', |
| 151 '--stamp', '<(R_stamp)', |
| 145 | 152 |
| 146 # Add list of inputs to the command line, so if inputs change | 153 # Add list of inputs to the command line, so if inputs change |
| 147 # (e.g. if a resource if removed), the command will be re-run. | 154 # (e.g. if a resource if removed), the command will be re-run. |
| 148 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 155 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 149 '--ignore', '>(_inputs)', | 156 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
| 150 ], | 157 ], |
| 151 }, | 158 }, |
| 152 ], | 159 ], |
| 153 }], | 160 }], |
| 154 ], | 161 ], |
| 155 'actions': [ | 162 'actions': [ |
| 156 { | 163 { |
| 157 'action_name': 'javac_<(_target_name)', | 164 'action_name': 'javac_<(_target_name)', |
| 158 'message': 'Compiling <(_target_name) java sources', | 165 'message': 'Compiling <(_target_name) java sources', |
| 159 'variables': { | 166 'variables': { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 '--classes-dir=<(classes_dir)', | 208 '--classes-dir=<(classes_dir)', |
| 202 '--jar-path=<(jar_path)', | 209 '--jar-path=<(jar_path)', |
| 203 '--excluded-classes=<(excluded_classes)', | 210 '--excluded-classes=<(excluded_classes)', |
| 204 | 211 |
| 205 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 212 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
| 206 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 213 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
| 207 ] | 214 ] |
| 208 }, | 215 }, |
| 209 ], | 216 ], |
| 210 } | 217 } |
| OLD | NEW |