Chromium Code Reviews| Index: components/policy/BUILD.gn |
| diff --git a/components/policy/BUILD.gn b/components/policy/BUILD.gn |
| index 24b424f577ea87f01a522828092a2a0da8341e79..1a94c70632ed3646ad76e41997c791b0bf424ff1 100644 |
| --- a/components/policy/BUILD.gn |
| +++ b/components/policy/BUILD.gn |
| @@ -3,6 +3,7 @@ |
| # found in the LICENSE file. |
| import("//build/config/features.gni") |
| +import("resources/policy_templates.gni") |
| import("//third_party/protobuf/proto_library.gni") |
| import("//tools/grit/grit_rule.gni") |
| @@ -106,7 +107,6 @@ if (enable_configuration_policy) { |
| } |
| grit("policy_templates") { |
| - import("resources/policy_templates.gni") |
| source = "resources/policy_templates.grd" |
| use_qualified_include = true |
| depend_on_stamp = true |
| @@ -236,5 +236,53 @@ if (enable_configuration_policy) { |
| "//testing/gtest", |
| ] |
| } |
| + |
| + if (is_android) { |
| + import("//build/config/android/rules.gni") |
| + group("app_restrictions_resources") { |
| + resources_zip = "res.java/$target_name.zip" |
|
pneubeck (no reviews)
2015/03/27 09:09:24
do we really have a directory with a dot in its na
knn
2015/03/27 11:46:49
yes
|
| + input_resources_dir = "$root_gen_dir/chrome/app/policy/android" |
|
pneubeck (no reviews)
2015/03/27 09:09:24
can you maybe rename 'input_resources_dir' to some
knn
2015/03/27 11:46:49
Done.
|
| + input_resources = [ "$input_resources_dir/xml-v21/app_restrictions.xml" ] |
|
pneubeck (no reviews)
2015/03/27 09:09:24
input_resources should be moved to the zip action
knn
2015/03/27 11:46:49
Sorry this is actually used below. My bad.
|
| + input_resources += policy_templates_android_outputs |
|
pneubeck (no reviews)
2015/03/27 09:09:25
aren't you supposed to depend on the target that p
knn
2015/03/27 11:46:49
GN derives dependencies by looking at the inputs/o
pneubeck (no reviews)
2015/03/27 12:49:15
If you don't see concrete reason (like common prac
|
| + build_config_path = "$target_gen_dir/$target_name.build_config" |
|
pneubeck (no reviews)
2015/03/27 09:09:25
move to __build_config
knn
2015/03/27 11:46:49
Can't do that as $target_name will change.
pneubeck (no reviews)
2015/03/27 12:49:15
I looked a bit more into this. It seems to be comm
|
| + copy("${target_name}__consolidate_resources") { |
| + sources = [ |
| + "$root_gen_dir/policy/app_restrictions.xml", |
|
pneubeck (no reviews)
2015/03/27 09:09:24
nit: remove newlines
knn
2015/03/27 11:46:49
GN has it's own format tool that fails presubmit c
|
| + ] |
| + outputs = [ |
| + "$root_gen_dir/chrome/app/policy/android/xml-v21/app_restrictions.xml", |
|
pneubeck (no reviews)
2015/03/27 09:09:24
== "$input_resources_dir/xml-v21/app_restrictions.
knn
2015/03/27 11:46:49
Thanks for this! Don't know how this ended up this
|
| + ] |
| + } |
| + |
| + # TODO(knn,cjhopman): The write_build_config template is in |
| + # //build/config/android/internal_rules.gni and is not meant for external |
| + # use. The public rules (in rules.gni) should be updated to support what |
| + # we are doing here. |
| + write_build_config("${target_name}__build_config") { |
| + build_config = build_config_path |
| + resources_zip = "$root_build_dir/$resources_zip" |
| + type = "android_resources" |
| + } |
| + action("${target_name}__create_zip") { |
| + script = "//build/android/gn/zip.py" |
| + outputs = [ |
|
pneubeck (no reviews)
2015/03/27 09:09:24
nit: remove newlines
knn
2015/03/27 11:46:49
Answered in line 250.
pneubeck (no reviews)
2015/03/27 12:49:15
If this is anyways subject to autoformatting, then
|
| + "$root_build_dir/$resources_zip", |
| + ] |
| + inputs = input_resources |
| + rebased_inputs = rebase_path(input_resources, root_build_dir) |
| + args = [ |
|
pneubeck (no reviews)
2015/03/27 09:09:25
can you make the use of '=' vs. two array entries
knn
2015/03/27 11:46:49
Not sure if I understand correctly but do you mean
pneubeck (no reviews)
2015/03/27 12:49:15
No, I meant the notation
..., "--XYZ=$VAR", ...
v
|
| + "--inputs=$rebased_inputs", |
| + "--output=$resources_zip", |
| + "--base-dir", |
| + rebase_path(input_resources_dir, root_build_dir), |
| + ] |
| + } |
| + deps = [ |
| + ":${target_name}__consolidate_resources", |
|
pneubeck (no reviews)
2015/03/27 09:09:24
is it guaranteed that these deps are executed in o
knn
2015/03/27 11:46:49
As I answered above, GN derives dependencies from
pneubeck (no reviews)
2015/03/27 12:49:15
It seems to me that deps should be complete (if yo
|
| + ":${target_name}__build_config", |
| + ":${target_name}__create_zip", |
| + ] |
| + } |
| + } |
| } |
| #TODO(GYP) chrome_manifest_bundle |