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