| 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 |
| 108 grit("policy_templates") { |
| 109 import("resources/policy_templates.gni") |
| 110 source = "resources/policy_templates.grd" |
| 111 use_qualified_include = true |
| 112 depend_on_stamp = true |
| 113 output_dir = "$root_gen_dir/chrome" |
| 114 outputs = policy_templates_doc_outputs |
| 115 if (is_android) { |
| 116 outputs += policy_templates_android_outputs |
| 117 } |
| 118 if (is_linux) { |
| 119 outputs += policy_templates_linux_outputs |
| 120 } |
| 121 if (is_mac) { |
| 122 outputs += policy_templates_mac_outputs |
| 123 |
| 124 # TODO(knn) : Move this out once more targets use this. |
| 125 if (is_chrome_branded) { |
| 126 mac_bundle_id = "com.google.Chrome" |
| 127 } else { |
| 128 mac_bundle_id = "org.chromium.Chromium" |
| 129 } |
| 130 defines = [ "mac_bundle_id=$mac_bundle_id" ] |
| 131 } |
| 132 if (is_win) { |
| 133 outputs += policy_templates_windows_outputs |
| 134 } |
| 135 } |
| 136 |
| 120 proto_library("cloud_policy_proto_generated_compile") { | 137 proto_library("cloud_policy_proto_generated_compile") { |
| 121 sources = [ | 138 sources = [ |
| 122 cloud_policy_proto_path, | 139 cloud_policy_proto_path, |
| 123 ] | 140 ] |
| 124 | 141 |
| 125 proto_out_dir = "policy/proto" | 142 proto_out_dir = "policy/proto" |
| 126 cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:" | 143 cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:" |
| 127 cc_include = "components/policy/policy_proto_export.h" | 144 cc_include = "components/policy/policy_proto_export.h" |
| 128 defines = [ "POLICY_PROTO_COMPILATION" ] | 145 defines = [ "POLICY_PROTO_COMPILATION" ] |
| 129 | 146 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 230 |
| 214 deps = [ | 231 deps = [ |
| 215 ":policy_component", | 232 ":policy_component", |
| 216 ":test_support", | 233 ":test_support", |
| 217 "//components/policy/proto", | 234 "//components/policy/proto", |
| 218 "//testing/gmock", | 235 "//testing/gmock", |
| 219 "//testing/gtest", | 236 "//testing/gtest", |
| 220 ] | 237 ] |
| 221 } | 238 } |
| 222 } | 239 } |
| 223 #TODO(GYP) policy templates, chrome_manifest_bundle | 240 #TODO(GYP) chrome_manifest_bundle |
| OLD | NEW |