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 26 matching lines...) Expand all Loading... |
37 # javac_includes - A list of specific files to include. This is by default | 37 # javac_includes - A list of specific files to include. This is by default |
38 # empty, which leads to inclusion of all files specified. May include | 38 # empty, which leads to inclusion of all files specified. May include |
39 # wildcard, and supports '**/' for recursive path wildcards, ie.: | 39 # wildcard, and supports '**/' for recursive path wildcards, ie.: |
40 # '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'. | 40 # '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'. |
41 # has_java_resources - Set to 1 if the java target contains an | 41 # has_java_resources - Set to 1 if the java target contains an |
42 # Android-compatible resources folder named res. If 1, R_package and | 42 # Android-compatible resources folder named res. If 1, R_package and |
43 # R_package_relpath must also be set. | 43 # R_package_relpath must also be set. |
44 # R_package - The java package in which the R class (which maps resources to | 44 # R_package - The java package in which the R class (which maps resources to |
45 # integer IDs) should be generated, e.g. org.chromium.content. | 45 # integer IDs) should be generated, e.g. org.chromium.content. |
46 # R_package_relpath - Same as R_package, but replace each '.' with '/'. | 46 # R_package_relpath - Same as R_package, but replace each '.' with '/'. |
| 47 # java_strings_grd - The name of the grd file from which to generate localized |
| 48 # strings.xml files, if any. |
47 | 49 |
48 { | 50 { |
49 'dependencies': [ | 51 'dependencies': [ |
50 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' | 52 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' |
51 ], | 53 ], |
52 # This all_dependent_settings is used for java targets only. This will add the | 54 # This all_dependent_settings is used for java targets only. This will add the |
53 # chromium_<(package_name) jar to the classpath of dependent java targets. | 55 # chromium_<(package_name) jar to the classpath of dependent java targets. |
54 'all_dependent_settings': { | 56 'all_dependent_settings': { |
55 'variables': { | 57 'variables': { |
56 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
'], | 58 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
'], |
57 }, | 59 }, |
58 }, | 60 }, |
59 'variables': { | 61 'variables': { |
60 'input_jars_paths': [], | 62 'input_jars_paths': [], |
61 'additional_src_dirs': [], | 63 'additional_src_dirs': [], |
62 'javac_includes': [], | 64 'javac_includes': [], |
63 'additional_input_paths': ['>@(additional_R_files)'], | 65 'additional_input_paths': ['>@(additional_R_files)'], |
64 'generated_src_dirs': ['>@(generated_R_dirs)'], | 66 'generated_src_dirs': ['>@(generated_R_dirs)'], |
65 'generated_R_dirs': [], | 67 'generated_R_dirs': [], |
66 'additional_R_files': [], | 68 'additional_R_files': [], |
67 'has_java_resources%': 0, | 69 'has_java_resources%': 0, |
| 70 'java_strings_grd%': '', |
68 }, | 71 }, |
69 'conditions': [ | 72 'conditions': [ |
70 ['has_java_resources == 1', { | 73 ['has_java_resources == 1', { |
71 'variables': { | 74 'variables': { |
72 'res_dir': '<(java_in_dir)/res', | 75 'res_dir': '<(java_in_dir)/res', |
73 'crunched_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', | 76 'out_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', |
74 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', | 77 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', |
75 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | 78 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', |
76 'generated_src_dirs': ['<(R_dir)'], | 79 'generated_src_dirs': ['<(R_dir)'], |
77 'additional_input_paths': ['<(R_file)'], | 80 'additional_input_paths': ['<(R_file)'], |
| 81 # grit_grd_file is used by grit_action.gypi, included below. |
| 82 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
78 }, | 83 }, |
79 'all_dependent_settings': { | 84 'all_dependent_settings': { |
80 'variables': { | 85 'variables': { |
81 # Dependent jars include this target's R.java file via | 86 # Dependent jars include this target's R.java file via |
82 # generated_R_dirs and additional_R_files. | 87 # generated_R_dirs and additional_R_files. |
83 'generated_R_dirs': ['<(R_dir)'], | 88 'generated_R_dirs': ['<(R_dir)'], |
84 'additional_R_files': ['<(R_file)'], | 89 'additional_R_files': ['<(R_file)'], |
85 | 90 |
86 # Dependent APKs include this target's resources via | 91 # Dependent APKs include this target's resources via |
87 # additional_res_dirs and additional_res_packages. | 92 # additional_res_dirs and additional_res_packages. |
88 'additional_res_dirs': ['<(crunched_res_dir)', '<(res_dir)'], | 93 'additional_res_dirs': ['<(out_res_dir)', '<(res_dir)'], |
89 'additional_res_packages': ['<(R_package)'], | 94 'additional_res_packages': ['<(R_package)'], |
90 }, | 95 }, |
91 }, | 96 }, |
| 97 'conditions': [ |
| 98 ['java_strings_grd != ""', { |
| 99 'actions': [ |
| 100 { |
| 101 'action_name': 'generate_localized_strings_xml', |
| 102 'variables': { |
| 103 'grit_out_dir': '<(out_res_dir)', |
| 104 # resource_ids is unneeded since we don't generate .h headers. |
| 105 'grit_resource_ids': '', |
| 106 }, |
| 107 'includes': ['../build/grit_action.gypi'], |
| 108 }, |
| 109 ], |
| 110 }], |
| 111 ], |
92 'actions': [ | 112 'actions': [ |
93 # Generate R.java and crunch image resources. | 113 # Generate R.java and crunch image resources. |
94 { | 114 { |
95 'action_name': 'process_resources', | 115 'action_name': 'process_resources', |
96 'message': 'processing resources for <(package_name)', | 116 'message': 'processing resources for <(package_name)', |
| 117 'conditions': [ |
| 118 ['java_strings_grd != ""', { |
| 119 'inputs': [ |
| 120 # TODO(newt): replace this with .../values/strings.xml once |
| 121 # the English strings.xml is generated as well? That would be |
| 122 # simpler and faster and should be equivalent. |
| 123 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(out_re
s_dir)" <(grit_grd_file))', |
| 124 ], |
| 125 }], |
| 126 ], |
97 'inputs': [ | 127 'inputs': [ |
98 '<(DEPTH)/build/android/process_resources.py', | 128 '<(DEPTH)/build/android/process_resources.py', |
99 '<!@(find <(res_dir) -type f)', | 129 '<!@(find <(res_dir) -type f)', |
100 ], | 130 ], |
101 'outputs': [ | 131 'outputs': [ |
102 '<(R_file)', | 132 '<(R_file)', |
103 ], | 133 ], |
104 'action': [ | 134 'action': [ |
105 '<(DEPTH)/build/android/process_resources.py', | 135 '<(DEPTH)/build/android/process_resources.py', |
106 '--android-sdk', '<(android_sdk)', | 136 '--android-sdk', '<(android_sdk)', |
107 '--android-sdk-tools', '<(android_sdk_tools)', | 137 '--android-sdk-tools', '<(android_sdk_tools)', |
108 '--R-package', '<(R_package)', | 138 '--R-package', '<(R_package)', |
109 '--R-dir', '<(R_dir)', | 139 '--R-dir', '<(R_dir)', |
110 '--res-dir', '<(res_dir)', | 140 '--res-dir', '<(res_dir)', |
111 '--crunched-res-dir', '<(crunched_res_dir)', | 141 '--crunched-res-dir', '<(out_res_dir)', |
112 ], | 142 ], |
113 }, | 143 }, |
114 ], | 144 ], |
115 }], | 145 }], |
116 ], | 146 ], |
117 'actions': [ | 147 'actions': [ |
118 { | 148 { |
119 'action_name': 'ant_<(package_name)', | 149 'action_name': 'ant_<(package_name)', |
120 'message': 'Building <(package_name) java sources.', | 150 'message': 'Building <(package_name) java sources.', |
121 'inputs': [ | 151 'inputs': [ |
(...skipping 22 matching lines...) Expand all Loading... |
144 '-DPACKAGE_NAME=<(package_name)', | 174 '-DPACKAGE_NAME=<(package_name)', |
145 '-DJAVAC_INCLUDES=>(javac_includes)', | 175 '-DJAVAC_INCLUDES=>(javac_includes)', |
146 | 176 |
147 '-Dbasedir=<(java_in_dir)', | 177 '-Dbasedir=<(java_in_dir)', |
148 '-buildfile', | 178 '-buildfile', |
149 '<(DEPTH)/build/android/ant/chromium-jars.xml' | 179 '<(DEPTH)/build/android/ant/chromium-jars.xml' |
150 ] | 180 ] |
151 }, | 181 }, |
152 ], | 182 ], |
153 } | 183 } |
OLD | NEW |