Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: build/config/android/rules.gni

Issue 484603004: New C++ -> Java enum build rule + parser/generator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/java_cpp_enum.gypi ('k') | build/gyp_chromium » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/android/internal_rules.gni") 6 import("//build/config/android/internal_rules.gni")
7 import("//tools/grit/grit_rule.gni") 7 import("//tools/grit/grit_rule.gni")
8 8
9 assert(is_android) 9 assert(is_android)
10 10
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 base_dir = base_gen_dir 254 base_dir = base_gen_dir
255 } 255 }
256 256
257 group(target_name) { 257 group(target_name) {
258 deps = [ 258 deps = [
259 ":${target_name}__zip_srcjar" 259 ":${target_name}__zip_srcjar"
260 ] 260 ]
261 } 261 }
262 } 262 }
263 263
264 # Declare a target for generating Java classes from C++ enums.
265 #
266 # This target generates Java files from C++ enums using a script.
267 #
268 # This target will create a single .srcjar. Adding this target to an
269 # android_library target's srcjar_deps will make the generated java files be
270 # included in that library's final outputs.
271 #
272 # Variables
273 # sources: list of files to be processed by the script. For each annotated
274 # enum contained in the sources files the script will generate a .java
275 # file with the same name as the name of the enum.
276 #
277 # outputs: list of outputs, relative to the output_dir. These paths are
278 # verified at build time by the script. To get the list programatically run:
279 # python build/android/gyp/java_cpp_enum.py --output_dir=. \
280 # --print_output_only path/to/header/file.h
281 #
282 # Example
283 # java_cpp_enum("foo_generated_enum") {
284 # sources = [
285 # "src/native_foo_header.h",
286 # ]
287 # outputs = [
288 # "org/chromium/FooEnum.java",
289 # ]
290 # }
291 template("java_cpp_enum") {
292 assert(defined(invoker.sources))
293 assert(defined(invoker.outputs))
294
295 action("${target_name}__generate_enum") {
296 sources = rebase_path(invoker.sources, root_build_dir)
297 script = "//build/android/gyp/java_cpp_enum.py"
298 gen_dir = "${target_gen_dir}/${target_name}/enums"
299 outputs = get_path_info(
300 rebase_path(invoker.outputs, ".", gen_dir), "abspath")
301
302 args = [
303 "--output_dir", rebase_path(gen_dir, root_build_dir),
304 ]
305 foreach(output, rebase_path(outputs, root_build_dir)) {
306 args += ["--assert_file", output]
307 }
308 args += sources
309 }
310
311 generate_enum_outputs = get_target_outputs(":${target_name}__generate_enum")
312 base_gen_dir = get_label_info(":${target_name}__generate_enum",
313 "target_gen_dir")
314
315 srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
316 zip("${target_name}__zip_srcjar") {
317 inputs = generate_enum_outputs
318 output = srcjar_path
319 base_dir = base_gen_dir
320 }
321
322 group(target_name) {
323 deps = [
324 ":${target_name}__zip_srcjar"
325 ]
326 }
327 }
328
264 329
265 # Declare an Android resources target 330 # Declare an Android resources target
266 # 331 #
267 # This creates a resources zip file that will be used when building an Android 332 # This creates a resources zip file that will be used when building an Android
268 # library or apk and included into a final apk. 333 # library or apk and included into a final apk.
269 # 334 #
270 # To include these resources in a library/apk, this target should be listed in 335 # To include these resources in a library/apk, this target should be listed in
271 # the library's deps. A library/apk will also include any resources used by its 336 # the library's deps. A library/apk will also include any resources used by its
272 # own dependencies. 337 # own dependencies.
273 # 338 #
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 "//build/android/gyp/find.py", 953 "//build/android/gyp/find.py",
889 rebase_path([invoker.import_include], root_build_dir), 954 rebase_path([invoker.import_include], root_build_dir),
890 "list lines" 955 "list lines"
891 ) 956 )
892 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) 957 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir)
893 inputs += _java_files 958 inputs += _java_files
894 } 959 }
895 args += rebase_path(sources, root_build_dir) 960 args += rebase_path(sources, root_build_dir)
896 } 961 }
897 } 962 }
OLDNEW
« no previous file with comments | « build/android/java_cpp_enum.gypi ('k') | build/gyp_chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698