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. | |
49 | 47 |
50 { | 48 { |
51 'dependencies': [ | 49 'dependencies': [ |
52 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' | 50 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' |
53 ], | 51 ], |
54 # This all_dependent_settings is used for java targets only. This will add the | 52 # This all_dependent_settings is used for java targets only. This will add the |
55 # chromium_<(package_name) jar to the classpath of dependent java targets. | 53 # chromium_<(package_name) jar to the classpath of dependent java targets. |
56 'all_dependent_settings': { | 54 'all_dependent_settings': { |
57 'variables': { | 55 'variables': { |
58 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
'], | 56 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
'], |
59 }, | 57 }, |
60 }, | 58 }, |
61 'variables': { | 59 'variables': { |
62 'input_jars_paths': [], | 60 'input_jars_paths': [], |
63 'additional_src_dirs': [], | 61 'additional_src_dirs': [], |
64 'javac_includes': [], | 62 'javac_includes': [], |
65 'additional_input_paths': ['>@(additional_R_files)'], | 63 'additional_input_paths': ['>@(additional_R_files)'], |
66 'generated_src_dirs': ['>@(generated_R_dirs)'], | 64 'generated_src_dirs': ['>@(generated_R_dirs)'], |
67 'generated_R_dirs': [], | 65 'generated_R_dirs': [], |
68 'additional_R_files': [], | 66 'additional_R_files': [], |
69 'has_java_resources%': 0, | 67 'has_java_resources%': 0, |
70 'java_strings_grd%': '', | |
71 }, | 68 }, |
72 'conditions': [ | 69 'conditions': [ |
73 ['has_java_resources == 1', { | 70 ['has_java_resources == 1', { |
74 'variables': { | 71 'variables': { |
75 'res_dir': '<(java_in_dir)/res', | 72 'res_dir': '<(java_in_dir)/res', |
76 'out_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', | 73 'crunched_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', |
77 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', | 74 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', |
78 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | 75 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', |
79 'generated_src_dirs': ['<(R_dir)'], | 76 'generated_src_dirs': ['<(R_dir)'], |
80 'additional_input_paths': ['<(R_file)'], | 77 '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)', | |
83 }, | 78 }, |
84 'all_dependent_settings': { | 79 'all_dependent_settings': { |
85 'variables': { | 80 'variables': { |
86 # Dependent jars include this target's R.java file via | 81 # Dependent jars include this target's R.java file via |
87 # generated_R_dirs and additional_R_files. | 82 # generated_R_dirs and additional_R_files. |
88 'generated_R_dirs': ['<(R_dir)'], | 83 'generated_R_dirs': ['<(R_dir)'], |
89 'additional_R_files': ['<(R_file)'], | 84 'additional_R_files': ['<(R_file)'], |
90 | 85 |
91 # Dependent APKs include this target's resources via | 86 # Dependent APKs include this target's resources via |
92 # additional_res_dirs and additional_res_packages. | 87 # additional_res_dirs and additional_res_packages. |
93 'additional_res_dirs': ['<(out_res_dir)', '<(res_dir)'], | 88 'additional_res_dirs': ['<(crunched_res_dir)', '<(res_dir)'], |
94 'additional_res_packages': ['<(R_package)'], | 89 'additional_res_packages': ['<(R_package)'], |
95 }, | 90 }, |
96 }, | 91 }, |
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 ], | |
112 'actions': [ | 92 'actions': [ |
113 # Generate R.java and crunch image resources. | 93 # Generate R.java and crunch image resources. |
114 { | 94 { |
115 'action_name': 'process_resources', | 95 'action_name': 'process_resources', |
116 'message': 'processing resources for <(package_name)', | 96 '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 ], | |
127 'inputs': [ | 97 'inputs': [ |
128 '<(DEPTH)/build/android/process_resources.py', | 98 '<(DEPTH)/build/android/process_resources.py', |
129 '<!@(find <(res_dir) -type f)', | 99 '<!@(find <(res_dir) -type f)', |
130 ], | 100 ], |
131 'outputs': [ | 101 'outputs': [ |
132 '<(R_file)', | 102 '<(R_file)', |
133 ], | 103 ], |
134 'action': [ | 104 'action': [ |
135 '<(DEPTH)/build/android/process_resources.py', | 105 '<(DEPTH)/build/android/process_resources.py', |
136 '--android-sdk', '<(android_sdk)', | 106 '--android-sdk', '<(android_sdk)', |
137 '--android-sdk-tools', '<(android_sdk_tools)', | 107 '--android-sdk-tools', '<(android_sdk_tools)', |
138 '--R-package', '<(R_package)', | 108 '--R-package', '<(R_package)', |
139 '--R-dir', '<(R_dir)', | 109 '--R-dir', '<(R_dir)', |
140 '--res-dir', '<(res_dir)', | 110 '--res-dir', '<(res_dir)', |
141 '--crunched-res-dir', '<(out_res_dir)', | 111 '--crunched-res-dir', '<(crunched_res_dir)', |
142 ], | 112 ], |
143 }, | 113 }, |
144 ], | 114 ], |
145 }], | 115 }], |
146 ], | 116 ], |
147 'actions': [ | 117 'actions': [ |
148 { | 118 { |
149 'action_name': 'ant_<(package_name)', | 119 'action_name': 'ant_<(package_name)', |
150 'message': 'Building <(package_name) java sources.', | 120 'message': 'Building <(package_name) java sources.', |
151 'inputs': [ | 121 'inputs': [ |
(...skipping 22 matching lines...) Expand all Loading... |
174 '-DPACKAGE_NAME=<(package_name)', | 144 '-DPACKAGE_NAME=<(package_name)', |
175 '-DJAVAC_INCLUDES=>(javac_includes)', | 145 '-DJAVAC_INCLUDES=>(javac_includes)', |
176 | 146 |
177 '-Dbasedir=<(java_in_dir)', | 147 '-Dbasedir=<(java_in_dir)', |
178 '-buildfile', | 148 '-buildfile', |
179 '<(DEPTH)/build/android/ant/chromium-jars.xml' | 149 '<(DEPTH)/build/android/ant/chromium-jars.xml' |
180 ] | 150 ] |
181 }, | 151 }, |
182 ], | 152 ], |
183 } | 153 } |
OLD | NEW |