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" |
| 244 generated_resources_dir = "$root_gen_dir/chrome/app/policy/android" |
| 245 |
| 246 copy("${target_name}__consolidate_resources") { |
| 247 sources = [ |
| 248 "$root_gen_dir/policy/app_restrictions.xml", |
| 249 ] |
| 250 outputs = [ |
| 251 "$generated_resources_dir/xml-v21/app_restrictions.xml", |
| 252 ] |
| 253 deps = [ |
| 254 ":policy_templates", |
| 255 ] |
| 256 } |
| 257 |
| 258 # TODO(471115): The write_build_config template is in |
| 259 # //build/config/android/internal_rules.gni and is not meant for external |
| 260 # use. The public rules (in rules.gni) should be updated to support what |
| 261 # we are doing here. |
| 262 build_config_path = "$target_gen_dir/$target_name.build_config" |
| 263 write_build_config("${target_name}__build_config") { |
| 264 build_config = build_config_path |
| 265 resources_zip = "$root_build_dir/$resources_zip" |
| 266 type = "android_resources" |
| 267 } |
| 268 |
| 269 action("${target_name}__create_zip") { |
| 270 script = "//build/android/gn/zip.py" |
| 271 outputs = [ |
| 272 "$root_build_dir/$resources_zip", |
| 273 ] |
| 274 generated_resources = |
| 275 [ "$generated_resources_dir/xml-v21/app_restrictions.xml" ] + |
| 276 policy_templates_android_outputs |
| 277 inputs = generated_resources |
| 278 rebased_inputs = rebase_path(generated_resources, root_build_dir) |
| 279 rebased_resources_dir = |
| 280 rebase_path(generated_resources_dir, root_build_dir) |
| 281 args = [ |
| 282 "--inputs=$rebased_inputs", |
| 283 "--output=$resources_zip", |
| 284 "--base-dir=$rebased_resources_dir", |
| 285 ] |
| 286 } |
| 287 |
| 288 deps = [ |
| 289 ":${target_name}__consolidate_resources", |
| 290 ":${target_name}__build_config", |
| 291 ":${target_name}__create_zip", |
| 292 ] |
| 293 } |
| 294 } |
239 } | 295 } |
240 #TODO(GYP) chrome_manifest_bundle | 296 #TODO(GYP) chrome_manifest_bundle |
OLD | NEW |