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