ExtensionInstallDialogView: fix scrolling behavior on Views (Win,Linux)
[chromium-blink-merge.git] / components / policy.gypi
blob23024874ea6e3bdccc49d3d830882c5918b05e12
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                 '<(DEPTH)/chrome/VERSION',
107                 '<(generate_policy_source_script_path)',
108               ],
109               'outputs': [
110                 '<(policy_constant_header_path)',
111                 '<(policy_constant_source_path)',
112                 '<(protobuf_decoder_path)',
113                 '<(chrome_settings_proto_path)',
114                 '<(cloud_policy_proto_path)',
115                 '<(app_restrictions_path)',
116               ],
117               'action_name': 'generate_policy_source',
118               'action': [
119                 'python',
120                 '<@(generate_policy_source_script_path)',
121                 '--policy-constants-header=<(policy_constant_header_path)',
122                 '--policy-constants-source=<(policy_constant_source_path)',
123                 '--chrome-settings-protobuf=<(chrome_settings_proto_path)',
124                 '--cloud-policy-protobuf=<(cloud_policy_proto_path)',
125                 '--cloud-policy-decoder=<(protobuf_decoder_path)',
126                 '--app-restrictions-definition=<(app_restrictions_path)',
127                 '<(DEPTH)/chrome/VERSION',
128                 '<(OS)',
129                 '<(chromeos)',
130                 'policy/resources/policy_templates.json',
131               ],
132               'message': 'Generating policy source',
133               'conditions': [
134                 ['OS!="android"', {
135                   'outputs!': [
136                     '<(app_restrictions_path)',
137                   ],
138                 }],
139               ],
140             },
141           ],
142           'direct_dependent_settings': {
143             'include_dirs': [
144               '<(policy_out_dir)',
145               '<(protoc_out_dir)',
146             ],
147           },
148         },
149         {
150           # GN version: //components/policy:cloud_policy_proto_generated_compile
151           'target_name': 'cloud_policy_proto_generated_compile',
152           'type': '<(component)',
153           'sources': [
154             '<(cloud_policy_proto_path)',
155           ],
156           'variables': {
157             'proto_in_dir': '<(policy_out_dir)/policy',
158             'proto_out_dir': 'policy/proto',
159             'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:',
160             'cc_include': 'components/policy/policy_proto_export.h',
161           },
162           'dependencies': [
163             'cloud_policy_code_generate',
164           ],
165           'includes': [
166             '../build/protoc.gypi',
167           ],
168           'defines': [
169             'POLICY_PROTO_COMPILATION',
170           ],
171           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
172           'msvs_disabled_warnings': [4267, ],
173         },
174         {
175           # This target builds the "full" protobuf, used for tests only.
176           # GN version: //components/policy:chrome_settings_proto_generated_compile
177           'target_name': 'chrome_settings_proto_generated_compile',
178           'type': 'static_library',
179           'sources': [
180             '<(chrome_settings_proto_path)',
181           ],
182           'variables': {
183             'proto_in_dir': '<(policy_out_dir)/policy',
184             'proto_out_dir': 'policy/proto',
185           },
186           'dependencies': [
187             'cloud_policy_code_generate',
188             'cloud_policy_proto_generated_compile',
189           ],
190           'includes': [
191             '../build/protoc.gypi',
192           ],
193         },
194         {
195           # GN version: //components/policy
196           'target_name': 'policy',
197           'type': 'static_library',
198           'hard_dependency': 1,
199           'direct_dependent_settings': {
200             'include_dirs': [
201               '<(policy_out_dir)',
202               '<(protoc_out_dir)',
203             ],
204           },
205           'sources': [
206             '<(policy_constant_header_path)',
207             '<(policy_constant_source_path)',
208             '<(protobuf_decoder_path)',
209           ],
210           'include_dirs': [
211             '<(DEPTH)',
212           ],
213           'dependencies': [
214             'cloud_policy_code_generate',
215             'cloud_policy_proto_generated_compile',
216             '<(DEPTH)/base/base.gyp:base',
217             '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
218           ],
219           'defines': [
220             'POLICY_COMPONENT_IMPLEMENTATION',
221           ],
222         },
223         {
224           # GN version: //components/policy/proto
225           'target_name': 'cloud_policy_proto',
226           'type': '<(component)',
227           'sources': [
228             'policy/proto/chrome_extension_policy.proto',
229             'policy/proto/device_management_backend.proto',
230             'policy/proto/device_management_local.proto',
231             'policy/proto/policy_signing_key.proto',
232           ],
233           'variables': {
234             'proto_in_dir': 'policy/proto',
235             'proto_out_dir': 'policy/proto',
236             'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:',
237             'cc_include': 'components/policy/policy_proto_export.h',
238           },
239           'includes': [
240             '../build/protoc.gypi',
241           ],
242           'conditions': [
243             ['OS=="android" or OS=="ios"', {
244               'sources!': [
245                 'policy/proto/chrome_extension_policy.proto',
246               ],
247             }],
248             ['chromeos==0', {
249               'sources!': [
250                 'policy/proto/device_management_local.proto',
251               ],
252             }],
253           ],
254           'defines': [
255             'POLICY_PROTO_COMPILATION',
256           ],
257         },
258         {
259           # GN version: //components/policy:test_support
260           'target_name': 'policy_test_support',
261           'type': 'none',
262           'hard_dependency': 1,
263           'direct_dependent_settings': {
264             'include_dirs': [
265               '<(policy_out_dir)',
266               '<(protoc_out_dir)',
267             ],
268           },
269           'dependencies': [
270             'chrome_settings_proto_generated_compile',
271             'policy',
272           ],
273         },
274         {
275           # GN version: //components/policy:policy_component_test_support
276           'target_name': 'policy_component_test_support',
277           'type': 'static_library',
278           # This must be undefined so that POLICY_EXPORT works correctly in
279           # the static_library build.
280           'defines!': [
281             'POLICY_COMPONENT_IMPLEMENTATION',
282           ],
283           'dependencies': [
284             'cloud_policy_proto',
285             'policy_component',
286             'policy_test_support',
287             '../testing/gmock.gyp:gmock',
288             '../testing/gtest.gyp:gtest',
289           ],
290           'include_dirs': [
291             '..',
292           ],
293           'sources': [
294             'policy/core/browser/configuration_policy_pref_store_test.cc',
295             'policy/core/browser/configuration_policy_pref_store_test.h',
296             'policy/core/common/cloud/mock_cloud_external_data_manager.cc',
297             'policy/core/common/cloud/mock_cloud_external_data_manager.h',
298             'policy/core/common/cloud/mock_cloud_policy_client.cc',
299             'policy/core/common/cloud/mock_cloud_policy_client.h',
300             'policy/core/common/cloud/mock_cloud_policy_store.cc',
301             'policy/core/common/cloud/mock_cloud_policy_store.h',
302             'policy/core/common/cloud/mock_device_management_service.cc',
303             'policy/core/common/cloud/mock_device_management_service.h',
304             'policy/core/common/cloud/mock_user_cloud_policy_store.cc',
305             'policy/core/common/cloud/mock_user_cloud_policy_store.h',
306             'policy/core/common/cloud/policy_builder.cc',
307             'policy/core/common/cloud/policy_builder.h',
308             'policy/core/common/configuration_policy_provider_test.cc',
309             'policy/core/common/configuration_policy_provider_test.h',
310             'policy/core/common/fake_async_policy_loader.cc',
311             'policy/core/common/fake_async_policy_loader.h',
312             'policy/core/common/mock_configuration_policy_provider.cc',
313             'policy/core/common/mock_configuration_policy_provider.h',
314             'policy/core/common/mock_policy_service.cc',
315             'policy/core/common/mock_policy_service.h',
316             'policy/core/common/policy_test_utils.cc',
317             'policy/core/common/policy_test_utils.h',
318             'policy/core/common/preferences_mock_mac.cc',
319             'policy/core/common/preferences_mock_mac.h',
320             'policy/core/common/remote_commands/test_remote_command_job.cc',
321             'policy/core/common/remote_commands/test_remote_command_job.h',
322             'policy/core/common/remote_commands/testing_remote_commands_server.cc',
323             'policy/core/common/remote_commands/testing_remote_commands_server.h',
324           ],
325           'conditions': [
326             ['OS=="android"', {
327               'sources!': [
328                 'policy/core/common/fake_async_policy_loader.cc',
329                 'policy/core/common/fake_async_policy_loader.h',
330               ],
331             }],
332             ['chromeos==1', {
333               'sources!': [
334                 'policy/core/common/cloud/mock_user_cloud_policy_store.cc',
335                 'policy/core/common/cloud/mock_user_cloud_policy_store.h',
336               ],
337             }],
338           ],
339         },
340       ],
341     }],
342     ['OS=="android" and configuration_policy==1', {
343       'targets': [
344         {
345           'target_name': 'app_restrictions_resources',
346           'type': 'none',
347           'variables': {
348             'resources_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip',
349             'input_resources_dir':
350             '<(SHARED_INTERMEDIATE_DIR)/chrome/app/policy/android',
351             'create_zip_script': '../build/android/gyp/zip.py',
352           },
353           'copies': [
354             {
355               'destination': '<(input_resources_dir)/xml-v21/',
356               'files': [
357                 '<(SHARED_INTERMEDIATE_DIR)/policy/app_restrictions.xml'
358               ],
359             },
360           ],
361           'actions': [
362             {
363               'action_name': 'create_resources_zip',
364               'inputs': [
365                 '<(create_zip_script)',
366                 '<(input_resources_dir)/xml-v21/app_restrictions.xml',
367                 '<(input_resources_dir)/values-v21/restriction_values.xml',
368               ],
369               'outputs': [
370                 '<(resources_zip)'
371               ],
372               'action': [
373                 'python', '<(create_zip_script)',
374                 '--input-dir', '<(input_resources_dir)',
375                 '--output', '<(resources_zip)',
376               ],
377             }
378           ],
379           'all_dependent_settings': {
380             'variables': {
381               'additional_input_paths': ['<(resources_zip)'],
382               'dependencies_res_zip_paths': ['<(resources_zip)'],
383             },
384           },
385         },
386         {
387           # GN: //components/policy/android:policy_java
388           'target_name': 'policy_java',
389           'type': 'none',
390           'dependencies': [
391             '../base/base.gyp:base_java',
392           ],
393           'variables': {
394             'java_in_dir': 'policy/android/java',
395           },
396           'includes': [ '../build/java.gypi' ],
397         },
398         {
399           # GN: //components/policy/android:jni_headers
400           'target_name': 'policy_jni_headers',
401           'type': 'none',
402           'sources': [
403             'policy/android/java/src/org/chromium/policy/PolicyConverter.java',
404           ],
405           'variables': {
406             'jni_gen_package': 'policy',
407           },
408           'includes': [ '../build/jni_generator.gypi' ],
409         },
410       ],
411     }],
412     ['OS=="win" and target_arch=="ia32" and configuration_policy==1', {
413       'targets': [
414         {
415           'target_name': 'policy_win64',
416           'type': 'static_library',
417           'hard_dependency': 1,
418           'sources': [
419             '<(policy_constant_header_path)',
420             '<(policy_constant_source_path)',
421           ],
422           'include_dirs': [
423             '<(DEPTH)',
424           ],
425           'direct_dependent_settings':  {
426             'include_dirs': [
427               '<(policy_out_dir)'
428             ],
429           },
430           'dependencies': [
431             'cloud_policy_code_generate',
432           ],
433           'configurations': {
434             'Common_Base': {
435               'msvs_target_platform': 'x64',
436             },
437           },
438         },
439       ],
440     }],
441     ['OS!="ios"', {
442       'targets': [
443         {
444           # policy_templates has different inputs and outputs, so it can't use
445           # the rules of chrome_strings
446           'target_name': 'policy_templates',
447           'type': 'none',
448           'variables': {
449             'grit_grd_file': 'policy/resources/policy_templates.grd',
450             'grit_info_cmd': [
451               'python',
452               '<(DEPTH)/tools/grit/grit_info.py',
453               '<@(grit_defines)',
454             ],
455           },
456           'includes': [
457             '../build/grit_target.gypi',
458           ],
459           'actions': [
460             {
461               'action_name': 'policy_templates',
462               'includes': [
463                 '../build/grit_action.gypi',
464               ],
465             },
466           ],
467         },
468       ],
469     }],
470     ['OS=="mac"', {
471       'targets': [
472         {
473           # This is the bundle of the manifest file of Chrome.
474           # It contains the manifest file and its string tables.
475           'target_name': 'chrome_manifest_bundle',
476           'type': 'loadable_module',
477           'mac_bundle': 1,
478           'product_extension': 'manifest',
479           'product_name': '<(mac_bundle_id)',
480           'variables': {
481             # This avoids stripping debugging symbols from the target, which
482             # would fail because there is no binary code here.
483             'mac_strip': 0,
484           },
485           'dependencies': [
486              # Provides app-Manifest.plist and its string tables:
487             'policy_templates',
488           ],
489           'actions': [
490             {
491               'action_name': 'Copy MCX manifest file to manifest bundle',
492               'inputs': [
493                 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist',
494               ],
495               'outputs': [
496                 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest',
497               ],
498               'action': [
499                 # Use plutil -convert xml1 to put the plist into Apple's
500                 # canonical format. As a side effect, this ensures that the
501                 # plist is well-formed.
502                 'plutil',
503                 '-convert',
504                 'xml1',
505                 '<@(_inputs)',
506                 '-o',
507                 '<@(_outputs)',
508               ],
509               'message':
510                   'Copying the MCX policy manifest file to the manifest bundle',
511               'process_outputs_as_mac_bundle_resources': 1,
512             },
513             {
514               'action_name':
515                   'Copy Localizable.strings files to manifest bundle',
516               'variables': {
517                 'input_path': '<(grit_out_dir)/app/policy/mac/strings',
518                 # Directory to collect the Localizable.strings files before
519                 # they are copied to the bundle.
520                 'output_path': '<(INTERMEDIATE_DIR)/app_manifest',
521                 # The reason we are not enumerating all the locales is that
522                 # the translations would eat up 3.5MB disk space in the
523                 # application bundle:
524                 'available_locales': 'en',
525               },
526               'inputs': [
527                 # TODO: remove this helper when we have loops in GYP
528                 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
529               ],
530               'outputs': [
531                 # TODO: remove this helper when we have loops in GYP
532                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
533               ],
534               'action': [
535                 'cp', '-R',
536                 '<(input_path)/',
537                 '<(output_path)',
538               ],
539               'message':
540                   'Copy the Localizable.strings files to the manifest bundle',
541               'process_outputs_as_mac_bundle_resources': 1,
542             },
543           ],
544         },
545       ],
546     }],
547   ],