1 # Copyright 2013 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 { 6 'includes': [ 7 # Included to get 'mac_bundle_id' and other variables. 8 '../build/chrome_settings.gypi', 9 ], 10 'variables': { 11 'chromium_code': 1, 12 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', 13 'policy_out_dir': '<(SHARED_INTERMEDIATE_DIR)/policy', 14 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out', 15 'generate_policy_source_script_path': 16 'policy/tools/generate_policy_source.py', 17 'policy_constant_header_path': 18 '<(policy_out_dir)/policy/policy_constants.h', 19 'policy_constant_source_path': 20 '<(policy_out_dir)/policy/policy_constants.cc', 21 'protobuf_decoder_path': 22 '<(policy_out_dir)/policy/cloud_policy_generated.cc', 23 # This is the "full" protobuf, which defines one protobuf message per 24 # policy. It is also the format currently used by the server. 25 'chrome_settings_proto_path': 26 '<(policy_out_dir)/policy/chrome_settings.proto', 27 # This protobuf is equivalent to chrome_settings.proto but shares messages 28 # for policies of the same type, so that less classes have to be generated 29 # and compiled. 30 'cloud_policy_proto_path': 31 '<(policy_out_dir)/policy/cloud_policy.proto', 32 }, 33 'targets': [ 34 { 35 'target_name': 'policy_component', 36 'type': '<(component)', 37 'dependencies': [ 38 '../base/base.gyp:base', 39 ], 40 'defines': [ 41 'POLICY_COMPONENT_IMPLEMENTATION', 42 ], 43 'include_dirs': [ 44 '..', 45 ], 46 'conditions': [ 47 ['configuration_policy==1', { 48 'dependencies': [ 49 '../base/base.gyp:base_prefs', 50 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 51 '../google_apis/google_apis.gyp:google_apis', 52 '../ui/ui.gyp:ui', 53 '../url/url.gyp:url_lib', 54 'component_strings.gyp:component_strings', 55 'cloud_policy_proto', 56 'json_schema', 57 'policy', 58 ], 59 'sources': [ 60 'policy/core/browser/cloud/message_util.cc', 61 'policy/core/browser/cloud/message_util.h', 62 'policy/core/browser/configuration_policy_handler.cc', 63 'policy/core/browser/configuration_policy_handler.h', 64 'policy/core/browser/configuration_policy_handler_list.cc', 65 'policy/core/browser/configuration_policy_handler_list.h', 66 'policy/core/browser/configuration_policy_pref_store.cc', 67 'policy/core/browser/configuration_policy_pref_store.h', 68 'policy/core/browser/policy_error_map.cc', 69 'policy/core/browser/policy_error_map.h', 70 'policy/core/common/cloud/cloud_external_data_manager.cc', 71 'policy/core/common/cloud/cloud_external_data_manager.h', 72 'policy/core/common/cloud/cloud_policy_client.cc', 73 'policy/core/common/cloud/cloud_policy_client.h', 74 'policy/core/common/cloud/cloud_policy_client_registration_helper.cc', 75 'policy/core/common/cloud/cloud_policy_client_registration_helper.h', 76 'policy/core/common/cloud/cloud_policy_constants.cc', 77 'policy/core/common/cloud/cloud_policy_constants.h', 78 'policy/core/common/cloud/cloud_policy_core.cc', 79 'policy/core/common/cloud/cloud_policy_core.h', 80 'policy/core/common/cloud/cloud_policy_manager.cc', 81 'policy/core/common/cloud/cloud_policy_manager.h', 82 'policy/core/common/cloud/cloud_policy_refresh_scheduler.cc', 83 'policy/core/common/cloud/cloud_policy_refresh_scheduler.h', 84 'policy/core/common/cloud/cloud_policy_service.cc', 85 'policy/core/common/cloud/cloud_policy_service.h', 86 'policy/core/common/cloud/cloud_policy_store.cc', 87 'policy/core/common/cloud/cloud_policy_store.h', 88 'policy/core/common/cloud/cloud_policy_validator.cc', 89 'policy/core/common/cloud/cloud_policy_validator.h', 90 'policy/core/common/cloud/component_cloud_policy_service.cc', 91 'policy/core/common/cloud/component_cloud_policy_service.h', 92 'policy/core/common/cloud/component_cloud_policy_store.cc', 93 'policy/core/common/cloud/component_cloud_policy_store.h', 94 'policy/core/common/cloud/component_cloud_policy_updater.cc', 95 'policy/core/common/cloud/component_cloud_policy_updater.h', 96 'policy/core/common/cloud/device_management_service.cc', 97 'policy/core/common/cloud/device_management_service.h', 98 'policy/core/common/cloud/enterprise_metrics.cc', 99 'policy/core/common/cloud/enterprise_metrics.h', 100 'policy/core/common/cloud/external_policy_data_fetcher.cc', 101 'policy/core/common/cloud/external_policy_data_fetcher.h', 102 'policy/core/common/cloud/external_policy_data_updater.cc', 103 'policy/core/common/cloud/external_policy_data_updater.h', 104 'policy/core/common/cloud/policy_header_io_helper.cc', 105 'policy/core/common/cloud/policy_header_io_helper.h', 106 'policy/core/common/cloud/policy_header_service.cc', 107 'policy/core/common/cloud/policy_header_service.h', 108 'policy/core/common/cloud/rate_limiter.cc', 109 'policy/core/common/cloud/rate_limiter.h', 110 'policy/core/common/cloud/resource_cache.cc', 111 'policy/core/common/cloud/resource_cache.h', 112 'policy/core/common/cloud/system_policy_request_context.cc', 113 'policy/core/common/cloud/system_policy_request_context.h', 114 'policy/core/common/cloud/user_cloud_policy_manager.cc', 115 'policy/core/common/cloud/user_cloud_policy_manager.h', 116 'policy/core/common/cloud/user_cloud_policy_store.cc', 117 'policy/core/common/cloud/user_cloud_policy_store.h', 118 'policy/core/common/cloud/user_cloud_policy_store_base.cc', 119 'policy/core/common/cloud/user_cloud_policy_store_base.h', 120 'policy/core/common/cloud/user_info_fetcher.cc', 121 'policy/core/common/cloud/user_info_fetcher.h', 122 'policy/core/common/cloud/user_policy_request_context.cc', 123 'policy/core/common/cloud/user_policy_request_context.h', 124 'policy/core/common/async_policy_loader.cc', 125 'policy/core/common/async_policy_loader.h', 126 'policy/core/common/async_policy_provider.cc', 127 'policy/core/common/async_policy_provider.h', 128 'policy/core/common/config_dir_policy_loader.cc', 129 'policy/core/common/config_dir_policy_loader.h', 130 'policy/core/common/configuration_policy_provider.cc', 131 'policy/core/common/configuration_policy_provider.h', 132 'policy/core/common/external_data_fetcher.cc', 133 'policy/core/common/external_data_fetcher.h', 134 'policy/core/common/external_data_manager.h', 135 'policy/core/common/forwarding_policy_provider.cc', 136 'policy/core/common/forwarding_policy_provider.h', 137 'policy/core/common/policy_bundle.cc', 138 'policy/core/common/policy_bundle.h', 139 'policy/core/common/policy_details.h', 140 'policy/core/common/policy_loader_mac.cc', 141 'policy/core/common/policy_loader_mac.h', 142 'policy/core/common/policy_loader_win.cc', 143 'policy/core/common/policy_loader_win.h', 144 'policy/core/common/policy_load_status.cc', 145 'policy/core/common/policy_load_status.h', 146 'policy/core/common/policy_map.cc', 147 'policy/core/common/policy_map.h', 148 'policy/core/common/policy_namespace.cc', 149 'policy/core/common/policy_namespace.h', 150 'policy/core/common/policy_pref_names.cc', 151 'policy/core/common/policy_pref_names.h', 152 'policy/core/common/policy_service.cc', 153 'policy/core/common/policy_service.h', 154 'policy/core/common/policy_service_impl.cc', 155 'policy/core/common/policy_service_impl.h', 156 'policy/core/common/policy_statistics_collector.cc', 157 'policy/core/common/policy_statistics_collector.h', 158 'policy/core/common/policy_switches.cc', 159 'policy/core/common/policy_switches.h', 160 'policy/core/common/policy_types.h', 161 'policy/core/common/preferences_mac.cc', 162 'policy/core/common/preferences_mac.h', 163 'policy/core/common/preg_parser_win.cc', 164 'policy/core/common/preg_parser_win.h', 165 'policy/core/common/registry_dict_win.cc', 166 'policy/core/common/registry_dict_win.h', 167 'policy/core/common/schema.cc', 168 'policy/core/common/schema.h', 169 'policy/core/common/schema_internal.h', 170 'policy/core/common/schema_map.cc', 171 'policy/core/common/schema_map.h', 172 'policy/core/common/schema_registry.cc', 173 'policy/core/common/schema_registry.h', 174 'policy/policy_export.h', 175 ], 176 'conditions': [ 177 ['OS=="android"', { 178 'sources': [ 179 'policy/core/common/cloud/component_cloud_policy_service_stub.cc', 180 ], 181 'sources!': [ 182 'policy/core/common/async_policy_loader.cc', 183 'policy/core/common/async_policy_loader.h', 184 'policy/core/common/async_policy_provider.cc', 185 'policy/core/common/async_policy_provider.h', 186 'policy/core/common/cloud/component_cloud_policy_service.cc', 187 'policy/core/common/cloud/component_cloud_policy_store.cc', 188 'policy/core/common/cloud/component_cloud_policy_store.h', 189 'policy/core/common/cloud/component_cloud_policy_updater.cc', 190 'policy/core/common/cloud/component_cloud_policy_updater.h', 191 'policy/core/common/cloud/external_policy_data_fetcher.cc', 192 'policy/core/common/cloud/external_policy_data_fetcher.h', 193 'policy/core/common/cloud/external_policy_data_updater.cc', 194 'policy/core/common/cloud/external_policy_data_updater.h', 195 'policy/core/common/cloud/resource_cache.cc', 196 'policy/core/common/cloud/resource_cache.h', 197 'policy/core/common/config_dir_policy_loader.cc', 198 'policy/core/common/config_dir_policy_loader.h', 199 'policy/core/common/policy_load_status.cc', 200 'policy/core/common/policy_load_status.h', 201 ], 202 }], 203 ['chromeos==1', { 204 'sources!': [ 205 'policy/core/common/cloud/cloud_policy_client_registration_helper.cc', 206 'policy/core/common/cloud/cloud_policy_client_registration_helper.h', 207 'policy/core/common/cloud/user_cloud_policy_manager.cc', 208 'policy/core/common/cloud/user_cloud_policy_manager.h', 209 'policy/core/common/cloud/user_cloud_policy_store.cc', 210 'policy/core/common/cloud/user_cloud_policy_store.h', 211 ], 212 }], 213 ], 214 }, { # configuration_policy==0 215 # Some of the policy code is always enabled, so that other parts of 216 # Chrome can always interface with the PolicyService without having 217 # to #ifdef on ENABLE_CONFIGURATION_POLICY. 218 'sources': [ 219 'policy/core/common/external_data_fetcher.h', 220 'policy/core/common/external_data_fetcher.cc', 221 'policy/core/common/external_data_manager.h', 222 'policy/core/common/policy_map.cc', 223 'policy/core/common/policy_map.h', 224 'policy/core/common/policy_namespace.cc', 225 'policy/core/common/policy_namespace.h', 226 'policy/core/common/policy_service.cc', 227 'policy/core/common/policy_service.h', 228 'policy/core/common/policy_service_stub.cc', 229 'policy/core/common/policy_service_stub.h', 230 ], 231 }], 232 ], 233 }, 234 ], 235 'conditions': [ 236 ['configuration_policy==1', { 237 'targets': [ 238 { 239 'target_name': 'cloud_policy_code_generate', 240 'type': 'none', 241 'actions': [ 242 { 243 'inputs': [ 244 'policy/resources/policy_templates.json', 245 '<(generate_policy_source_script_path)', 246 ], 247 'outputs': [ 248 '<(policy_constant_header_path)', 249 '<(policy_constant_source_path)', 250 '<(protobuf_decoder_path)', 251 '<(chrome_settings_proto_path)', 252 '<(cloud_policy_proto_path)', 253 ], 254 'action_name': 'generate_policy_source', 255 'action': [ 256 'python', 257 '<@(generate_policy_source_script_path)', 258 '--policy-constants-header=<(policy_constant_header_path)', 259 '--policy-constants-source=<(policy_constant_source_path)', 260 '--chrome-settings-protobuf=<(chrome_settings_proto_path)', 261 '--cloud-policy-protobuf=<(cloud_policy_proto_path)', 262 '--cloud-policy-decoder=<(protobuf_decoder_path)', 263 '<(OS)', 264 '<(chromeos)', 265 'policy/resources/policy_templates.json', 266 ], 267 'message': 'Generating policy source', 268 }, 269 ], 270 'direct_dependent_settings': { 271 'include_dirs': [ 272 '<(policy_out_dir)', 273 '<(protoc_out_dir)', 274 ], 275 }, 276 }, 277 { 278 'target_name': 'cloud_policy_proto_generated_compile', 279 'type': 'static_library', 280 'sources': [ 281 '<(cloud_policy_proto_path)', 282 ], 283 'variables': { 284 'proto_in_dir': '<(policy_out_dir)/policy', 285 'proto_out_dir': 'policy/proto', 286 }, 287 'dependencies': [ 288 'cloud_policy_code_generate', 289 ], 290 'includes': [ 291 '../build/protoc.gypi', 292 ], 293 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 294 'msvs_disabled_warnings': [4267, ], 295 }, 296 { 297 # This target builds the "full" protobuf, used for tests only. 298 'target_name': 'chrome_settings_proto_generated_compile', 299 'type': 'static_library', 300 'sources': [ 301 '<(chrome_settings_proto_path)', 302 ], 303 'variables': { 304 'proto_in_dir': '<(policy_out_dir)/policy', 305 'proto_out_dir': 'policy/proto', 306 }, 307 'dependencies': [ 308 'cloud_policy_code_generate', 309 'cloud_policy_proto_generated_compile', 310 ], 311 'includes': [ 312 '../build/protoc.gypi', 313 ], 314 }, 315 { 316 'target_name': 'policy', 317 'type': 'static_library', 318 'hard_dependency': 1, 319 'direct_dependent_settings': { 320 'include_dirs': [ 321 '<(policy_out_dir)', 322 '<(protoc_out_dir)', 323 ], 324 }, 325 'sources': [ 326 '<(policy_constant_header_path)', 327 '<(policy_constant_source_path)', 328 '<(protobuf_decoder_path)', 329 ], 330 'include_dirs': [ 331 '<(DEPTH)', 332 ], 333 'dependencies': [ 334 'cloud_policy_code_generate', 335 'cloud_policy_proto_generated_compile', 336 '<(DEPTH)/base/base.gyp:base', 337 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', 338 ], 339 'defines': [ 340 'POLICY_COMPONENT_IMPLEMENTATION', 341 ], 342 }, 343 { 344 'target_name': 'cloud_policy_proto', 345 'type': 'static_library', 346 'sources': [ 347 'policy/proto/chrome_extension_policy.proto', 348 'policy/proto/device_management_backend.proto', 349 'policy/proto/device_management_local.proto', 350 ], 351 'variables': { 352 'proto_in_dir': 'policy/proto', 353 'proto_out_dir': 'policy/proto', 354 }, 355 'includes': [ 356 '../build/protoc.gypi', 357 ], 358 'conditions': [ 359 ['OS=="android"', { 360 'sources!': [ 361 'policy/proto/chrome_extension_policy.proto', 362 ], 363 }], 364 ['chromeos==0', { 365 'sources!': [ 366 'policy/proto/device_management_local.proto', 367 ], 368 }], 369 ], 370 }, 371 { 372 'target_name': 'policy_test_support', 373 'type': 'none', 374 'hard_dependency': 1, 375 'direct_dependent_settings': { 376 'include_dirs': [ 377 '<(policy_out_dir)', 378 '<(protoc_out_dir)', 379 ], 380 }, 381 'dependencies': [ 382 'chrome_settings_proto_generated_compile', 383 'policy', 384 ], 385 }, 386 { 387 'target_name': 'policy_component_test_support', 388 'type': 'static_library', 389 # This must be undefined so that POLICY_EXPORT works correctly in 390 # the static_library build. 391 'defines!': [ 392 'POLICY_COMPONENT_IMPLEMENTATION', 393 ], 394 'dependencies': [ 395 'cloud_policy_proto', 396 'policy_component', 397 'policy_test_support', 398 '../testing/gmock.gyp:gmock', 399 '../testing/gtest.gyp:gtest', 400 ], 401 'include_dirs': [ 402 '..', 403 ], 404 'sources': [ 405 'policy/core/common/cloud/mock_cloud_external_data_manager.cc', 406 'policy/core/common/cloud/mock_cloud_external_data_manager.h', 407 'policy/core/common/cloud/mock_cloud_policy_client.cc', 408 'policy/core/common/cloud/mock_cloud_policy_client.h', 409 'policy/core/common/cloud/mock_cloud_policy_store.cc', 410 'policy/core/common/cloud/mock_cloud_policy_store.h', 411 'policy/core/common/cloud/mock_device_management_service.cc', 412 'policy/core/common/cloud/mock_device_management_service.h', 413 'policy/core/common/cloud/mock_user_cloud_policy_store.cc', 414 'policy/core/common/cloud/mock_user_cloud_policy_store.h', 415 'policy/core/common/cloud/policy_builder.cc', 416 'policy/core/common/cloud/policy_builder.h', 417 'policy/core/common/configuration_policy_provider_test.cc', 418 'policy/core/common/configuration_policy_provider_test.h', 419 'policy/core/common/mock_configuration_policy_provider.cc', 420 'policy/core/common/mock_configuration_policy_provider.h', 421 'policy/core/common/mock_policy_service.cc', 422 'policy/core/common/mock_policy_service.h', 423 'policy/core/common/policy_test_utils.cc', 424 'policy/core/common/policy_test_utils.h', 425 'policy/core/common/preferences_mock_mac.cc', 426 'policy/core/common/preferences_mock_mac.h', 427 ], 428 'conditions': [ 429 ['chromeos==1', { 430 'sources!': [ 431 'policy/core/common/cloud/mock_user_cloud_policy_store.cc', 432 'policy/core/common/cloud/mock_user_cloud_policy_store.h', 433 ], 434 }], 435 ], 436 }, 437 ], 438 }], 439 ['OS=="win" and target_arch=="ia32" and configuration_policy==1', { 440 'targets': [ 441 { 442 'target_name': 'policy_win64', 443 'type': 'static_library', 444 'hard_dependency': 1, 445 'sources': [ 446 '<(policy_constant_header_path)', 447 '<(policy_constant_source_path)', 448 ], 449 'include_dirs': [ 450 '<(DEPTH)', 451 ], 452 'direct_dependent_settings': { 453 'include_dirs': [ 454 '<(policy_out_dir)' 455 ], 456 }, 457 'dependencies': [ 458 'cloud_policy_code_generate', 459 ], 460 'configurations': { 461 'Common_Base': { 462 'msvs_target_platform': 'x64', 463 }, 464 }, 465 }, 466 ], 467 }], 468 ['OS=="win" or OS=="mac" or OS=="linux"', { 469 'targets': [ 470 { 471 # policy_templates has different inputs and outputs, so it can't use 472 # the rules of chrome_strings 473 'target_name': 'policy_templates', 474 'type': 'none', 475 'variables': { 476 'grit_grd_file': 'policy/resources/policy_templates.grd', 477 'grit_info_cmd': [ 478 'python', 479 '<(DEPTH)/tools/grit/grit_info.py', 480 '<@(grit_defines)', 481 ], 482 }, 483 'includes': [ 484 '../build/grit_target.gypi', 485 ], 486 'actions': [ 487 { 488 'action_name': 'policy_templates', 489 'includes': [ 490 '../build/grit_action.gypi', 491 ], 492 }, 493 ], 494 }, 495 ], 496 }], 497 ['OS=="mac"', { 498 'targets': [ 499 { 500 # This is the bundle of the manifest file of Chrome. 501 # It contains the manifest file and its string tables. 502 'target_name': 'chrome_manifest_bundle', 503 'type': 'loadable_module', 504 'mac_bundle': 1, 505 'product_extension': 'manifest', 506 'product_name': '<(mac_bundle_id)', 507 'variables': { 508 # This avoids stripping debugging symbols from the target, which 509 # would fail because there is no binary code here. 510 'mac_strip': 0, 511 }, 512 'dependencies': [ 513 # Provides app-Manifest.plist and its string tables: 514 'policy_templates', 515 ], 516 'actions': [ 517 { 518 'action_name': 'Copy MCX manifest file to manifest bundle', 519 'inputs': [ 520 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist', 521 ], 522 'outputs': [ 523 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest', 524 ], 525 'action': [ 526 # Use plutil -convert xml1 to put the plist into Apple's 527 # canonical format. As a side effect, this ensures that the 528 # plist is well-formed. 529 'plutil', 530 '-convert', 531 'xml1', 532 '<@(_inputs)', 533 '-o', 534 '<@(_outputs)', 535 ], 536 'message': 537 'Copying the MCX policy manifest file to the manifest bundle', 538 'process_outputs_as_mac_bundle_resources': 1, 539 }, 540 { 541 'action_name': 542 'Copy Localizable.strings files to manifest bundle', 543 'variables': { 544 'input_path': '<(grit_out_dir)/app/policy/mac/strings', 545 # Directory to collect the Localizable.strings files before 546 # they are copied to the bundle. 547 'output_path': '<(INTERMEDIATE_DIR)/app_manifest', 548 # The reason we are not enumerating all the locales is that 549 # the translations would eat up 3.5MB disk space in the 550 # application bundle: 551 'available_locales': 'en', 552 }, 553 'inputs': [ 554 # TODO: remove this helper when we have loops in GYP 555 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', 556 ], 557 'outputs': [ 558 # TODO: remove this helper when we have loops in GYP 559 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', 560 ], 561 'action': [ 562 'cp', '-R', 563 '<(input_path)/', 564 '<(output_path)', 565 ], 566 'message': 567 'Copy the Localizable.strings files to the manifest bundle', 568 'process_outputs_as_mac_bundle_resources': 1, 569 'msvs_cygwin_shell': 1, 570 }, 571 ], 572 }, 573 ], 574 }], 575 ], 576 } 577