| 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/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
| 6 import("//build/config/features.gni") | 6 import("//build/config/features.gni") |
| 7 import("//build/toolchain/toolchain.gni") | 7 import("//build/toolchain/toolchain.gni") |
| 8 import("//components/policy/resources/policy_templates.gni") | 8 import("//components/policy/resources/policy_templates.gni") |
| 9 import("//third_party/protobuf/proto_library.gni") | 9 import("//third_party/protobuf/proto_library.gni") |
| 10 import("//tools/grit/grit_rule.gni") | 10 import("//tools/grit/grit_rule.gni") |
| 11 | 11 |
| 12 assert(!is_ios, "Policy should not be referenced on iOS") |
| 13 |
| 12 # To test policy generation for platforms different than your OS, override and | 14 # To test policy generation for platforms different than your OS, override and |
| 13 # enable these flags (but don't check that in!). | 15 # enable these flags (but don't check that in!). |
| 14 gen_policy_templates_common = true | 16 gen_policy_templates_common = true |
| 15 gen_policy_templates_win = is_win | 17 gen_policy_templates_win = is_win |
| 16 gen_policy_templates_linux = is_linux | 18 gen_policy_templates_linux = is_linux |
| 17 gen_policy_templates_android = is_android | 19 gen_policy_templates_android = is_android |
| 18 gen_policy_templates_mac = is_mac | 20 gen_policy_templates_mac = is_mac |
| 19 | 21 |
| 20 if (is_mac) { | 22 if (is_mac) { |
| 21 import("//build/util/branding.gni") | 23 import("//build/util/branding.gni") |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 "//components/policy/core/common:internal", | 39 "//components/policy/core/common:internal", |
| 38 ] | 40 ] |
| 39 } | 41 } |
| 40 } | 42 } |
| 41 | 43 |
| 42 # Used by targets that compile into the implementation. | 44 # Used by targets that compile into the implementation. |
| 43 config("component_implementation") { | 45 config("component_implementation") { |
| 44 defines = [ "POLICY_COMPONENT_IMPLEMENTATION" ] | 46 defines = [ "POLICY_COMPONENT_IMPLEMENTATION" ] |
| 45 } | 47 } |
| 46 | 48 |
| 47 if (enable_configuration_policy) { | 49 # This protobuf is equivalent to chrome_settings.proto but shares messages |
| 48 # This protobuf is equivalent to chrome_settings.proto but shares messages | 50 # for policies of the same type, so that less classes have to be generated |
| 49 # for policies of the same type, so that less classes have to be generated | 51 # and compiled. |
| 50 # and compiled. | 52 cloud_policy_proto_path = "$target_gen_dir/proto/cloud_policy.proto" |
| 51 cloud_policy_proto_path = "$target_gen_dir/proto/cloud_policy.proto" | 53 |
| 52 | 54 # This is the "full" protobuf, which defines one protobuf message per |
| 53 # This is the "full" protobuf, which defines one protobuf message per | 55 # policy. It is also the format currently used by the server. |
| 54 # policy. It is also the format currently used by the server. | 56 chrome_settings_proto_path = "$target_gen_dir/proto/chrome_settings.proto" |
| 55 chrome_settings_proto_path = "$target_gen_dir/proto/chrome_settings.proto" | 57 |
| 56 | 58 constants_header_path = "$target_gen_dir/policy_constants.h" |
| 57 constants_header_path = "$target_gen_dir/policy_constants.h" | 59 constants_source_path = "$target_gen_dir/policy_constants.cc" |
| 58 constants_source_path = "$target_gen_dir/policy_constants.cc" | 60 protobuf_decoder_path = "$target_gen_dir/cloud_policy_generated.cc" |
| 59 protobuf_decoder_path = "$target_gen_dir/cloud_policy_generated.cc" | 61 app_restrictions_path = "$target_gen_dir/app_restrictions.xml" |
| 60 app_restrictions_path = "$target_gen_dir/app_restrictions.xml" | 62 risk_tag_header_path = "$target_gen_dir/risk_tag.h" |
| 61 risk_tag_header_path = "$target_gen_dir/risk_tag.h" | 63 |
| 62 | 64 action("cloud_policy_code_generate") { |
| 63 action("cloud_policy_code_generate") { | 65 script = "tools/generate_policy_source.py" |
| 64 script = "tools/generate_policy_source.py" | 66 chrome_version_abspath = "//chrome/VERSION" |
| 65 chrome_version_abspath = "//chrome/VERSION" | 67 chrome_version_path = rebase_path(chrome_version_abspath, root_build_dir) |
| 66 chrome_version_path = rebase_path(chrome_version_abspath, root_build_dir) | 68 |
| 67 | 69 if (is_chromeos) { |
| 68 if (is_chromeos) { | 70 chromeos_flag = "1" |
| 69 chromeos_flag = "1" | 71 } else { |
| 72 chromeos_flag = "0" |
| 73 } |
| 74 |
| 75 inputs = [ |
| 76 chrome_version_abspath, |
| 77 "resources/policy_templates.json", |
| 78 ] |
| 79 outputs = [ |
| 80 constants_header_path, |
| 81 constants_source_path, |
| 82 protobuf_decoder_path, |
| 83 chrome_settings_proto_path, |
| 84 cloud_policy_proto_path, |
| 85 app_restrictions_path, |
| 86 risk_tag_header_path, |
| 87 ] |
| 88 |
| 89 if (target_os != "android") { |
| 90 outputs -= [ app_restrictions_path ] |
| 91 } |
| 92 |
| 93 args = [ |
| 94 "--policy-constants-header=" + |
| 95 rebase_path(constants_header_path, root_build_dir), |
| 96 "--policy-constants-source=" + |
| 97 rebase_path(constants_source_path, root_build_dir), |
| 98 "--chrome-settings-protobuf=" + |
| 99 rebase_path(chrome_settings_proto_path, root_build_dir), |
| 100 "--cloud-policy-protobuf=" + |
| 101 rebase_path(cloud_policy_proto_path, root_build_dir), |
| 102 "--cloud-policy-decoder=" + |
| 103 rebase_path(protobuf_decoder_path, root_build_dir), |
| 104 "--app-restrictions-definition=" + |
| 105 rebase_path(app_restrictions_path, root_build_dir), |
| 106 "--risk-tag-header=" + rebase_path(risk_tag_header_path, root_build_dir), |
| 107 chrome_version_path, |
| 108 target_os, |
| 109 chromeos_flag, |
| 110 rebase_path("resources/policy_templates.json", root_build_dir), |
| 111 ] |
| 112 } |
| 113 |
| 114 policy_templates_grd_file = "resources/policy_templates.grd" |
| 115 |
| 116 grit("grit_policy_templates") { |
| 117 source = policy_templates_grd_file |
| 118 use_qualified_include = true |
| 119 output_dir = "$root_gen_dir/chrome" |
| 120 outputs = [] |
| 121 defines = [] |
| 122 |
| 123 if (gen_policy_templates_common) { |
| 124 outputs += policy_templates_doc_outputs |
| 125 defines += [ "gen_policy_templates_common" ] |
| 126 } |
| 127 if (gen_policy_templates_android) { |
| 128 outputs += policy_templates_android_outputs |
| 129 defines += [ "gen_policy_templates_android" ] |
| 130 } |
| 131 if (gen_policy_templates_linux) { |
| 132 outputs += policy_templates_linux_outputs |
| 133 defines += [ "gen_policy_templates_linux" ] |
| 134 } |
| 135 if (gen_policy_templates_mac) { |
| 136 outputs += policy_templates_mac_outputs |
| 137 defines += [ |
| 138 "mac_bundle_id=$chrome_mac_bundle_id", |
| 139 "gen_policy_templates_mac", |
| 140 ] |
| 141 } |
| 142 if (gen_policy_templates_win) { |
| 143 outputs += policy_templates_windows_outputs |
| 144 defines += [ "gen_policy_templates_win" ] |
| 145 } |
| 146 } |
| 147 |
| 148 if (gen_policy_templates_win && is_chrome_branded) { |
| 149 # Creates google.admx and google.adml files that define a common 'Google' |
| 150 # category used for Chrome, Chrome OS and possibly external tools, see |
| 151 # crbug.com/665400. |
| 152 action("create_google_admx") { |
| 153 script = "tools/create_google_admx.py" |
| 154 inputs = [ |
| 155 policy_templates_grd_file, |
| 156 grit_info_script, |
| 157 ] + policy_templates_windows_outputs |
| 158 outputs = policy_templates_windows_google_outputs |
| 159 deps = [ |
| 160 ":grit_policy_templates", |
| 161 ] |
| 162 |
| 163 # Don't pass in outputs directly, it would exceed a limit on Windows! |
| 164 args = [ |
| 165 "--basedir", |
| 166 rebase_path(policy_templates_base_dir, root_build_dir), |
| 167 "--grd_strip_path_prefix", |
| 168 "app/policy/", |
| 169 "--grd_input", |
| 170 rebase_path(policy_templates_grd_file, root_build_dir), |
| 171 "--grit_info", |
| 172 rebase_path(grit_info_script, root_build_dir), |
| 173 "-D", |
| 174 "gen_policy_templates_win", |
| 175 ] + grit_defines |
| 176 } |
| 177 } |
| 178 |
| 179 group("policy_templates") { |
| 180 public_deps = [ |
| 181 ":grit_policy_templates", |
| 182 ] |
| 183 if (gen_policy_templates_win && is_chrome_branded) { |
| 184 public_deps += [ ":create_google_admx" ] |
| 185 } |
| 186 } |
| 187 |
| 188 # Run the proto compiler over the generated file and make it a component. |
| 189 component("cloud_policy_proto_generated_compile") { |
| 190 public_deps = [ |
| 191 ":cloud_policy_proto_generated_compile_proto", |
| 192 ] |
| 193 } |
| 194 proto_library("cloud_policy_proto_generated_compile_proto") { |
| 195 visibility = [ ":cloud_policy_proto_generated_compile" ] |
| 196 sources = [ |
| 197 cloud_policy_proto_path, |
| 198 ] |
| 199 |
| 200 proto_out_dir = "components/policy/proto" |
| 201 cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:" |
| 202 cc_include = "components/policy/proto/policy_proto_export.h" |
| 203 component_build_force_source_set = true |
| 204 defines = [ "POLICY_PROTO_COMPILATION" ] |
| 205 |
| 206 deps = [ |
| 207 ":cloud_policy_code_generate", |
| 208 ] |
| 209 } |
| 210 |
| 211 # This target builds the "full" protobuf, used for tests only. |
| 212 proto_library("chrome_settings_proto") { |
| 213 testonly = true |
| 214 sources = [ |
| 215 chrome_settings_proto_path, |
| 216 ] |
| 217 proto_out_dir = "components/policy/proto" |
| 218 |
| 219 deps = [ |
| 220 ":cloud_policy_code_generate", |
| 221 ":cloud_policy_proto_generated_compile", |
| 222 ] |
| 223 } |
| 224 |
| 225 static_library("generated") { |
| 226 sources = [ |
| 227 constants_header_path, |
| 228 constants_source_path, |
| 229 protobuf_decoder_path, |
| 230 risk_tag_header_path, |
| 231 ] |
| 232 |
| 233 defines = [ "POLICY_COMPONENT_IMPLEMENTATION" ] |
| 234 public_deps = [ |
| 235 ":cloud_policy_code_generate", |
| 236 ":cloud_policy_proto_generated_compile", |
| 237 "//base", |
| 238 "//third_party/protobuf:protobuf_lite", |
| 239 ] |
| 240 } |
| 241 |
| 242 if (gen_policy_templates_android && is_android) { |
| 243 import("//build/config/android/rules.gni") |
| 244 |
| 245 _generated_resources_dir = "$root_gen_dir/chrome/app/policy/android" |
| 246 |
| 247 copy("app_restrictions_resources_copy") { |
| 248 sources = [ |
| 249 app_restrictions_path, |
| 250 ] |
| 251 outputs = [ |
| 252 "$_generated_resources_dir/xml-v21/app_restrictions.xml", |
| 253 ] |
| 254 deps = [ |
| 255 ":cloud_policy_code_generate", |
| 256 ":policy_templates", |
| 257 ] |
| 258 } |
| 259 |
| 260 android_resources("app_restrictions_resources") { |
| 261 resource_dirs = [] |
| 262 generated_resource_dirs = [ |
| 263 "$policy_templates_base_dir/android", |
| 264 _generated_resources_dir, |
| 265 ] |
| 266 generated_resource_files = |
| 267 policy_templates_android_outputs + |
| 268 [ "$_generated_resources_dir/xml-v21/app_restrictions.xml" ] |
| 269 deps = [ |
| 270 ":app_restrictions_resources_copy", |
| 271 ":grit_policy_templates", |
| 272 ] |
| 273 } |
| 274 } else if (gen_policy_templates_mac && is_mac) { |
| 275 action("convert_mcx_plist") { |
| 276 script = "//build/config/mac/xcrun.py" |
| 277 sources = [ |
| 278 "$policy_templates_base_dir/mac/app-Manifest.plist", |
| 279 ] |
| 280 inputs = [ |
| 281 script, |
| 282 ] |
| 283 outputs = [ |
| 284 "$target_gen_dir/$chrome_mac_bundle_id.manifest", |
| 285 ] |
| 286 |
| 287 if (use_system_xcode) { |
| 288 args = [] |
| 70 } else { | 289 } else { |
| 71 chromeos_flag = "0" | 290 args = [ |
| 72 } | 291 "--developer_dir", |
| 73 | 292 hermetic_xcode_path, |
| 74 inputs = [ | |
| 75 chrome_version_abspath, | |
| 76 "resources/policy_templates.json", | |
| 77 ] | |
| 78 outputs = [ | |
| 79 constants_header_path, | |
| 80 constants_source_path, | |
| 81 protobuf_decoder_path, | |
| 82 chrome_settings_proto_path, | |
| 83 cloud_policy_proto_path, | |
| 84 app_restrictions_path, | |
| 85 risk_tag_header_path, | |
| 86 ] | |
| 87 | |
| 88 if (target_os != "android") { | |
| 89 outputs -= [ app_restrictions_path ] | |
| 90 } | |
| 91 | |
| 92 args = [ | |
| 93 "--policy-constants-header=" + | |
| 94 rebase_path(constants_header_path, root_build_dir), | |
| 95 "--policy-constants-source=" + | |
| 96 rebase_path(constants_source_path, root_build_dir), | |
| 97 "--chrome-settings-protobuf=" + | |
| 98 rebase_path(chrome_settings_proto_path, root_build_dir), | |
| 99 "--cloud-policy-protobuf=" + | |
| 100 rebase_path(cloud_policy_proto_path, root_build_dir), | |
| 101 "--cloud-policy-decoder=" + | |
| 102 rebase_path(protobuf_decoder_path, root_build_dir), | |
| 103 "--app-restrictions-definition=" + | |
| 104 rebase_path(app_restrictions_path, root_build_dir), | |
| 105 "--risk-tag-header=" + rebase_path(risk_tag_header_path, root_build_dir), | |
| 106 chrome_version_path, | |
| 107 target_os, | |
| 108 chromeos_flag, | |
| 109 rebase_path("resources/policy_templates.json", root_build_dir), | |
| 110 ] | |
| 111 } | |
| 112 | |
| 113 policy_templates_grd_file = "resources/policy_templates.grd" | |
| 114 | |
| 115 grit("grit_policy_templates") { | |
| 116 source = policy_templates_grd_file | |
| 117 use_qualified_include = true | |
| 118 output_dir = "$root_gen_dir/chrome" | |
| 119 outputs = [] | |
| 120 defines = [] | |
| 121 | |
| 122 if (gen_policy_templates_common) { | |
| 123 outputs += policy_templates_doc_outputs | |
| 124 defines += [ "gen_policy_templates_common" ] | |
| 125 } | |
| 126 if (gen_policy_templates_android) { | |
| 127 outputs += policy_templates_android_outputs | |
| 128 defines += [ "gen_policy_templates_android" ] | |
| 129 } | |
| 130 if (gen_policy_templates_linux) { | |
| 131 outputs += policy_templates_linux_outputs | |
| 132 defines += [ "gen_policy_templates_linux" ] | |
| 133 } | |
| 134 if (gen_policy_templates_mac) { | |
| 135 outputs += policy_templates_mac_outputs | |
| 136 defines += [ | |
| 137 "mac_bundle_id=$chrome_mac_bundle_id", | |
| 138 "gen_policy_templates_mac", | |
| 139 ] | 293 ] |
| 140 } | 294 } |
| 141 if (gen_policy_templates_win) { | 295 args += [ |
| 142 outputs += policy_templates_windows_outputs | 296 "plutil", |
| 143 defines += [ "gen_policy_templates_win" ] | 297 "-convert", |
| 298 "xml1", |
| 299 ] + rebase_path(sources, root_out_dir) + [ "-o" ] + |
| 300 rebase_path(outputs, root_out_dir) |
| 301 |
| 302 deps = [ |
| 303 ":policy_templates", |
| 304 ] |
| 305 } |
| 306 |
| 307 bundle_data("manifest_bundle_data") { |
| 308 sources = get_target_outputs(":convert_mcx_plist") |
| 309 outputs = [ |
| 310 "{{bundle_resources_dir}}/{{source_file_part}}", |
| 311 ] |
| 312 public_deps = [ |
| 313 ":convert_mcx_plist", |
| 314 ] |
| 315 } |
| 316 |
| 317 # The reason we are not enumerating all the locales is that |
| 318 # the translations would eat up 3.5MB disk space in the |
| 319 # application bundle. |
| 320 bundle_data("manifest_strings_bundle_data") { |
| 321 sources = [ |
| 322 "$policy_templates_base_dir/mac/strings/en.lproj/Localizable.strings", |
| 323 ] |
| 324 outputs = [ |
| 325 "{{bundle_resources_dir}}/en.lproj/{{source_file_part}}", |
| 326 ] |
| 327 public_deps = [ |
| 328 ":policy_templates", |
| 329 ] |
| 330 } |
| 331 |
| 332 create_bundle("chrome_manifest_bundle") { |
| 333 bundle_root_dir = "$root_out_dir/$chrome_mac_bundle_id.manifest/Contents" |
| 334 bundle_resources_dir = "$bundle_root_dir/Resources" |
| 335 |
| 336 deps = [ |
| 337 ":manifest_bundle_data", |
| 338 ":manifest_strings_bundle_data", |
| 339 ] |
| 340 } |
| 341 } |
| 342 |
| 343 if (gen_policy_templates_common && gen_policy_templates_win) { |
| 344 version_file = "VERSION" |
| 345 version_path = "$policy_templates_base_dir/$version_file" |
| 346 |
| 347 copy("add_version") { |
| 348 sources = [ |
| 349 "//chrome/VERSION", |
| 350 ] |
| 351 outputs = [ |
| 352 version_path, |
| 353 ] |
| 354 } |
| 355 |
| 356 action("pack_policy_templates") { |
| 357 output_zip_file = "$root_out_dir/policy_templates.zip" |
| 358 script = "tools/make_policy_zip.py" |
| 359 inputs = [ |
| 360 version_path, |
| 361 policy_templates_grd_file, |
| 362 grit_info_script, |
| 363 ] + policy_templates_windows_outputs + policy_templates_doc_outputs |
| 364 outputs = [ |
| 365 output_zip_file, |
| 366 ] |
| 367 args = [ |
| 368 "--output", |
| 369 rebase_path(output_zip_file, root_build_dir), |
| 370 "--basedir", |
| 371 rebase_path(policy_templates_base_dir, root_build_dir), |
| 372 "--grd_input", |
| 373 rebase_path(policy_templates_grd_file, root_build_dir), |
| 374 "--grd_strip_path_prefix", |
| 375 "app/policy", |
| 376 "--extra_input", |
| 377 version_file, |
| 378 "--grit_info", |
| 379 rebase_path(grit_info_script, root_build_dir), |
| 380 "-D", |
| 381 "gen_policy_templates_common", |
| 382 "-D", |
| 383 "gen_policy_templates_win", |
| 384 ] + grit_defines |
| 385 if (is_chrome_branded) { |
| 386 args += [ "--include_google_admx" ] |
| 144 } | 387 } |
| 145 } | 388 deps = [ |
| 146 | 389 ":add_version", |
| 147 if (gen_policy_templates_win && is_chrome_branded) { | 390 ":policy_templates", |
| 148 # Creates google.admx and google.adml files that define a common 'Google' | 391 ] |
| 149 # category used for Chrome, Chrome OS and possibly external tools, see | 392 } |
| 150 # crbug.com/665400. | 393 } |
| 151 action("create_google_admx") { | |
| 152 script = "tools/create_google_admx.py" | |
| 153 inputs = [ | |
| 154 policy_templates_grd_file, | |
| 155 grit_info_script, | |
| 156 ] + policy_templates_windows_outputs | |
| 157 outputs = policy_templates_windows_google_outputs | |
| 158 deps = [ | |
| 159 ":grit_policy_templates", | |
| 160 ] | |
| 161 | |
| 162 # Don't pass in outputs directly, it would exceed a limit on Windows! | |
| 163 args = [ | |
| 164 "--basedir", | |
| 165 rebase_path(policy_templates_base_dir, root_build_dir), | |
| 166 "--grd_strip_path_prefix", | |
| 167 "app/policy/", | |
| 168 "--grd_input", | |
| 169 rebase_path(policy_templates_grd_file, root_build_dir), | |
| 170 "--grit_info", | |
| 171 rebase_path(grit_info_script, root_build_dir), | |
| 172 "-D", | |
| 173 "gen_policy_templates_win", | |
| 174 ] + grit_defines | |
| 175 } | |
| 176 } | |
| 177 | |
| 178 group("policy_templates") { | |
| 179 public_deps = [ | |
| 180 ":grit_policy_templates", | |
| 181 ] | |
| 182 if (gen_policy_templates_win && is_chrome_branded) { | |
| 183 public_deps += [ ":create_google_admx" ] | |
| 184 } | |
| 185 } | |
| 186 | |
| 187 # Run the proto compiler over the generated file and make it a component. | |
| 188 component("cloud_policy_proto_generated_compile") { | |
| 189 public_deps = [ | |
| 190 ":cloud_policy_proto_generated_compile_proto", | |
| 191 ] | |
| 192 } | |
| 193 proto_library("cloud_policy_proto_generated_compile_proto") { | |
| 194 visibility = [ ":cloud_policy_proto_generated_compile" ] | |
| 195 sources = [ | |
| 196 cloud_policy_proto_path, | |
| 197 ] | |
| 198 | |
| 199 proto_out_dir = "components/policy/proto" | |
| 200 cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:" | |
| 201 cc_include = "components/policy/proto/policy_proto_export.h" | |
| 202 component_build_force_source_set = true | |
| 203 defines = [ "POLICY_PROTO_COMPILATION" ] | |
| 204 | |
| 205 deps = [ | |
| 206 ":cloud_policy_code_generate", | |
| 207 ] | |
| 208 } | |
| 209 | |
| 210 # This target builds the "full" protobuf, used for tests only. | |
| 211 proto_library("chrome_settings_proto") { | |
| 212 testonly = true | |
| 213 sources = [ | |
| 214 chrome_settings_proto_path, | |
| 215 ] | |
| 216 proto_out_dir = "components/policy/proto" | |
| 217 | |
| 218 deps = [ | |
| 219 ":cloud_policy_code_generate", | |
| 220 ":cloud_policy_proto_generated_compile", | |
| 221 ] | |
| 222 } | |
| 223 | |
| 224 static_library("generated") { | |
| 225 sources = [ | |
| 226 constants_header_path, | |
| 227 constants_source_path, | |
| 228 protobuf_decoder_path, | |
| 229 risk_tag_header_path, | |
| 230 ] | |
| 231 | |
| 232 defines = [ "POLICY_COMPONENT_IMPLEMENTATION" ] | |
| 233 public_deps = [ | |
| 234 ":cloud_policy_code_generate", | |
| 235 ":cloud_policy_proto_generated_compile", | |
| 236 "//base", | |
| 237 "//third_party/protobuf:protobuf_lite", | |
| 238 ] | |
| 239 } | |
| 240 | |
| 241 if (gen_policy_templates_android && is_android) { | |
| 242 import("//build/config/android/rules.gni") | |
| 243 | |
| 244 _generated_resources_dir = "$root_gen_dir/chrome/app/policy/android" | |
| 245 | |
| 246 copy("app_restrictions_resources_copy") { | |
| 247 sources = [ | |
| 248 app_restrictions_path, | |
| 249 ] | |
| 250 outputs = [ | |
| 251 "$_generated_resources_dir/xml-v21/app_restrictions.xml", | |
| 252 ] | |
| 253 deps = [ | |
| 254 ":cloud_policy_code_generate", | |
| 255 ":policy_templates", | |
| 256 ] | |
| 257 } | |
| 258 | |
| 259 android_resources("app_restrictions_resources") { | |
| 260 resource_dirs = [] | |
| 261 generated_resource_dirs = [ | |
| 262 "$policy_templates_base_dir/android", | |
| 263 _generated_resources_dir, | |
| 264 ] | |
| 265 generated_resource_files = | |
| 266 policy_templates_android_outputs + | |
| 267 [ "$_generated_resources_dir/xml-v21/app_restrictions.xml" ] | |
| 268 deps = [ | |
| 269 ":app_restrictions_resources_copy", | |
| 270 ":grit_policy_templates", | |
| 271 ] | |
| 272 } | |
| 273 } else if (gen_policy_templates_mac && is_mac) { | |
| 274 action("convert_mcx_plist") { | |
| 275 script = "//build/config/mac/xcrun.py" | |
| 276 sources = [ | |
| 277 "$policy_templates_base_dir/mac/app-Manifest.plist", | |
| 278 ] | |
| 279 inputs = [ | |
| 280 script, | |
| 281 ] | |
| 282 outputs = [ | |
| 283 "$target_gen_dir/$chrome_mac_bundle_id.manifest", | |
| 284 ] | |
| 285 | |
| 286 if (use_system_xcode) { | |
| 287 args = [] | |
| 288 } else { | |
| 289 args = [ | |
| 290 "--developer_dir", | |
| 291 hermetic_xcode_path, | |
| 292 ] | |
| 293 } | |
| 294 args += [ | |
| 295 "plutil", | |
| 296 "-convert", | |
| 297 "xml1", | |
| 298 ] + rebase_path(sources, root_out_dir) + [ "-o" ] + | |
| 299 rebase_path(outputs, root_out_dir) | |
| 300 | |
| 301 deps = [ | |
| 302 ":policy_templates", | |
| 303 ] | |
| 304 } | |
| 305 | |
| 306 bundle_data("manifest_bundle_data") { | |
| 307 sources = get_target_outputs(":convert_mcx_plist") | |
| 308 outputs = [ | |
| 309 "{{bundle_resources_dir}}/{{source_file_part}}", | |
| 310 ] | |
| 311 public_deps = [ | |
| 312 ":convert_mcx_plist", | |
| 313 ] | |
| 314 } | |
| 315 | |
| 316 # The reason we are not enumerating all the locales is that | |
| 317 # the translations would eat up 3.5MB disk space in the | |
| 318 # application bundle. | |
| 319 bundle_data("manifest_strings_bundle_data") { | |
| 320 sources = [ | |
| 321 "$policy_templates_base_dir/mac/strings/en.lproj/Localizable.strings", | |
| 322 ] | |
| 323 outputs = [ | |
| 324 "{{bundle_resources_dir}}/en.lproj/{{source_file_part}}", | |
| 325 ] | |
| 326 public_deps = [ | |
| 327 ":policy_templates", | |
| 328 ] | |
| 329 } | |
| 330 | |
| 331 create_bundle("chrome_manifest_bundle") { | |
| 332 bundle_root_dir = "$root_out_dir/$chrome_mac_bundle_id.manifest/Contents" | |
| 333 bundle_resources_dir = "$bundle_root_dir/Resources" | |
| 334 | |
| 335 deps = [ | |
| 336 ":manifest_bundle_data", | |
| 337 ":manifest_strings_bundle_data", | |
| 338 ] | |
| 339 } | |
| 340 } | |
| 341 | |
| 342 if (gen_policy_templates_common && gen_policy_templates_win) { | |
| 343 version_file = "VERSION" | |
| 344 version_path = "$policy_templates_base_dir/$version_file" | |
| 345 | |
| 346 copy("add_version") { | |
| 347 sources = [ | |
| 348 "//chrome/VERSION", | |
| 349 ] | |
| 350 outputs = [ | |
| 351 version_path, | |
| 352 ] | |
| 353 } | |
| 354 | |
| 355 action("pack_policy_templates") { | |
| 356 output_zip_file = "$root_out_dir/policy_templates.zip" | |
| 357 script = "tools/make_policy_zip.py" | |
| 358 inputs = | |
| 359 [ | |
| 360 version_path, | |
| 361 policy_templates_grd_file, | |
| 362 grit_info_script, | |
| 363 ] + policy_templates_windows_outputs + policy_templates_doc_outputs | |
| 364 outputs = [ | |
| 365 output_zip_file, | |
| 366 ] | |
| 367 args = [ | |
| 368 "--output", | |
| 369 rebase_path(output_zip_file, root_build_dir), | |
| 370 "--basedir", | |
| 371 rebase_path(policy_templates_base_dir, root_build_dir), | |
| 372 "--grd_input", | |
| 373 rebase_path(policy_templates_grd_file, root_build_dir), | |
| 374 "--grd_strip_path_prefix", | |
| 375 "app/policy", | |
| 376 "--extra_input", | |
| 377 version_file, | |
| 378 "--grit_info", | |
| 379 rebase_path(grit_info_script, root_build_dir), | |
| 380 "-D", | |
| 381 "gen_policy_templates_common", | |
| 382 "-D", | |
| 383 "gen_policy_templates_win", | |
| 384 ] + grit_defines | |
| 385 if (is_chrome_branded) { | |
| 386 args += [ "--include_google_admx" ] | |
| 387 } | |
| 388 deps = [ | |
| 389 ":add_version", | |
| 390 ":policy_templates", | |
| 391 ] | |
| 392 } | |
| 393 } | |
| 394 } | |
| OLD | NEW |