Index: components/policy.gypi |
diff --git a/components/policy.gypi b/components/policy.gypi |
index a69a1f1ccbbd91d47d8d19552bb3afc0f65a2aca..5d65765bcbdf9c9774c885dc0cad5f6eb79a604a 100644 |
--- a/components/policy.gypi |
+++ b/components/policy.gypi |
@@ -3,8 +3,139 @@ |
# found in the LICENSE file. |
{ |
+ 'includes': [ |
+ # Included to get 'mac_bundle_id' and other variables. |
+ '../build/chrome_settings.gypi', |
+ ], |
+ 'variables': { |
+ 'chromium_code': 1, |
+ 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', |
+ 'policy_out_dir': '<(SHARED_INTERMEDIATE_DIR)/policy', |
+ 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out', |
+ 'generate_policy_source_script_path': |
+ 'policy/tools/generate_policy_source.py', |
+ 'policy_constant_header_path': |
+ '<(policy_out_dir)/policy/policy_constants.h', |
+ 'policy_constant_source_path': |
+ '<(policy_out_dir)/policy/policy_constants.cc', |
+ 'protobuf_decoder_path': |
+ '<(policy_out_dir)/policy/cloud_policy_generated.cc', |
+ # This is the "full" protobuf, which defines one protobuf message per |
+ # policy. It is also the format currently used by the server. |
+ 'chrome_settings_proto_path': |
+ '<(policy_out_dir)/policy/chrome_settings.proto', |
+ # This protobuf is equivalent to chrome_settings.proto but shares messages |
+ # for policies of the same type, so that less classes have to be generated |
+ # and compiled. |
+ 'cloud_policy_proto_path': |
+ '<(policy_out_dir)/policy/cloud_policy.proto', |
+ }, |
'targets': [ |
{ |
+ 'target_name': 'cloud_policy_code_generate', |
+ 'type': 'none', |
+ 'actions': [ |
+ { |
+ 'inputs': [ |
+ 'policy/resources/policy_templates.json', |
+ '<(generate_policy_source_script_path)', |
+ ], |
+ 'outputs': [ |
+ '<(policy_constant_header_path)', |
+ '<(policy_constant_source_path)', |
+ '<(protobuf_decoder_path)', |
+ '<(chrome_settings_proto_path)', |
+ '<(cloud_policy_proto_path)', |
+ ], |
+ 'action_name': 'generate_policy_source', |
+ 'action': [ |
+ 'python', |
+ '<@(generate_policy_source_script_path)', |
+ '--policy-constants-header=<(policy_constant_header_path)', |
+ '--policy-constants-source=<(policy_constant_source_path)', |
+ '--chrome-settings-protobuf=<(chrome_settings_proto_path)', |
+ '--cloud-policy-protobuf=<(cloud_policy_proto_path)', |
+ '--cloud-policy-decoder=<(protobuf_decoder_path)', |
+ '<(OS)', |
+ '<(chromeos)', |
+ 'policy/resources/policy_templates.json', |
+ ], |
+ 'message': 'Generating policy source', |
+ }, |
+ ], |
+ 'direct_dependent_settings': { |
+ 'include_dirs': [ |
+ '<(policy_out_dir)', |
+ '<(protoc_out_dir)', |
+ ], |
+ }, |
+ }, |
+ { |
+ 'target_name': 'cloud_policy_proto_generated_compile', |
+ 'type': 'static_library', |
+ 'sources': [ |
+ '<(cloud_policy_proto_path)', |
+ ], |
+ 'variables': { |
+ 'proto_in_dir': '<(policy_out_dir)/policy', |
+ 'proto_out_dir': 'policy/proto', |
+ }, |
+ 'dependencies': [ |
+ 'cloud_policy_code_generate', |
+ ], |
+ 'includes': [ |
+ '../build/protoc.gypi', |
+ ], |
+ # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. |
+ 'msvs_disabled_warnings': [4267, ], |
+ }, |
+ { |
+ # This target builds the "full" protobuf, used for tests only. |
+ 'target_name': 'chrome_settings_proto_generated_compile', |
+ 'type': 'static_library', |
+ 'sources': [ |
+ '<(chrome_settings_proto_path)', |
+ ], |
+ 'variables': { |
+ 'proto_in_dir': '<(policy_out_dir)/policy', |
+ 'proto_out_dir': 'policy/proto', |
+ }, |
+ 'dependencies': [ |
+ 'cloud_policy_code_generate', |
+ 'cloud_policy_proto_generated_compile', |
+ ], |
+ 'includes': [ |
+ '../build/protoc.gypi', |
+ ], |
+ }, |
+ { |
+ # TODO: consider merging with policy_component |
+ # Maybe use 'export_dependent_settings' to make it easier |
Joao da Silva
2013/12/12 08:27:02
Meh, forgot to remove these comments to self; I'll
Mattias Nissler (ping if slow)
2013/12/12 14:11:38
FWIW, if this gets built even if configuratin_poli
Joao da Silva
2013/12/12 14:53:23
Agreed. Let's leave it for another CL to reduce ri
|
+ 'target_name': 'policy', |
Mattias Nissler (ping if slow)
2013/12/12 14:11:38
It'd be great if we could rename this to policy_co
Joao da Silva
2013/12/12 14:53:23
SGTM. If this gets merged into policy_component th
|
+ 'type': 'static_library', |
+ 'hard_dependency': 1, |
+ 'direct_dependent_settings': { |
+ 'include_dirs': [ |
+ '<(policy_out_dir)', |
+ '<(protoc_out_dir)', |
+ ], |
+ }, |
+ 'sources': [ |
+ '<(policy_constant_header_path)', |
+ '<(policy_constant_source_path)', |
+ '<(protobuf_decoder_path)', |
+ ], |
+ 'include_dirs': [ |
+ '<(DEPTH)', |
+ ], |
+ 'dependencies': [ |
+ 'cloud_policy_code_generate', |
+ 'cloud_policy_proto_generated_compile', |
+ '<(DEPTH)/base/base.gyp:base', |
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
+ ], |
+ }, |
+ { |
'target_name': 'policy_component', |
'type': '<(component)', |
'dependencies': [ |
@@ -21,14 +152,13 @@ |
'dependencies': [ |
'../base/base.gyp:base_prefs', |
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', |
- # TODO(joaodasilva): remove this dependency on the user policy protobuf. |
- '../chrome/app/policy/cloud_policy_codegen.gyp:policy', |
'../google_apis/google_apis.gyp:google_apis', |
'../ui/ui.gyp:ui', |
'../url/url.gyp:url_lib', |
'component_strings.gyp:component_strings', |
'cloud_policy_proto', |
'json_schema', |
+ 'policy', |
], |
'sources': [ |
'policy/core/browser/cloud/message_util.cc', |
@@ -215,7 +345,9 @@ |
'proto_in_dir': 'policy/proto', |
'proto_out_dir': 'policy/proto', |
}, |
- 'includes': [ '../build/protoc.gypi' ], |
+ 'includes': [ |
+ '../build/protoc.gypi', |
+ ], |
'conditions': [ |
['OS=="android"', { |
'sources!': [ |
@@ -229,8 +361,53 @@ |
}], |
], |
}, |
+ { |
+ # TODO: consider merging with policy_component_test_support |
Joao da Silva
2013/12/12 08:27:02
Same logic here
Mattias Nissler (ping if slow)
2013/12/12 14:11:38
I think in this case, it might be simpler to just
Joao da Silva
2013/12/12 14:53:23
Removed the comment.
|
+ 'target_name': 'policy_test_support', |
+ 'type': 'none', |
+ 'hard_dependency': 1, |
+ 'direct_dependent_settings': { |
+ 'include_dirs': [ |
+ '<(policy_out_dir)', |
+ '<(protoc_out_dir)', |
+ ], |
+ }, |
+ 'dependencies': [ |
+ 'chrome_settings_proto_generated_compile', |
+ 'policy', |
+ ], |
+ }, |
], |
'conditions': [ |
+ ['OS=="win" and target_arch=="ia32"', { |
+ 'targets': [ |
+ { |
+ 'target_name': 'policy_win64', |
Mattias Nissler (ping if slow)
2013/12/12 14:11:38
If you rename the other one, this should be policy
Joao da Silva
2013/12/12 14:53:23
ack
|
+ 'type': 'static_library', |
+ 'hard_dependency': 1, |
+ 'sources': [ |
+ '<(policy_constant_header_path)', |
+ '<(policy_constant_source_path)', |
+ ], |
+ 'include_dirs': [ |
+ '<(DEPTH)', |
+ ], |
+ 'direct_dependent_settings': { |
+ 'include_dirs': [ |
+ '<(policy_out_dir)' |
+ ], |
+ }, |
+ 'dependencies': [ |
+ 'cloud_policy_code_generate', |
+ ], |
+ 'configurations': { |
+ 'Common_Base': { |
+ 'msvs_target_platform': 'x64', |
+ }, |
+ }, |
+ }, |
+ ], |
+ }], |
['configuration_policy==1', { |
'targets': [ |
{ |
@@ -242,10 +419,9 @@ |
'POLICY_COMPONENT_IMPLEMENTATION', |
], |
'dependencies': [ |
- # TODO(joaodasilva): remove this dependency. |
- '../chrome/app/policy/cloud_policy_codegen.gyp:policy_test_support', |
'cloud_policy_proto', |
'policy_component', |
+ 'policy_test_support', |
'../testing/gmock.gyp:gmock', |
'../testing/gtest.gyp:gtest', |
], |
@@ -287,5 +463,179 @@ |
}, |
], |
}], |
+ ['OS=="win" or OS=="mac" or OS=="linux"', { |
+ 'targets': [ |
+ { |
+ # policy_templates has different inputs and outputs, so it can't use |
+ # the rules of chrome_strings |
+ 'target_name': 'policy_templates', |
+ 'type': 'none', |
+ 'variables': { |
+ 'grit_grd_file': 'policy/resources/policy_templates.grd', |
+ 'grit_info_cmd': [ |
+ 'python', |
+ '<(DEPTH)/tools/grit/grit_info.py', |
+ '<@(grit_defines)', |
+ ], |
+ }, |
+ 'includes': [ |
+ '../build/grit_target.gypi', |
+ ], |
+ 'actions': [ |
+ { |
+ 'action_name': 'policy_templates', |
+ 'includes': [ |
+ '../build/grit_action.gypi', |
+ ], |
+ }, |
+ ], |
+ 'conditions': [ |
+ ['OS=="win"', { |
+ 'variables': { |
+ 'version_path': '<(grit_out_dir)/app/policy/VERSION', |
+ 'template_files': [ |
+ '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))', |
+ ], |
+ }, |
+ 'actions': [ |
+ { |
+ 'action_name': 'add_version', |
+ 'inputs': [ |
+ '../chrome/VERSION', |
Mattias Nissler (ping if slow)
2013/12/12 14:11:38
is this OK to have as dependency in a component?
Joao da Silva
2013/12/12 14:53:23
Good catch.
This certainly works, and we can add
|
+ ], |
+ 'outputs': [ |
+ '<(version_path)', |
+ ], |
+ 'action': [ |
+ 'cp', |
+ '<@(_inputs)', |
+ '<@(_outputs)', |
+ ], |
+ 'msvs_cygwin_shell': 1, |
+ }, |
+ { |
+ # Add all the templates generated at the previous step into |
+ # a zip archive. |
+ 'action_name': 'pack_templates', |
+ 'variables': { |
+ 'zip_script': 'policy/tools/make_policy_zip.py', |
+ }, |
+ 'inputs': [ |
+ '<(version_path)', |
+ '<@(template_files)', |
+ '<(zip_script)', |
+ ], |
+ 'outputs': [ |
+ '<(PRODUCT_DIR)/policy_templates.zip', |
+ ], |
+ 'action': [ |
+ 'python', |
+ '<(zip_script)', |
+ '--output', |
+ '<@(_outputs)', |
+ '--basedir', '<(grit_out_dir)/app/policy', |
+ # The list of files in the destination zip is derived from |
+ # the list of output nodes in the following grd file. |
+ # This whole trickery is necessary because we cannot pass |
+ # the entire list of file names as command line arguments, |
+ # because they would exceed the length limit on Windows. |
+ '--grd_input', |
+ '<(grit_grd_file)', |
+ '--grd_strip_path_prefix', |
+ 'app/policy', |
+ '--extra_input', |
+ 'VERSION', |
+ # Module to be used to process grd_input'. |
+ '--grit_info', |
+ '<(DEPTH)/tools/grit/grit_info.py', |
+ '<@(grit_defines)', |
+ ], |
+ 'message': 'Packing generated templates into <(_outputs)', |
+ 'msvs_cygwin_shell': 1, |
Joao da Silva
2013/12/12 08:27:02
This breaks the presubmit scripts but can be safel
|
+ } |
+ ] |
+ }], |
+ ], |
+ }, |
+ ], |
+ }], |
+ ['OS=="mac"', { |
+ 'targets': [ |
+ { |
+ # This is the bundle of the manifest file of Chrome. |
+ # It contains the manifest file and its string tables. |
+ 'target_name': 'chrome_manifest_bundle', |
+ 'type': 'loadable_module', |
+ 'mac_bundle': 1, |
+ 'product_extension': 'manifest', |
+ 'product_name': '<(mac_bundle_id)', |
+ 'variables': { |
+ # This avoids stripping debugging symbols from the target, which |
+ # would fail because there is no binary code here. |
+ 'mac_strip': 0, |
+ }, |
+ 'dependencies': [ |
+ # Provides app-Manifest.plist and its string tables: |
+ 'policy_templates', |
+ ], |
+ 'actions': [ |
+ { |
+ 'action_name': 'Copy MCX manifest file to manifest bundle', |
+ 'inputs': [ |
+ '<(grit_out_dir)/app/policy/mac/app-Manifest.plist', |
+ ], |
+ 'outputs': [ |
+ '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest', |
+ ], |
+ 'action': [ |
+ # Use plutil -convert xml1 to put the plist into Apple's |
+ # canonical format. As a side effect, this ensures that the |
+ # plist is well-formed. |
+ 'plutil', |
+ '-convert', |
+ 'xml1', |
+ '<@(_inputs)', |
+ '-o', |
+ '<@(_outputs)', |
+ ], |
+ 'message': |
+ 'Copying the MCX policy manifest file to the manifest bundle', |
+ 'process_outputs_as_mac_bundle_resources': 1, |
+ }, |
+ { |
+ 'action_name': |
+ 'Copy Localizable.strings files to manifest bundle', |
+ 'variables': { |
+ 'input_path': '<(grit_out_dir)/app/policy/mac/strings', |
+ # Directory to collect the Localizable.strings files before |
+ # they are copied to the bundle. |
+ 'output_path': '<(INTERMEDIATE_DIR)/app_manifest', |
+ # The reason we are not enumerating all the locales is that |
+ # the translations would eat up 3.5MB disk space in the |
+ # application bundle: |
+ 'available_locales': 'en', |
+ }, |
+ 'inputs': [ |
+ # TODO: remove this helper when we have loops in GYP |
+ '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', |
+ ], |
+ 'outputs': [ |
+ # TODO: remove this helper when we have loops in GYP |
+ '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', |
+ ], |
+ 'action': [ |
+ 'cp', '-R', |
+ '<(input_path)/', |
+ '<(output_path)', |
+ ], |
+ 'message': |
+ 'Copy the Localizable.strings files to the manifest bundle', |
+ 'process_outputs_as_mac_bundle_resources': 1, |
+ 'msvs_cygwin_shell': 1, |
+ }, |
+ ], |
+ }, |
+ ] |
+ }] |
], |
} |