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" |
| 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" |
62 | 69 |
63 action("cloud_policy_code_generate") { | 70 action("cloud_policy_code_generate") { |
64 script = "tools/generate_policy_source.py" | 71 script = "tools/generate_policy_source.py" |
65 | 72 |
66 if (is_chromeos) { | 73 if (is_chromeos) { |
67 chromeos_flag = "1" | 74 chromeos_flag = "1" |
68 } else { | 75 } else { |
69 chromeos_flag = "0" | 76 chromeos_flag = "0" |
70 } | 77 } |
71 | 78 |
72 inputs = [ | 79 inputs = [ |
73 "resources/policy_templates.json", | 80 "resources/policy_templates.json", |
74 ] | 81 ] |
75 outputs = [ | 82 outputs = [ |
76 constants_header_path, | 83 constants_header_path, |
77 constants_source_path, | 84 constants_source_path, |
78 protobuf_decoder_path, | 85 protobuf_decoder_path, |
79 chrome_settings_proto_path, | 86 chrome_settings_proto_path, |
80 cloud_policy_proto_path, | 87 cloud_policy_proto_path, |
| 88 app_restrictions_path, |
| 89 app_resources_path, |
81 ] | 90 ] |
82 | 91 |
| 92 if (os != "android") { |
| 93 outputs -= [ |
| 94 app_restrictions_path, |
| 95 app_resources_path, |
| 96 ] |
| 97 } |
| 98 |
83 args = [ | 99 args = [ |
84 "--policy-constants-header=" + | 100 "--policy-constants-header=" + |
85 rebase_path(constants_header_path, root_build_dir), | 101 rebase_path(constants_header_path, root_build_dir), |
86 "--policy-constants-source=" + | 102 "--policy-constants-source=" + |
87 rebase_path(constants_source_path, root_build_dir), | 103 rebase_path(constants_source_path, root_build_dir), |
88 "--chrome-settings-protobuf=" + | 104 "--chrome-settings-protobuf=" + |
89 rebase_path(chrome_settings_proto_path, root_build_dir), | 105 rebase_path(chrome_settings_proto_path, root_build_dir), |
90 "--cloud-policy-protobuf=" + | 106 "--cloud-policy-protobuf=" + |
91 rebase_path(cloud_policy_proto_path, root_build_dir), | 107 rebase_path(cloud_policy_proto_path, root_build_dir), |
92 "--cloud-policy-decoder=" + | 108 "--cloud-policy-decoder=" + |
93 rebase_path(protobuf_decoder_path, root_build_dir), | 109 rebase_path(protobuf_decoder_path, root_build_dir), |
| 110 "--app-restrictions-definition=" + |
| 111 rebase_path(app_restrictions_path, root_build_dir), |
| 112 "--app-restrictions-resources=" + |
| 113 rebase_path(app_resources_path, root_build_dir), |
94 os, | 114 os, |
95 chromeos_flag, | 115 chromeos_flag, |
96 rebase_path("resources/policy_templates.json", root_build_dir), | 116 rebase_path("resources/policy_templates.json", root_build_dir), |
97 ] | 117 ] |
98 } | 118 } |
99 | 119 |
100 proto_library("cloud_policy_proto_generated_compile") { | 120 proto_library("cloud_policy_proto_generated_compile") { |
101 sources = [ | 121 sources = [ |
102 cloud_policy_proto_path, | 122 cloud_policy_proto_path, |
103 ] | 123 ] |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 deps = [ | 208 deps = [ |
189 ":policy_component", | 209 ":policy_component", |
190 ":test_support", | 210 ":test_support", |
191 "//components/policy/proto", | 211 "//components/policy/proto", |
192 "//testing/gmock", | 212 "//testing/gmock", |
193 "//testing/gtest", | 213 "//testing/gtest", |
194 ] | 214 ] |
195 } | 215 } |
196 } | 216 } |
197 #TODO(GYP) policy templates, chrome_manifest_bundle | 217 #TODO(GYP) policy templates, chrome_manifest_bundle |
OLD | NEW |