OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import("//build/config/features.gni") |
| 6 import("//third_party/protobuf/proto_library.gni") |
| 7 import("//tools/grit/grit_rule.gni") |
| 8 |
| 9 if (is_component_build) { |
| 10 component("policy_component") { |
| 11 deps = [ |
| 12 "//components/policy/core/browser", |
| 13 "//components/policy/core/common", |
| 14 ] |
| 15 } |
| 16 group("policy_component_browser") { |
| 17 deps = [ ":policy_component" ] |
| 18 } |
| 19 group("policy_component_common") { |
| 20 deps = [ ":policy_component" ] |
| 21 } |
| 22 } else { # Compile to separate libraries. |
| 23 group("policy_component") { |
| 24 deps = [ |
| 25 ":policy_component_browser", |
| 26 ":policy_component_common", |
| 27 ] |
| 28 } |
| 29 component("policy_component_browser") { |
| 30 deps = [ "//components/policy/core/browser" ] |
| 31 } |
| 32 component("policy_component_common") { |
| 33 deps = [ "//components/policy/core/common" ] |
| 34 } |
| 35 } |
| 36 |
| 37 if (enable_configuration_policy) { |
| 38 # TODO(brettw) this component should use target_gen_dir instead but the GYP |
| 39 # build puts everything into the following directory. We do the same for now. |
| 40 policy_gen_dir = "$root_gen_dir/policy" |
| 41 |
| 42 # This protobuf is equivalent to chrome_settings.proto but shares messages |
| 43 # for policies of the same type, so that less classes have to be generated |
| 44 # and compiled. |
| 45 cloud_policy_proto_path = "$policy_gen_dir/cloud_policy.proto" |
| 46 |
| 47 # This is the "full" protobuf, which defines one protobuf message per |
| 48 # policy. It is also the format currently used by the server. |
| 49 chrome_settings_proto_path = "$policy_gen_dir/chrome_settings.proto" |
| 50 |
| 51 constants_header_path = "$policy_gen_dir/policy_constants.h" |
| 52 constants_source_path = "$policy_gen_dir/policy_constants.cc" |
| 53 protobuf_decoder_path = "$policy_gen_dir/cloud_policy_generated.cc" |
| 54 |
| 55 action("cloud_policy_code_generate") { |
| 56 script = "tools/generate_policy_source.py" |
| 57 |
| 58 if (is_chromeos) { |
| 59 chromeos_flag = "1" |
| 60 } else { |
| 61 chromeos_flag = "0" |
| 62 } |
| 63 |
| 64 source_prereqs = [ |
| 65 "resources/policy_templates.json", |
| 66 ] |
| 67 outputs = [ |
| 68 constants_header_path, |
| 69 constants_source_path, |
| 70 protobuf_decoder_path, |
| 71 chrome_settings_proto_path, |
| 72 cloud_policy_proto_path, |
| 73 ] |
| 74 |
| 75 args = [ |
| 76 "--policy-constants-header=" + |
| 77 rebase_path(constants_header_path, root_build_dir), |
| 78 "--policy-constants-source=" + |
| 79 rebase_path(constants_source_path, root_build_dir), |
| 80 "--chrome-settings-protobuf=" + |
| 81 rebase_path(chrome_settings_proto_path, root_build_dir), |
| 82 "--cloud-policy-protobuf=" + |
| 83 rebase_path(cloud_policy_proto_path, root_build_dir), |
| 84 "--cloud-policy-decoder=" + |
| 85 rebase_path(protobuf_decoder_path, root_build_dir), |
| 86 os, |
| 87 chromeos_flag, |
| 88 rebase_path("resources/policy_templates.json", root_build_dir), |
| 89 ] |
| 90 } |
| 91 |
| 92 proto_library("cloud_policy_proto_generated_compile") { |
| 93 sources = [ cloud_policy_proto_path ] |
| 94 |
| 95 proto_in_dir = policy_gen_dir |
| 96 proto_out_dir = "policy/proto" |
| 97 cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:" |
| 98 cc_include = "components/policy/policy_proto_export.h" |
| 99 defines = [ "POLICY_PROTO_COMPILATION" ] |
| 100 |
| 101 deps = [ |
| 102 ":cloud_policy_code_generate", |
| 103 ] |
| 104 } |
| 105 |
| 106 # This target builds the "full" protobuf, used for tests only. |
| 107 proto_library("chrome_settings_proto_generated_compile") { |
| 108 sources = [ chrome_settings_proto_path ] |
| 109 proto_in_dir = policy_gen_dir |
| 110 proto_out_dir = "policy/proto" |
| 111 |
| 112 deps = [ |
| 113 ":cloud_policy_code_generate", |
| 114 ":cloud_policy_proto_generated_compile", |
| 115 ] |
| 116 } |
| 117 |
| 118 static_library("policy") { |
| 119 sources = [ |
| 120 constants_header_path, |
| 121 constants_source_path, |
| 122 protobuf_decoder_path, |
| 123 ] |
| 124 |
| 125 defines = [ "POLICY_COMPONENT_IMPLEMENTATION" ] |
| 126 |
| 127 deps = [ |
| 128 ":cloud_policy_code_generate", |
| 129 ":cloud_policy_proto_generated_compile", |
| 130 "//base", |
| 131 "//third_party/protobuf:protobuf_lite", |
| 132 ] |
| 133 } |
| 134 |
| 135 group("test_support") { |
| 136 deps = [ |
| 137 ":chrome_settings_proto_generated_compile", |
| 138 ":policy", |
| 139 ] |
| 140 } |
| 141 |
| 142 static_library("policy_component_test_support") { |
| 143 sources = [ |
| 144 "core/browser/configuration_policy_pref_store_test.cc", |
| 145 "core/browser/configuration_policy_pref_store_test.h", |
| 146 "core/common/cloud/mock_cloud_external_data_manager.cc", |
| 147 "core/common/cloud/mock_cloud_external_data_manager.h", |
| 148 "core/common/cloud/mock_cloud_policy_client.cc", |
| 149 "core/common/cloud/mock_cloud_policy_client.h", |
| 150 "core/common/cloud/mock_cloud_policy_store.cc", |
| 151 "core/common/cloud/mock_cloud_policy_store.h", |
| 152 "core/common/cloud/mock_device_management_service.cc", |
| 153 "core/common/cloud/mock_device_management_service.h", |
| 154 "core/common/cloud/mock_user_cloud_policy_store.cc", |
| 155 "core/common/cloud/mock_user_cloud_policy_store.h", |
| 156 "core/common/cloud/policy_builder.cc", |
| 157 "core/common/cloud/policy_builder.h", |
| 158 "core/common/configuration_policy_provider_test.cc", |
| 159 "core/common/configuration_policy_provider_test.h", |
| 160 "core/common/mock_configuration_policy_provider.cc", |
| 161 "core/common/mock_configuration_policy_provider.h", |
| 162 "core/common/mock_policy_service.cc", |
| 163 "core/common/mock_policy_service.h", |
| 164 "core/common/policy_test_utils.cc", |
| 165 "core/common/policy_test_utils.h", |
| 166 "core/common/preferences_mock_mac.cc", |
| 167 "core/common/preferences_mock_mac.h", |
| 168 ] |
| 169 |
| 170 if (is_chromeos) { |
| 171 sources -= [ |
| 172 "core/common/cloud/mock_user_cloud_policy_store.cc", |
| 173 "core/common/cloud/mock_user_cloud_policy_store.h", |
| 174 ] |
| 175 } |
| 176 |
| 177 deps = [ |
| 178 ":policy_component", |
| 179 ":test_support", |
| 180 "//components/policy/proto", |
| 181 "//testing/gmock", |
| 182 "//testing/gtest", |
| 183 ] |
| 184 } |
| 185 } |
| 186 |
| 187 #TODO(GYP) policy templates, chrome_manifest_bundle |
OLD | NEW |