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 | |
53 # This protobuf is equivalent to chrome_settings.proto but shares messages | 50 # This protobuf is equivalent to chrome_settings.proto but shares messages |
54 # for policies of the same type, so that less classes have to be generated | 51 # for policies of the same type, so that less classes have to be generated |
55 # and compiled. | 52 # and compiled. |
56 cloud_policy_proto_path = "$policy_gen_dir/cloud_policy.proto" | 53 cloud_policy_proto_path = "$policy_gen_dir/cloud_policy.proto" |
57 | 54 |
58 # This is the "full" protobuf, which defines one protobuf message per | 55 # This is the "full" protobuf, which defines one protobuf message per |
59 # policy. It is also the format currently used by the server. | 56 # policy. It is also the format currently used by the server. |
60 chrome_settings_proto_path = "$policy_gen_dir/chrome_settings.proto" | 57 chrome_settings_proto_path = "$policy_gen_dir/chrome_settings.proto" |
61 | 58 |
62 constants_header_path = "$policy_gen_dir/policy_constants.h" | 59 constants_header_path = "$policy_gen_dir/policy_constants.h" |
63 constants_source_path = "$policy_gen_dir/policy_constants.cc" | 60 constants_source_path = "$policy_gen_dir/policy_constants.cc" |
64 protobuf_decoder_path = "$policy_gen_dir/cloud_policy_generated.cc" | 61 protobuf_decoder_path = "$policy_gen_dir/cloud_policy_generated.cc" |
65 app_restrictions_path = "$android_resources_gen_dir/xml/app_restrictions.xml" | |
66 app_resources_path = | |
67 "$android_resources_gen_dir/values/restriction_values.xml" | |
68 | 62 |
69 action("cloud_policy_code_generate") { | 63 action("cloud_policy_code_generate") { |
70 script = "tools/generate_policy_source.py" | 64 script = "tools/generate_policy_source.py" |
71 | 65 |
72 if (is_chromeos) { | 66 if (is_chromeos) { |
73 chromeos_flag = "1" | 67 chromeos_flag = "1" |
74 } else { | 68 } else { |
75 chromeos_flag = "0" | 69 chromeos_flag = "0" |
76 } | 70 } |
77 | 71 |
78 inputs = [ | 72 inputs = [ |
79 "resources/policy_templates.json", | 73 "resources/policy_templates.json", |
80 ] | 74 ] |
81 outputs = [ | 75 outputs = [ |
82 constants_header_path, | 76 constants_header_path, |
83 constants_source_path, | 77 constants_source_path, |
84 protobuf_decoder_path, | 78 protobuf_decoder_path, |
85 chrome_settings_proto_path, | 79 chrome_settings_proto_path, |
86 cloud_policy_proto_path, | 80 cloud_policy_proto_path, |
87 app_restrictions_path, | |
88 app_resources_path, | |
89 ] | 81 ] |
90 | 82 |
91 if (os != "android") { | |
92 outputs -= [ | |
93 app_restrictions_path, | |
94 app_resources_path, | |
95 ] | |
96 } | |
97 | |
98 args = [ | 83 args = [ |
99 "--policy-constants-header=" + | 84 "--policy-constants-header=" + |
100 rebase_path(constants_header_path, root_build_dir), | 85 rebase_path(constants_header_path, root_build_dir), |
101 "--policy-constants-source=" + | 86 "--policy-constants-source=" + |
102 rebase_path(constants_source_path, root_build_dir), | 87 rebase_path(constants_source_path, root_build_dir), |
103 "--chrome-settings-protobuf=" + | 88 "--chrome-settings-protobuf=" + |
104 rebase_path(chrome_settings_proto_path, root_build_dir), | 89 rebase_path(chrome_settings_proto_path, root_build_dir), |
105 "--cloud-policy-protobuf=" + | 90 "--cloud-policy-protobuf=" + |
106 rebase_path(cloud_policy_proto_path, root_build_dir), | 91 rebase_path(cloud_policy_proto_path, root_build_dir), |
107 "--cloud-policy-decoder=" + | 92 "--cloud-policy-decoder=" + |
108 rebase_path(protobuf_decoder_path, root_build_dir), | 93 rebase_path(protobuf_decoder_path, root_build_dir), |
109 "--app-restrictions-definition=" + | |
110 rebase_path(app_restrictions_path, root_build_dir), | |
111 "--app-restrictions-resources=" + | |
112 rebase_path(app_resources_path, root_build_dir), | |
113 os, | 94 os, |
114 chromeos_flag, | 95 chromeos_flag, |
115 rebase_path("resources/policy_templates.json", root_build_dir), | 96 rebase_path("resources/policy_templates.json", root_build_dir), |
116 ] | 97 ] |
117 } | 98 } |
118 | 99 |
119 proto_library("cloud_policy_proto_generated_compile") { | 100 proto_library("cloud_policy_proto_generated_compile") { |
120 sources = [ | 101 sources = [ |
121 cloud_policy_proto_path, | 102 cloud_policy_proto_path, |
122 ] | 103 ] |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 deps = [ | 188 deps = [ |
208 ":policy_component", | 189 ":policy_component", |
209 ":test_support", | 190 ":test_support", |
210 "//components/policy/proto", | 191 "//components/policy/proto", |
211 "//testing/gmock", | 192 "//testing/gmock", |
212 "//testing/gtest", | 193 "//testing/gtest", |
213 ] | 194 ] |
214 } | 195 } |
215 } | 196 } |
216 #TODO(GYP) policy templates, chrome_manifest_bundle | 197 #TODO(GYP) policy templates, chrome_manifest_bundle |
OLD | NEW |