Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / components / policy.gypi
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.
4
5 {
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': '<(component)',
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             'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:',
139             'cc_include': 'components/policy/policy_proto_export.h',
140           },
141           'dependencies': [
142             'cloud_policy_code_generate',
143           ],
144           'includes': [
145             '../build/protoc.gypi',
146           ],
147           'defines': [
148             'POLICY_PROTO_COMPILATION',
149           ],
150           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
151           'msvs_disabled_warnings': [4267, ],
152         },
153         {
154           # This target builds the "full" protobuf, used for tests only.
155           'target_name': 'chrome_settings_proto_generated_compile',
156           'type': 'static_library',
157           'sources': [
158             '<(chrome_settings_proto_path)',
159           ],
160           'variables': {
161             'proto_in_dir': '<(policy_out_dir)/policy',
162             'proto_out_dir': 'policy/proto',
163           },
164           'dependencies': [
165             'cloud_policy_code_generate',
166             'cloud_policy_proto_generated_compile',
167           ],
168           'includes': [
169             '../build/protoc.gypi',
170           ],
171         },
172         {
173           'target_name': 'policy',
174           'type': 'static_library',
175           'hard_dependency': 1,
176           'direct_dependent_settings': {
177             'include_dirs': [
178               '<(policy_out_dir)',
179               '<(protoc_out_dir)',
180             ],
181           },
182           'sources': [
183             '<(policy_constant_header_path)',
184             '<(policy_constant_source_path)',
185             '<(protobuf_decoder_path)',
186           ],
187           'include_dirs': [
188             '<(DEPTH)',
189           ],
190           'dependencies': [
191             'cloud_policy_code_generate',
192             'cloud_policy_proto_generated_compile',
193             '<(DEPTH)/base/base.gyp:base',
194             '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
195           ],
196           'defines': [
197             'POLICY_COMPONENT_IMPLEMENTATION',
198           ],
199         },
200         {
201           'target_name': 'cloud_policy_proto',
202           'type': '<(component)',
203           'sources': [
204             'policy/proto/chrome_extension_policy.proto',
205             'policy/proto/device_management_backend.proto',
206             'policy/proto/device_management_local.proto',
207             'policy/proto/policy_signing_key.proto',
208           ],
209           'variables': {
210             'proto_in_dir': 'policy/proto',
211             'proto_out_dir': 'policy/proto',
212             'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:',
213             'cc_include': 'components/policy/policy_proto_export.h',
214           },
215           'includes': [
216             '../build/protoc.gypi',
217           ],
218           'conditions': [
219             ['OS=="android" or OS=="ios"', {
220               'sources!': [
221                 'policy/proto/chrome_extension_policy.proto',
222               ],
223             }],
224             ['chromeos==0', {
225               'sources!': [
226                 'policy/proto/device_management_local.proto',
227               ],
228             }],
229           ],
230           'defines': [
231             'POLICY_PROTO_COMPILATION',
232           ],
233         },
234         {
235           'target_name': 'policy_test_support',
236           'type': 'none',
237           'hard_dependency': 1,
238           'direct_dependent_settings': {
239             'include_dirs': [
240               '<(policy_out_dir)',
241               '<(protoc_out_dir)',
242             ],
243           },
244           'dependencies': [
245             'chrome_settings_proto_generated_compile',
246             'policy',
247           ],
248         },
249         {
250           'target_name': 'policy_component_test_support',
251           'type': 'static_library',
252           # This must be undefined so that POLICY_EXPORT works correctly in
253           # the static_library build.
254           'defines!': [
255             'POLICY_COMPONENT_IMPLEMENTATION',
256           ],
257           'dependencies': [
258             'cloud_policy_proto',
259             'policy_component',
260             'policy_test_support',
261             '../testing/gmock.gyp:gmock',
262             '../testing/gtest.gyp:gtest',
263           ],
264           'include_dirs': [
265             '..',
266           ],
267           'sources': [
268             'policy/core/browser/configuration_policy_pref_store_test.cc',
269             'policy/core/browser/configuration_policy_pref_store_test.h',
270             'policy/core/common/cloud/mock_cloud_external_data_manager.cc',
271             'policy/core/common/cloud/mock_cloud_external_data_manager.h',
272             'policy/core/common/cloud/mock_cloud_policy_client.cc',
273             'policy/core/common/cloud/mock_cloud_policy_client.h',
274             'policy/core/common/cloud/mock_cloud_policy_store.cc',
275             'policy/core/common/cloud/mock_cloud_policy_store.h',
276             'policy/core/common/cloud/mock_device_management_service.cc',
277             'policy/core/common/cloud/mock_device_management_service.h',
278             'policy/core/common/cloud/mock_user_cloud_policy_store.cc',
279             'policy/core/common/cloud/mock_user_cloud_policy_store.h',
280             'policy/core/common/cloud/policy_builder.cc',
281             'policy/core/common/cloud/policy_builder.h',
282             'policy/core/common/configuration_policy_provider_test.cc',
283             'policy/core/common/configuration_policy_provider_test.h',
284             'policy/core/common/mock_configuration_policy_provider.cc',
285             'policy/core/common/mock_configuration_policy_provider.h',
286             'policy/core/common/mock_policy_service.cc',
287             'policy/core/common/mock_policy_service.h',
288             'policy/core/common/policy_test_utils.cc',
289             'policy/core/common/policy_test_utils.h',
290             'policy/core/common/preferences_mock_mac.cc',
291             'policy/core/common/preferences_mock_mac.h',
292           ],
293           'conditions': [
294             ['chromeos==1', {
295               'sources!': [
296                 'policy/core/common/cloud/mock_user_cloud_policy_store.cc',
297                 'policy/core/common/cloud/mock_user_cloud_policy_store.h',
298               ],
299             }],
300           ],
301         },
302       ],
303     }],
304     ['OS=="win" and target_arch=="ia32" and configuration_policy==1', {
305       'targets': [
306         {
307           'target_name': 'policy_win64',
308           'type': 'static_library',
309           'hard_dependency': 1,
310           'sources': [
311             '<(policy_constant_header_path)',
312             '<(policy_constant_source_path)',
313           ],
314           'include_dirs': [
315             '<(DEPTH)',
316           ],
317           'direct_dependent_settings':  {
318             'include_dirs': [
319               '<(policy_out_dir)'
320             ],
321           },
322           'dependencies': [
323             'cloud_policy_code_generate',
324           ],
325           'configurations': {
326             'Common_Base': {
327               'msvs_target_platform': 'x64',
328             },
329           },
330         },
331       ],
332     }],
333     ['OS=="win" or OS=="mac" or OS=="linux"', {
334       'targets': [
335         {
336           # policy_templates has different inputs and outputs, so it can't use
337           # the rules of chrome_strings
338           'target_name': 'policy_templates',
339           'type': 'none',
340           'variables': {
341             'grit_grd_file': 'policy/resources/policy_templates.grd',
342             'grit_info_cmd': [
343               'python',
344               '<(DEPTH)/tools/grit/grit_info.py',
345               '<@(grit_defines)',
346             ],
347           },
348           'includes': [
349             '../build/grit_target.gypi',
350           ],
351           'actions': [
352             {
353               'action_name': 'policy_templates',
354               'includes': [
355                 '../build/grit_action.gypi',
356               ],
357             },
358           ],
359         },
360       ],
361     }],
362     ['OS=="mac"', {
363       'targets': [
364         {
365           # This is the bundle of the manifest file of Chrome.
366           # It contains the manifest file and its string tables.
367           'target_name': 'chrome_manifest_bundle',
368           'type': 'loadable_module',
369           'mac_bundle': 1,
370           'product_extension': 'manifest',
371           'product_name': '<(mac_bundle_id)',
372           'variables': {
373             # This avoids stripping debugging symbols from the target, which
374             # would fail because there is no binary code here.
375             'mac_strip': 0,
376           },
377           'dependencies': [
378              # Provides app-Manifest.plist and its string tables:
379             'policy_templates',
380           ],
381           'actions': [
382             {
383               'action_name': 'Copy MCX manifest file to manifest bundle',
384               'inputs': [
385                 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist',
386               ],
387               'outputs': [
388                 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest',
389               ],
390               'action': [
391                 # Use plutil -convert xml1 to put the plist into Apple's
392                 # canonical format. As a side effect, this ensures that the
393                 # plist is well-formed.
394                 'plutil',
395                 '-convert',
396                 'xml1',
397                 '<@(_inputs)',
398                 '-o',
399                 '<@(_outputs)',
400               ],
401               'message':
402                   'Copying the MCX policy manifest file to the manifest bundle',
403               'process_outputs_as_mac_bundle_resources': 1,
404             },
405             {
406               'action_name':
407                   'Copy Localizable.strings files to manifest bundle',
408               'variables': {
409                 'input_path': '<(grit_out_dir)/app/policy/mac/strings',
410                 # Directory to collect the Localizable.strings files before
411                 # they are copied to the bundle.
412                 'output_path': '<(INTERMEDIATE_DIR)/app_manifest',
413                 # The reason we are not enumerating all the locales is that
414                 # the translations would eat up 3.5MB disk space in the
415                 # application bundle:
416                 'available_locales': 'en',
417               },
418               'inputs': [
419                 # TODO: remove this helper when we have loops in GYP
420                 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
421               ],
422               'outputs': [
423                 # TODO: remove this helper when we have loops in GYP
424                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
425               ],
426               'action': [
427                 'cp', '-R',
428                 '<(input_path)/',
429                 '<(output_path)',
430               ],
431               'message':
432                   'Copy the Localizable.strings files to the manifest bundle',
433               'process_outputs_as_mac_bundle_resources': 1,
434             },
435           ],
436         },
437       ],
438     }],
439   ],
440 }