Add an exponential backoff to rechecking the app list doodle.
[chromium-blink-merge.git] / components / policy.gypi
blobc2b99d8cae317b7e691590a84b2185e4d3ba2f11
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': 'remove_localized_resources',
362               'outputs': [
363                 '<(input_resources_dir)/remove_localized_resources.d.stamp'
364               ],
365               'inputs': [
366                 'policy/tools/remove_localized_app_restrictions.py',
367               ],
368               'action': [
369                 'python',
370                 'policy/tools/remove_localized_app_restrictions.py',
371                 '<(input_resources_dir)',
372               ],
373             },
374             {
375               'action_name': 'create_resources_zip',
376               'inputs': [
377                 '<(create_zip_script)',
378                 '<(input_resources_dir)/xml-v21/app_restrictions.xml',
379                 '<(input_resources_dir)/values-v21/restriction_values.xml',
380                 # A dummy stamp file to remove localized resources without
381                 # clobbering the build.
382                 # TODO(475515): Remove after all build bots have run
383                 # 'remove_localized_resources' target.
384                 '<(input_resources_dir)/remove_localized_resources.d.stamp',
385               ],
386               'outputs': [
387                 '<(resources_zip)'
388               ],
389               'action': [
390                 'python', '<(create_zip_script)',
391                 '--input-dir', '<(input_resources_dir)',
392                 '--output', '<(resources_zip)',
393               ],
394             }
395           ],
396           'all_dependent_settings': {
397             'variables': {
398               'additional_input_paths': ['<(resources_zip)'],
399               'dependencies_res_zip_paths': ['<(resources_zip)'],
400             },
401           },
402         }
403       ],
404     }],
405     ['OS=="win" and target_arch=="ia32" and configuration_policy==1', {
406       'targets': [
407         {
408           'target_name': 'policy_win64',
409           'type': 'static_library',
410           'hard_dependency': 1,
411           'sources': [
412             '<(policy_constant_header_path)',
413             '<(policy_constant_source_path)',
414           ],
415           'include_dirs': [
416             '<(DEPTH)',
417           ],
418           'direct_dependent_settings':  {
419             'include_dirs': [
420               '<(policy_out_dir)'
421             ],
422           },
423           'dependencies': [
424             'cloud_policy_code_generate',
425           ],
426           'configurations': {
427             'Common_Base': {
428               'msvs_target_platform': 'x64',
429             },
430           },
431         },
432       ],
433     }],
434     ['OS!="ios"', {
435       'targets': [
436         {
437           # policy_templates has different inputs and outputs, so it can't use
438           # the rules of chrome_strings
439           'target_name': 'policy_templates',
440           'type': 'none',
441           'variables': {
442             'grit_grd_file': 'policy/resources/policy_templates.grd',
443             'grit_info_cmd': [
444               'python',
445               '<(DEPTH)/tools/grit/grit_info.py',
446               '<@(grit_defines)',
447             ],
448           },
449           'includes': [
450             '../build/grit_target.gypi',
451           ],
452           'actions': [
453             {
454               'action_name': 'policy_templates',
455               'includes': [
456                 '../build/grit_action.gypi',
457               ],
458             },
459           ],
460         },
461       ],
462     }],
463     ['OS=="mac"', {
464       'targets': [
465         {
466           # This is the bundle of the manifest file of Chrome.
467           # It contains the manifest file and its string tables.
468           'target_name': 'chrome_manifest_bundle',
469           'type': 'loadable_module',
470           'mac_bundle': 1,
471           'product_extension': 'manifest',
472           'product_name': '<(mac_bundle_id)',
473           'variables': {
474             # This avoids stripping debugging symbols from the target, which
475             # would fail because there is no binary code here.
476             'mac_strip': 0,
477           },
478           'dependencies': [
479              # Provides app-Manifest.plist and its string tables:
480             'policy_templates',
481           ],
482           'actions': [
483             {
484               'action_name': 'Copy MCX manifest file to manifest bundle',
485               'inputs': [
486                 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist',
487               ],
488               'outputs': [
489                 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest',
490               ],
491               'action': [
492                 # Use plutil -convert xml1 to put the plist into Apple's
493                 # canonical format. As a side effect, this ensures that the
494                 # plist is well-formed.
495                 'plutil',
496                 '-convert',
497                 'xml1',
498                 '<@(_inputs)',
499                 '-o',
500                 '<@(_outputs)',
501               ],
502               'message':
503                   'Copying the MCX policy manifest file to the manifest bundle',
504               'process_outputs_as_mac_bundle_resources': 1,
505             },
506             {
507               'action_name':
508                   'Copy Localizable.strings files to manifest bundle',
509               'variables': {
510                 'input_path': '<(grit_out_dir)/app/policy/mac/strings',
511                 # Directory to collect the Localizable.strings files before
512                 # they are copied to the bundle.
513                 'output_path': '<(INTERMEDIATE_DIR)/app_manifest',
514                 # The reason we are not enumerating all the locales is that
515                 # the translations would eat up 3.5MB disk space in the
516                 # application bundle:
517                 'available_locales': 'en',
518               },
519               'inputs': [
520                 # TODO: remove this helper when we have loops in GYP
521                 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
522               ],
523               'outputs': [
524                 # TODO: remove this helper when we have loops in GYP
525                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
526               ],
527               'action': [
528                 'cp', '-R',
529                 '<(input_path)/',
530                 '<(output_path)',
531               ],
532               'message':
533                   'Copy the Localizable.strings files to the manifest bundle',
534               'process_outputs_as_mac_bundle_resources': 1,
535             },
536           ],
537         },
538       ],
539     }],
540   ],