Add host_info step to new android bots.
[chromium-blink-merge.git] / components / policy.gypi
blob2a6aee44eb40352a207344bf75e4245b980b6e4a
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.
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     'app_restrictions_path':
24         '<(policy_out_dir)/app_restrictions.xml',
25     # This is the "full" protobuf, which defines one protobuf message per
26     # policy. It is also the format currently used by the server.
27     'chrome_settings_proto_path':
28         '<(policy_out_dir)/policy/chrome_settings.proto',
29     # This protobuf is equivalent to chrome_settings.proto but shares messages
30     # for policies of the same type, so that less classes have to be generated
31     # and compiled.
32     'cloud_policy_proto_path':
33         '<(policy_out_dir)/policy/cloud_policy.proto',
34   },
35   'conditions': [
36     ['component=="static_library"', {
37       'targets': [
38         {
39           # GN version: //components/policy:policy_component
40           'target_name': 'policy_component',
41           'type': 'none',
42           'dependencies': [
43             'policy_component_common',
44             'policy_component_browser',
45           ],
46         },
47         {
48           # GN version: //components/policy:policy_component_common
49           'target_name': 'policy_component_common',
50           'type': 'static_library',
51           'includes': [
52             'policy/policy_common.gypi',
53           ],
54         },
55         {
56           # GN version: //components/policy:policy_component_browser
57           'target_name': 'policy_component_browser',
58           'type': 'static_library',
59           'dependencies': [
60             'policy_component_common',
61           ],
62           'includes': [
63             'policy/policy_browser.gypi',
64           ],
65         },
66       ],
67     }, {  # component=="shared_library"
68       'targets': [
69         {
70           # GN version: //components/policy:policy_component
71           'target_name': 'policy_component',
72           'type': 'shared_library',
73           'includes': [
74             'policy/policy_common.gypi',
75             'policy/policy_browser.gypi',
76           ],
77         },
78         {
79           # GN version: //components/policy:policy_component_common
80           'target_name': 'policy_component_common',
81           'type': 'none',
82           'dependencies': [
83             'policy_component',
84           ],
85         },
86         {
87           # GN version: //components/policy:policy_component_browser
88           'target_name': 'policy_component_browser',
89           'type': 'none',
90           'dependencies': [
91             'policy_component',
92           ],
93         },
94       ],
95     }],
96     ['configuration_policy==1', {
97       'targets': [
98         {
99           # GN version: //components/policy:cloud_policy_code_generate
100           'target_name': 'cloud_policy_code_generate',
101           'type': 'none',
102           'actions': [
103             {
104               'inputs': [
105                 'policy/resources/policy_templates.json',
106                 '<(generate_policy_source_script_path)',
107               ],
108               'outputs': [
109                 '<(policy_constant_header_path)',
110                 '<(policy_constant_source_path)',
111                 '<(protobuf_decoder_path)',
112                 '<(chrome_settings_proto_path)',
113                 '<(cloud_policy_proto_path)',
114                 '<(app_restrictions_path)',
115               ],
116               'action_name': 'generate_policy_source',
117               'action': [
118                 'python',
119                 '<@(generate_policy_source_script_path)',
120                 '--policy-constants-header=<(policy_constant_header_path)',
121                 '--policy-constants-source=<(policy_constant_source_path)',
122                 '--chrome-settings-protobuf=<(chrome_settings_proto_path)',
123                 '--cloud-policy-protobuf=<(cloud_policy_proto_path)',
124                 '--cloud-policy-decoder=<(protobuf_decoder_path)',
125                 '--app-restrictions-definition=<(app_restrictions_path)',
126                 '<(OS)',
127                 '<(chromeos)',
128                 'policy/resources/policy_templates.json',
129               ],
130               'message': 'Generating policy source',
131               'conditions': [
132                 ['OS!="android"', {
133                   'outputs!': [
134                     '<(app_restrictions_path)',
135                   ],
136                 }],
137               ],
138             },
139           ],
140           'direct_dependent_settings': {
141             'include_dirs': [
142               '<(policy_out_dir)',
143               '<(protoc_out_dir)',
144             ],
145           },
146         },
147         {
148           # GN version: //components/policy:cloud_policy_proto_generated_compile
149           'target_name': 'cloud_policy_proto_generated_compile',
150           'type': '<(component)',
151           'sources': [
152             '<(cloud_policy_proto_path)',
153           ],
154           'variables': {
155             'proto_in_dir': '<(policy_out_dir)/policy',
156             'proto_out_dir': 'policy/proto',
157             'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:',
158             'cc_include': 'components/policy/policy_proto_export.h',
159           },
160           'dependencies': [
161             'cloud_policy_code_generate',
162           ],
163           'includes': [
164             '../build/protoc.gypi',
165           ],
166           'defines': [
167             'POLICY_PROTO_COMPILATION',
168           ],
169           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
170           'msvs_disabled_warnings': [4267, ],
171         },
172         {
173           # This target builds the "full" protobuf, used for tests only.
174           # GN version: //components/policy:chrome_settings_proto_generated_compile
175           'target_name': 'chrome_settings_proto_generated_compile',
176           'type': 'static_library',
177           'sources': [
178             '<(chrome_settings_proto_path)',
179           ],
180           'variables': {
181             'proto_in_dir': '<(policy_out_dir)/policy',
182             'proto_out_dir': 'policy/proto',
183           },
184           'dependencies': [
185             'cloud_policy_code_generate',
186             'cloud_policy_proto_generated_compile',
187           ],
188           'includes': [
189             '../build/protoc.gypi',
190           ],
191         },
192         {
193           # GN version: //components/policy
194           'target_name': 'policy',
195           'type': 'static_library',
196           'hard_dependency': 1,
197           'direct_dependent_settings': {
198             'include_dirs': [
199               '<(policy_out_dir)',
200               '<(protoc_out_dir)',
201             ],
202           },
203           'sources': [
204             '<(policy_constant_header_path)',
205             '<(policy_constant_source_path)',
206             '<(protobuf_decoder_path)',
207           ],
208           'include_dirs': [
209             '<(DEPTH)',
210           ],
211           'dependencies': [
212             'cloud_policy_code_generate',
213             'cloud_policy_proto_generated_compile',
214             '<(DEPTH)/base/base.gyp:base',
215             '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
216           ],
217           'defines': [
218             'POLICY_COMPONENT_IMPLEMENTATION',
219           ],
220         },
221         {
222           # GN version: //components/policy/proto
223           'target_name': 'cloud_policy_proto',
224           'type': '<(component)',
225           'sources': [
226             'policy/proto/chrome_extension_policy.proto',
227             'policy/proto/device_management_backend.proto',
228             'policy/proto/device_management_local.proto',
229             'policy/proto/policy_signing_key.proto',
230           ],
231           'variables': {
232             'proto_in_dir': 'policy/proto',
233             'proto_out_dir': 'policy/proto',
234             'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:',
235             'cc_include': 'components/policy/policy_proto_export.h',
236           },
237           'includes': [
238             '../build/protoc.gypi',
239           ],
240           'conditions': [
241             ['OS=="android" or OS=="ios"', {
242               'sources!': [
243                 'policy/proto/chrome_extension_policy.proto',
244               ],
245             }],
246             ['chromeos==0', {
247               'sources!': [
248                 'policy/proto/device_management_local.proto',
249               ],
250             }],
251           ],
252           'defines': [
253             'POLICY_PROTO_COMPILATION',
254           ],
255         },
256         {
257           # GN version: //components/policy:test_support
258           'target_name': 'policy_test_support',
259           'type': 'none',
260           'hard_dependency': 1,
261           'direct_dependent_settings': {
262             'include_dirs': [
263               '<(policy_out_dir)',
264               '<(protoc_out_dir)',
265             ],
266           },
267           'dependencies': [
268             'chrome_settings_proto_generated_compile',
269             'policy',
270           ],
271         },
272         {
273           # GN version: //components/policy:policy_component_test_support
274           'target_name': 'policy_component_test_support',
275           'type': 'static_library',
276           # This must be undefined so that POLICY_EXPORT works correctly in
277           # the static_library build.
278           'defines!': [
279             'POLICY_COMPONENT_IMPLEMENTATION',
280           ],
281           'dependencies': [
282             'cloud_policy_proto',
283             'policy_component',
284             'policy_test_support',
285             '../testing/gmock.gyp:gmock',
286             '../testing/gtest.gyp:gtest',
287           ],
288           'include_dirs': [
289             '..',
290           ],
291           'sources': [
292             'policy/core/browser/configuration_policy_pref_store_test.cc',
293             'policy/core/browser/configuration_policy_pref_store_test.h',
294             'policy/core/common/cloud/mock_cloud_external_data_manager.cc',
295             'policy/core/common/cloud/mock_cloud_external_data_manager.h',
296             'policy/core/common/cloud/mock_cloud_policy_client.cc',
297             'policy/core/common/cloud/mock_cloud_policy_client.h',
298             'policy/core/common/cloud/mock_cloud_policy_store.cc',
299             'policy/core/common/cloud/mock_cloud_policy_store.h',
300             'policy/core/common/cloud/mock_device_management_service.cc',
301             'policy/core/common/cloud/mock_device_management_service.h',
302             'policy/core/common/cloud/mock_user_cloud_policy_store.cc',
303             'policy/core/common/cloud/mock_user_cloud_policy_store.h',
304             'policy/core/common/cloud/policy_builder.cc',
305             'policy/core/common/cloud/policy_builder.h',
306             'policy/core/common/configuration_policy_provider_test.cc',
307             'policy/core/common/configuration_policy_provider_test.h',
308             'policy/core/common/fake_async_policy_loader.cc',
309             'policy/core/common/fake_async_policy_loader.h',
310             'policy/core/common/mock_configuration_policy_provider.cc',
311             'policy/core/common/mock_configuration_policy_provider.h',
312             'policy/core/common/mock_policy_service.cc',
313             'policy/core/common/mock_policy_service.h',
314             'policy/core/common/policy_test_utils.cc',
315             'policy/core/common/policy_test_utils.h',
316             'policy/core/common/preferences_mock_mac.cc',
317             'policy/core/common/preferences_mock_mac.h',
318             'policy/core/common/remote_commands/test_remote_command_job.cc',
319             'policy/core/common/remote_commands/test_remote_command_job.h',
320             'policy/core/common/remote_commands/testing_remote_commands_server.cc',
321             'policy/core/common/remote_commands/testing_remote_commands_server.h',
322           ],
323           'conditions': [
324             ['OS=="android"', {
325               'sources!': [
326                 'policy/core/common/fake_async_policy_loader.cc',
327                 'policy/core/common/fake_async_policy_loader.h',
328               ],
329             }],
330             ['chromeos==1', {
331               'sources!': [
332                 'policy/core/common/cloud/mock_user_cloud_policy_store.cc',
333                 'policy/core/common/cloud/mock_user_cloud_policy_store.h',
334               ],
335             }],
336           ],
337         },
338       ],
339     }],
340     ['OS=="android" and configuration_policy==1', {
341       'targets': [
342         {
343           'target_name': 'app_restrictions_resources',
344           'type': 'none',
345           'variables': {
346             'resources_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip',
347             'input_resources_dir':
348             '<(SHARED_INTERMEDIATE_DIR)/chrome/app/policy/android',
349             'create_zip_script': '../build/android/gyp/zip.py',
350           },
351           'copies': [
352             {
353               'destination': '<(input_resources_dir)/xml-v21/',
354               'files': [
355                 '<(SHARED_INTERMEDIATE_DIR)/policy/app_restrictions.xml'
356               ],
357             },
358           ],
359           'actions': [
360             {
361               'action_name': 'create_resources_zip',
362               'inputs': [
363                 '<(create_zip_script)',
364                 '<(input_resources_dir)/xml-v21/app_restrictions.xml',
365                 '<(input_resources_dir)/values-v21/restriction_values.xml',
366               ],
367               'outputs': [
368                 '<(resources_zip)'
369               ],
370               'action': [
371                 'python', '<(create_zip_script)',
372                 '--input-dir', '<(input_resources_dir)',
373                 '--output', '<(resources_zip)',
374               ],
375             }
376           ],
377           'all_dependent_settings': {
378             'variables': {
379               'additional_input_paths': ['<(resources_zip)'],
380               'dependencies_res_zip_paths': ['<(resources_zip)'],
381             },
382           },
383         }
384       ],
385     }],
386     ['OS=="win" and target_arch=="ia32" and configuration_policy==1', {
387       'targets': [
388         {
389           'target_name': 'policy_win64',
390           'type': 'static_library',
391           'hard_dependency': 1,
392           'sources': [
393             '<(policy_constant_header_path)',
394             '<(policy_constant_source_path)',
395           ],
396           'include_dirs': [
397             '<(DEPTH)',
398           ],
399           'direct_dependent_settings':  {
400             'include_dirs': [
401               '<(policy_out_dir)'
402             ],
403           },
404           'dependencies': [
405             'cloud_policy_code_generate',
406           ],
407           'configurations': {
408             'Common_Base': {
409               'msvs_target_platform': 'x64',
410             },
411           },
412         },
413       ],
414     }],
415     ['OS!="ios"', {
416       'targets': [
417         {
418           # policy_templates has different inputs and outputs, so it can't use
419           # the rules of chrome_strings
420           'target_name': 'policy_templates',
421           'type': 'none',
422           'variables': {
423             'grit_grd_file': 'policy/resources/policy_templates.grd',
424             'grit_info_cmd': [
425               'python',
426               '<(DEPTH)/tools/grit/grit_info.py',
427               '<@(grit_defines)',
428             ],
429           },
430           'includes': [
431             '../build/grit_target.gypi',
432           ],
433           'actions': [
434             {
435               'action_name': 'policy_templates',
436               'includes': [
437                 '../build/grit_action.gypi',
438               ],
439             },
440           ],
441         },
442       ],
443     }],
444     ['OS=="mac"', {
445       'targets': [
446         {
447           # This is the bundle of the manifest file of Chrome.
448           # It contains the manifest file and its string tables.
449           'target_name': 'chrome_manifest_bundle',
450           'type': 'loadable_module',
451           'mac_bundle': 1,
452           'product_extension': 'manifest',
453           'product_name': '<(mac_bundle_id)',
454           'variables': {
455             # This avoids stripping debugging symbols from the target, which
456             # would fail because there is no binary code here.
457             'mac_strip': 0,
458           },
459           'dependencies': [
460              # Provides app-Manifest.plist and its string tables:
461             'policy_templates',
462           ],
463           'actions': [
464             {
465               'action_name': 'Copy MCX manifest file to manifest bundle',
466               'inputs': [
467                 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist',
468               ],
469               'outputs': [
470                 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest',
471               ],
472               'action': [
473                 # Use plutil -convert xml1 to put the plist into Apple's
474                 # canonical format. As a side effect, this ensures that the
475                 # plist is well-formed.
476                 'plutil',
477                 '-convert',
478                 'xml1',
479                 '<@(_inputs)',
480                 '-o',
481                 '<@(_outputs)',
482               ],
483               'message':
484                   'Copying the MCX policy manifest file to the manifest bundle',
485               'process_outputs_as_mac_bundle_resources': 1,
486             },
487             {
488               'action_name':
489                   'Copy Localizable.strings files to manifest bundle',
490               'variables': {
491                 'input_path': '<(grit_out_dir)/app/policy/mac/strings',
492                 # Directory to collect the Localizable.strings files before
493                 # they are copied to the bundle.
494                 'output_path': '<(INTERMEDIATE_DIR)/app_manifest',
495                 # The reason we are not enumerating all the locales is that
496                 # the translations would eat up 3.5MB disk space in the
497                 # application bundle:
498                 'available_locales': 'en',
499               },
500               'inputs': [
501                 # TODO: remove this helper when we have loops in GYP
502                 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
503               ],
504               'outputs': [
505                 # TODO: remove this helper when we have loops in GYP
506                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
507               ],
508               'action': [
509                 'cp', '-R',
510                 '<(input_path)/',
511                 '<(output_path)',
512               ],
513               'message':
514                   'Copy the Localizable.strings files to the manifest bundle',
515               'process_outputs_as_mac_bundle_resources': 1,
516             },
517           ],
518         },
519       ],
520     }],
521   ],