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

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

Issue 1664113002: C++->Java string constants auto-generator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contentsettingstype_enum_2_string
Patch Set: add tests Created 4 years, 10 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
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("//base/android/linker/config.gni") 5 import("//base/android/linker/config.gni")
6 import("//build/config/android/config.gni") 6 import("//build/config/android/config.gni")
7 import("//build/config/android/internal_rules.gni") 7 import("//build/config/android/internal_rules.gni")
8 import("//build/config/sanitizers/sanitizers.gni") 8 import("//build/config/sanitizers/sanitizers.gni")
9 import("//build/toolchain/toolchain.gni") 9 import("//build/toolchain/toolchain.gni")
10 import("//third_party/android_platform/config.gni") 10 import("//third_party/android_platform/config.gni")
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 rebase_path(depfile, root_build_dir), 360 rebase_path(depfile, root_build_dir),
361 "--srcjar=$_rebased_srcjar_path", 361 "--srcjar=$_rebased_srcjar_path",
362 ] + _rebased_sources 362 ] + _rebased_sources
363 outputs = [ 363 outputs = [
364 depfile, 364 depfile,
365 _srcjar_path, 365 _srcjar_path,
366 ] 366 ]
367 } 367 }
368 } 368 }
369 369
370 # Declare a target for generating Java classes from C++ strings.
371 #
372 # This target generates Java files from C++ strings using a script.
373 #
374 # This target will create a single .srcjar. Adding this target to an
375 # android_library target's srcjar_deps will make the generated java files be
376 # included in that library's final outputs.
377 #
378 # Variables
379 # sources: list of files to be processed by the script. For each source
380 # file the script will generate a .java file including all the strings
381 # in the source file with the name indicated in the derectives.
382 #
383 # Example
384 # java_cpp_string("foo_generated_string") {
385 # sources = [
386 # "src/native_foo.cc",
387 # ]
388 # }
389 template("java_cpp_string") {
390 action(target_name) {
391 # The sources aren't compiled so don't check their dependencies.
392 check_includes = false
393 set_sources_assignment_filter([])
394
395 assert(defined(invoker.sources))
396 forward_variables_from(invoker,
397 [
398 "sources",
399 "testonly",
400 "visibility",
401 ])
402
403 script = "//build/android/gyp/java_cpp_string.py"
404 depfile = "$target_gen_dir/$target_name.d"
405
406 _srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
407 _rebased_srcjar_path = rebase_path(_srcjar_path, root_build_dir)
408 _rebased_sources = rebase_path(invoker.sources, root_build_dir)
409
410 args = [
411 "--depfile",
412 rebase_path(depfile, root_build_dir),
413 "--srcjar=$_rebased_srcjar_path",
414 ] + _rebased_sources
415 outputs = [
416 depfile,
417 _srcjar_path,
418 ]
419 }
420 }
421
370 # Declare a target for processing a Jinja template. 422 # Declare a target for processing a Jinja template.
371 # 423 #
372 # Variables 424 # Variables
373 # input: The template file to be processed. 425 # input: The template file to be processed.
374 # output: Where to save the result. 426 # output: Where to save the result.
375 # variables: (Optional) A list of variables to make available to the template 427 # variables: (Optional) A list of variables to make available to the template
376 # processing environment, e.g. ["name=foo", "color=red"]. 428 # processing environment, e.g. ["name=foo", "color=red"].
377 # 429 #
378 # Example 430 # Example
379 # jinja_template("chrome_public_manifest") { 431 # jinja_template("chrome_public_manifest") {
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 } 2335 }
2284 2336
2285 android_library(target_name) { 2337 android_library(target_name) {
2286 java_files = [] 2338 java_files = []
2287 srcjar_deps = [ ":${_template_name}__protoc_java" ] 2339 srcjar_deps = [ ":${_template_name}__protoc_java" ]
2288 deps = [ 2340 deps = [
2289 "//third_party/android_protobuf:protobuf_nano_javalib", 2341 "//third_party/android_protobuf:protobuf_nano_javalib",
2290 ] 2342 ]
2291 } 2343 }
2292 } 2344 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698