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