diff options
author | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-16 00:11:03 +0000 |
---|---|---|
committer | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-16 00:11:03 +0000 |
commit | 26046b5fe46738a9c214a64862831e9417f27850 (patch) | |
tree | 54071de6ea72c3d5652eff37ff38f2c0483de5df /build/secondary/tools | |
parent | cbba05a61cec41f996321156e14d2a0ec306451e (diff) | |
download | chromium_src-26046b5fe46738a9c214a64862831e9417f27850.zip chromium_src-26046b5fe46738a9c214a64862831e9417f27850.tar.gz chromium_src-26046b5fe46738a9c214a64862831e9417f27850.tar.bz2 |
[Android][gn] Add android resources templates
This adds support for android resources to gn.
Two new templates are introduced:
java_string_grd: This is like gyp's build/java_strings_grd.gypi. It runs
grit and generates Android strings.xml files and then zips them
together.
android_resources: This is the target for android resources. It is
mostly a wrapper around process_resources.py. This is *not part* of
android_library (like it is in gyp). Making these two things separate is
more like facebook's BUCK and google's internal build rules (and gyp's
java.gypi and java_apk.gypi have gotten way too big and complicated).
Changes to the actual build scripts are very minor except for the added
support for andoid_resources to write_build_config.py. Building
resources requires getting all the transitive resource dependencies, and
so this reuses the simple sorted transitive dependency thing from
write_ordered_libraries.py.
TBR=rch@chromium.org
BUG=359249
Review URL: https://codereview.chromium.org/361633002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/secondary/tools')
-rw-r--r-- | build/secondary/tools/grit/grit_rule.gni | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/build/secondary/tools/grit/grit_rule.gni b/build/secondary/tools/grit/grit_rule.gni index 2f03335..86a155a 100644 --- a/build/secondary/tools/grit/grit_rule.gni +++ b/build/secondary/tools/grit/grit_rule.gni @@ -13,6 +13,14 @@ # grit_flags (optional) # List of strings containing extra command-line flags to pass to Grit. # +# resource_ids (optional) +# Path to a grit "firstidsfile". Default is +# //tools/gritsettings/resource_ids. Set to "" to use the value specified in +# the <grit> nodes of the processed files. +# +# output_dir (optional) +# Directory for generated files. +# # deps (optional) # visibility (optional) # Normal meaning. @@ -161,11 +169,24 @@ template("grit") { "Neither \"sources\" nor \"outputs\" can be defined for the grit " + "template $target_name") + if (defined(invoker.resource_ids)) { + resource_ids = invoker.resource_ids + } else { + resource_ids = grit_resource_id_file + } + + if (defined(invoker.output_dir)) { + output_dir = invoker.output_dir + } else { + output_dir = target_gen_dir + } + # These are all passed as arguments to the script so have to be relative to # the build directory. - resource_ids = - rebase_path(grit_resource_id_file, root_build_dir) - output_dir = rebase_path(target_gen_dir, root_build_dir) + if (resource_ids != "") { + resource_ids = rebase_path(resource_ids, root_build_dir) + } + rebased_output_dir = rebase_path(output_dir, root_build_dir) source_path = rebase_path(invoker.source, root_build_dir) if (defined(invoker.grit_flags)) { @@ -183,7 +204,7 @@ template("grit") { ] grit_outputs_build_rel = exec_script(grit_info_script, - [ "--outputs", "$output_dir", source_path, "-f", resource_ids ] + + [ "--outputs", "$rebased_output_dir", source_path, "-f", resource_ids ] + grit_flags, "list lines") @@ -199,13 +220,13 @@ template("grit") { # overwritten inside the innter classes so we need to compute it here. target_visibility = ":$target_name" - # The current grit setup makes an file in $target_gen_dir/grit/foo.h that + # The current grit setup makes an file in $output_dir/grit/foo.h that # the source code expects to include via "grit/foo.h". It would be nice to # change this to including absolute paths relative to the root gen directory # (like "mycomponent/foo.h"). This config sets up the include path. grit_config = target_name + "_grit_config" config(grit_config) { - include_dirs = [ target_gen_dir ] + include_dirs = [ output_dir ] visibility = target_visibility } @@ -218,7 +239,7 @@ template("grit") { args = [ "-i", source_path, "build", "-f", resource_ids, - "-o", output_dir, + "-o", rebased_output_dir, ] + grit_defines + grit_flags visibility = target_visibility |