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

Unified 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: minor change 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/java_cpp_string.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 49ccc1d2991cb7c9fc751e983fa25c9a25d9c030..54206ffbf0c3270423ef6cada7536ef1315c4f45 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -367,6 +367,58 @@ template("java_cpp_enum") {
}
}
+# Declare a target for generating Java classes from C++ strings.
+#
+# This target generates Java files from C++ strings using a script.
+#
+# This target will create a single .srcjar. Adding this target to an
+# android_library target's srcjar_deps will make the generated java files be
+# included in that library's final outputs.
+#
+# Variables
+# sources: list of files to be processed by the script. For each source
+# file the script will generate a .java file including all the strings
+# in the source file with the name indicated in the derectives.
+#
+# Example
+# java_cpp_string("foo_generated_string") {
+# sources = [
+# "src/native_foo.cc",
+# ]
+# }
+template("java_cpp_string") {
+ action(target_name) {
+ # The sources aren't compiled so don't check their dependencies.
+ check_includes = false
+ set_sources_assignment_filter([])
+
+ assert(defined(invoker.sources))
+ forward_variables_from(invoker,
+ [
+ "sources",
+ "testonly",
+ "visibility",
+ ])
+
+ script = "//build/android/gyp/java_cpp_string.py"
+ depfile = "$target_gen_dir/$target_name.d"
+
+ _srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
+ _rebased_srcjar_path = rebase_path(_srcjar_path, root_build_dir)
+ _rebased_sources = rebase_path(invoker.sources, root_build_dir)
+
+ args = [
+ "--depfile",
+ rebase_path(depfile, root_build_dir),
+ "--srcjar=$_rebased_srcjar_path",
+ ] + _rebased_sources
+ outputs = [
+ depfile,
+ _srcjar_path,
+ ]
+ }
+}
+
# Declare a target for processing a Jinja template.
#
# Variables
« no previous file with comments | « build/android/java_cpp_string.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698