OLD | NEW |
---|---|
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/features.gni") | 5 import("//build/config/features.gni") |
6 import("resources/policy_templates.gni") | |
6 import("//third_party/protobuf/proto_library.gni") | 7 import("//third_party/protobuf/proto_library.gni") |
7 import("//tools/grit/grit_rule.gni") | 8 import("//tools/grit/grit_rule.gni") |
8 | 9 |
9 if (is_component_build) { | 10 if (is_component_build) { |
10 component("policy_component") { | 11 component("policy_component") { |
11 deps = [ | 12 deps = [ |
12 "//components/policy/core/browser", | 13 "//components/policy/core/browser", |
13 "//components/policy/core/common", | 14 "//components/policy/core/common", |
14 ] | 15 ] |
15 } | 16 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 rebase_path(protobuf_decoder_path, root_build_dir), | 100 rebase_path(protobuf_decoder_path, root_build_dir), |
100 "--app-restrictions-definition=" + | 101 "--app-restrictions-definition=" + |
101 rebase_path(app_restrictions_path, root_build_dir), | 102 rebase_path(app_restrictions_path, root_build_dir), |
102 target_os, | 103 target_os, |
103 chromeos_flag, | 104 chromeos_flag, |
104 rebase_path("resources/policy_templates.json", root_build_dir), | 105 rebase_path("resources/policy_templates.json", root_build_dir), |
105 ] | 106 ] |
106 } | 107 } |
107 | 108 |
108 grit("policy_templates") { | 109 grit("policy_templates") { |
109 import("resources/policy_templates.gni") | |
110 source = "resources/policy_templates.grd" | 110 source = "resources/policy_templates.grd" |
111 use_qualified_include = true | 111 use_qualified_include = true |
112 depend_on_stamp = true | 112 depend_on_stamp = true |
113 output_dir = "$root_gen_dir/chrome" | 113 output_dir = "$root_gen_dir/chrome" |
114 outputs = policy_templates_doc_outputs | 114 outputs = policy_templates_doc_outputs |
115 if (is_android) { | 115 if (is_android) { |
116 outputs += policy_templates_android_outputs | 116 outputs += policy_templates_android_outputs |
117 } | 117 } |
118 if (is_linux) { | 118 if (is_linux) { |
119 outputs += policy_templates_linux_outputs | 119 outputs += policy_templates_linux_outputs |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 } | 229 } |
230 | 230 |
231 deps = [ | 231 deps = [ |
232 ":policy_component", | 232 ":policy_component", |
233 ":test_support", | 233 ":test_support", |
234 "//components/policy/proto", | 234 "//components/policy/proto", |
235 "//testing/gmock", | 235 "//testing/gmock", |
236 "//testing/gtest", | 236 "//testing/gtest", |
237 ] | 237 ] |
238 } | 238 } |
239 | |
240 if (is_android) { | |
241 import("//build/config/android/rules.gni") | |
242 group("app_restrictions_resources") { | |
243 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
| |
244 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.
| |
245 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.
| |
246 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
| |
247 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
| |
248 copy("${target_name}__consolidate_resources") { | |
249 sources = [ | |
250 "$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
| |
251 ] | |
252 outputs = [ | |
253 "$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
| |
254 ] | |
255 } | |
256 | |
257 # TODO(knn,cjhopman): The write_build_config template is in | |
258 # //build/config/android/internal_rules.gni and is not meant for external | |
259 # use. The public rules (in rules.gni) should be updated to support what | |
260 # we are doing here. | |
261 write_build_config("${target_name}__build_config") { | |
262 build_config = build_config_path | |
263 resources_zip = "$root_build_dir/$resources_zip" | |
264 type = "android_resources" | |
265 } | |
266 action("${target_name}__create_zip") { | |
267 script = "//build/android/gn/zip.py" | |
268 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
| |
269 "$root_build_dir/$resources_zip", | |
270 ] | |
271 inputs = input_resources | |
272 rebased_inputs = rebase_path(input_resources, root_build_dir) | |
273 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
| |
274 "--inputs=$rebased_inputs", | |
275 "--output=$resources_zip", | |
276 "--base-dir", | |
277 rebase_path(input_resources_dir, root_build_dir), | |
278 ] | |
279 } | |
280 deps = [ | |
281 ":${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
| |
282 ":${target_name}__build_config", | |
283 ":${target_name}__create_zip", | |
284 ] | |
285 } | |
286 } | |
239 } | 287 } |
240 #TODO(GYP) chrome_manifest_bundle | 288 #TODO(GYP) chrome_manifest_bundle |
OLD | NEW |