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