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("//third_party/protobuf/proto_library.gni") | 6 import("//third_party/protobuf/proto_library.gni") |
7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
8 | 8 |
9 if (is_component_build) { | 9 if (is_component_build) { |
10 component("policy_component") { | 10 component("policy_component") { |
(...skipping 29 matching lines...) Expand all Loading... |
40 "//components/policy/core/common", | 40 "//components/policy/core/common", |
41 ] | 41 ] |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 if (enable_configuration_policy) { | 45 if (enable_configuration_policy) { |
46 # TODO(brettw) this component should use target_gen_dir instead but the GYP | 46 # TODO(brettw) this component should use target_gen_dir instead but the GYP |
47 # build puts everything into the following directory. We do the same for now. | 47 # build puts everything into the following directory. We do the same for now. |
48 policy_gen_dir = "$root_gen_dir/policy" | 48 policy_gen_dir = "$root_gen_dir/policy" |
49 | 49 |
| 50 # Directory for generating Android App Restrictions resources |
| 51 android_resources_gen_dir = "$policy_gen_dir/android_resources" |
| 52 |
50 # This protobuf is equivalent to chrome_settings.proto but shares messages | 53 # This protobuf is equivalent to chrome_settings.proto but shares messages |
51 # for policies of the same type, so that less classes have to be generated | 54 # for policies of the same type, so that less classes have to be generated |
52 # and compiled. | 55 # and compiled. |
53 cloud_policy_proto_path = "$policy_gen_dir/cloud_policy.proto" | 56 cloud_policy_proto_path = "$policy_gen_dir/cloud_policy.proto" |
54 | 57 |
55 # This is the "full" protobuf, which defines one protobuf message per | 58 # This is the "full" protobuf, which defines one protobuf message per |
56 # policy. It is also the format currently used by the server. | 59 # policy. It is also the format currently used by the server. |
57 chrome_settings_proto_path = "$policy_gen_dir/chrome_settings.proto" | 60 chrome_settings_proto_path = "$policy_gen_dir/chrome_settings.proto" |
58 | 61 |
59 constants_header_path = "$policy_gen_dir/policy_constants.h" | 62 constants_header_path = "$policy_gen_dir/policy_constants.h" |
60 constants_source_path = "$policy_gen_dir/policy_constants.cc" | 63 constants_source_path = "$policy_gen_dir/policy_constants.cc" |
61 protobuf_decoder_path = "$policy_gen_dir/cloud_policy_generated.cc" | 64 protobuf_decoder_path = "$policy_gen_dir/cloud_policy_generated.cc" |
62 app_restrictions_path = "$policy_gen_dir/app_restrictions.xml" | 65 app_restrictions_path = |
| 66 "$android_resources_gen_dir/xml-v21/app_restrictions.xml" |
| 67 app_resources_path = |
| 68 "$android_resources_gen_dir/values-v21/restriction_values.xml" |
63 | 69 |
64 action("cloud_policy_code_generate") { | 70 action("cloud_policy_code_generate") { |
65 script = "tools/generate_policy_source.py" | 71 script = "tools/generate_policy_source.py" |
66 | 72 |
67 if (is_chromeos) { | 73 if (is_chromeos) { |
68 chromeos_flag = "1" | 74 chromeos_flag = "1" |
69 } else { | 75 } else { |
70 chromeos_flag = "0" | 76 chromeos_flag = "0" |
71 } | 77 } |
72 | 78 |
73 inputs = [ | 79 inputs = [ |
74 "resources/policy_templates.json", | 80 "resources/policy_templates.json", |
75 ] | 81 ] |
76 outputs = [ | 82 outputs = [ |
77 constants_header_path, | 83 constants_header_path, |
78 constants_source_path, | 84 constants_source_path, |
79 protobuf_decoder_path, | 85 protobuf_decoder_path, |
80 chrome_settings_proto_path, | 86 chrome_settings_proto_path, |
81 cloud_policy_proto_path, | 87 cloud_policy_proto_path, |
82 app_restrictions_path, | 88 app_restrictions_path, |
| 89 app_resources_path, |
83 ] | 90 ] |
84 | 91 |
85 if (target_os != "android") { | 92 if (current_os != "android") { |
86 outputs -= [ app_restrictions_path ] | 93 outputs -= [ |
| 94 app_restrictions_path, |
| 95 app_resources_path, |
| 96 ] |
87 } | 97 } |
88 | 98 |
89 args = [ | 99 args = [ |
90 "--policy-constants-header=" + | 100 "--policy-constants-header=" + |
91 rebase_path(constants_header_path, root_build_dir), | 101 rebase_path(constants_header_path, root_build_dir), |
92 "--policy-constants-source=" + | 102 "--policy-constants-source=" + |
93 rebase_path(constants_source_path, root_build_dir), | 103 rebase_path(constants_source_path, root_build_dir), |
94 "--chrome-settings-protobuf=" + | 104 "--chrome-settings-protobuf=" + |
95 rebase_path(chrome_settings_proto_path, root_build_dir), | 105 rebase_path(chrome_settings_proto_path, root_build_dir), |
96 "--cloud-policy-protobuf=" + | 106 "--cloud-policy-protobuf=" + |
97 rebase_path(cloud_policy_proto_path, root_build_dir), | 107 rebase_path(cloud_policy_proto_path, root_build_dir), |
98 "--cloud-policy-decoder=" + | 108 "--cloud-policy-decoder=" + |
99 rebase_path(protobuf_decoder_path, root_build_dir), | 109 rebase_path(protobuf_decoder_path, root_build_dir), |
100 "--app-restrictions-definition=" + | 110 "--app-restrictions-definition=" + |
101 rebase_path(app_restrictions_path, root_build_dir), | 111 rebase_path(app_restrictions_path, root_build_dir), |
102 target_os, | 112 "--app-restrictions-resources=" + |
| 113 rebase_path(app_resources_path, root_build_dir), |
| 114 current_os, |
103 chromeos_flag, | 115 chromeos_flag, |
104 rebase_path("resources/policy_templates.json", root_build_dir), | 116 rebase_path("resources/policy_templates.json", root_build_dir), |
105 ] | 117 ] |
106 } | 118 } |
107 | 119 |
108 proto_library("cloud_policy_proto_generated_compile") { | 120 proto_library("cloud_policy_proto_generated_compile") { |
109 sources = [ | 121 sources = [ |
110 cloud_policy_proto_path, | 122 cloud_policy_proto_path, |
111 ] | 123 ] |
112 | 124 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 deps = [ | 212 deps = [ |
201 ":policy_component", | 213 ":policy_component", |
202 ":test_support", | 214 ":test_support", |
203 "//components/policy/proto", | 215 "//components/policy/proto", |
204 "//testing/gmock", | 216 "//testing/gmock", |
205 "//testing/gtest", | 217 "//testing/gtest", |
206 ] | 218 ] |
207 } | 219 } |
208 } | 220 } |
209 #TODO(GYP) policy templates, chrome_manifest_bundle | 221 #TODO(GYP) policy templates, chrome_manifest_bundle |
OLD | NEW |