OLD | NEW |
| (Empty) |
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 'app_restrictions_path': | |
24 '<(policy_out_dir)/app_restrictions.xml', | |
25 'risk_tag_header_path': | |
26 '<(policy_out_dir)/risk_tag.h', | |
27 # This is the "full" protobuf, which defines one protobuf message per | |
28 # policy. It is also the format currently used by the server. | |
29 'chrome_settings_proto_path': | |
30 '<(policy_out_dir)/policy/chrome_settings.proto', | |
31 # This protobuf is equivalent to chrome_settings.proto but shares messages | |
32 # for policies of the same type, so that less classes have to be generated | |
33 # and compiled. | |
34 'cloud_policy_proto_path': | |
35 '<(policy_out_dir)/policy/cloud_policy.proto', | |
36 }, | |
37 'conditions': [ | |
38 ['component=="static_library"', { | |
39 'targets': [ | |
40 { | |
41 # GN version: //components/policy:policy_component | |
42 'target_name': 'policy_component', | |
43 'type': 'none', | |
44 'dependencies': [ | |
45 'policy_component_common', | |
46 'policy_component_browser', | |
47 ], | |
48 }, | |
49 { | |
50 # GN version: //components/policy:policy_component_common | |
51 'target_name': 'policy_component_common', | |
52 'type': 'static_library', | |
53 'includes': [ | |
54 'policy/policy_common.gypi', | |
55 ], | |
56 }, | |
57 { | |
58 # GN version: //components/policy:policy_component_browser | |
59 'target_name': 'policy_component_browser', | |
60 'type': 'static_library', | |
61 'dependencies': [ | |
62 'policy_component_common', | |
63 ], | |
64 'includes': [ | |
65 'policy/policy_browser.gypi', | |
66 ], | |
67 'conditions': [ | |
68 ['OS=="android"', { | |
69 'dependencies': ['policy_jni_headers']}, | |
70 ], | |
71 ], | |
72 }, | |
73 ], | |
74 }, { # component=="shared_library" | |
75 'targets': [ | |
76 { | |
77 # GN version: //components/policy:policy_component | |
78 'target_name': 'policy_component', | |
79 'type': 'shared_library', | |
80 'includes': [ | |
81 'policy/policy_common.gypi', | |
82 'policy/policy_browser.gypi', | |
83 ], | |
84 }, | |
85 { | |
86 # GN version: //components/policy:policy_component_common | |
87 'target_name': 'policy_component_common', | |
88 'type': 'none', | |
89 'dependencies': [ | |
90 'policy_component', | |
91 ], | |
92 'conditions': [ | |
93 ['OS=="android"', { | |
94 'dependencies': ['policy_jni_headers']}, | |
95 ], | |
96 ], | |
97 }, | |
98 { | |
99 # GN version: //components/policy:policy_component_browser | |
100 'target_name': 'policy_component_browser', | |
101 'type': 'none', | |
102 'dependencies': [ | |
103 'policy_component', | |
104 ], | |
105 }, | |
106 ], | |
107 }], | |
108 ['configuration_policy==1', { | |
109 'targets': [ | |
110 { | |
111 # GN version: //components/policy:cloud_policy_code_generate | |
112 'target_name': 'cloud_policy_code_generate', | |
113 'type': 'none', | |
114 'actions': [ | |
115 { | |
116 'inputs': [ | |
117 'policy/resources/policy_templates.json', | |
118 '<(DEPTH)/chrome/VERSION', | |
119 '<(generate_policy_source_script_path)', | |
120 ], | |
121 'outputs': [ | |
122 '<(policy_constant_header_path)', | |
123 '<(policy_constant_source_path)', | |
124 '<(protobuf_decoder_path)', | |
125 '<(chrome_settings_proto_path)', | |
126 '<(cloud_policy_proto_path)', | |
127 '<(app_restrictions_path)', | |
128 '<(risk_tag_header_path)', | |
129 ], | |
130 'action_name': 'generate_policy_source', | |
131 'action': [ | |
132 'python', | |
133 '<@(generate_policy_source_script_path)', | |
134 '--policy-constants-header=<(policy_constant_header_path)', | |
135 '--policy-constants-source=<(policy_constant_source_path)', | |
136 '--chrome-settings-protobuf=<(chrome_settings_proto_path)', | |
137 '--cloud-policy-protobuf=<(cloud_policy_proto_path)', | |
138 '--cloud-policy-decoder=<(protobuf_decoder_path)', | |
139 '--app-restrictions-definition=<(app_restrictions_path)', | |
140 '--risk-tag-header=<(risk_tag_header_path)', | |
141 '<(DEPTH)/chrome/VERSION', | |
142 '<(OS)', | |
143 '<(chromeos)', | |
144 'policy/resources/policy_templates.json', | |
145 ], | |
146 'message': 'Generating policy source', | |
147 'conditions': [ | |
148 ['OS!="android"', { | |
149 'outputs!': [ | |
150 '<(app_restrictions_path)', | |
151 ], | |
152 }], | |
153 ], | |
154 }, | |
155 ], | |
156 'direct_dependent_settings': { | |
157 'include_dirs': [ | |
158 '<(policy_out_dir)', | |
159 '<(protoc_out_dir)', | |
160 ], | |
161 }, | |
162 }, | |
163 { | |
164 # GN version: //components/policy:cloud_policy_proto_generated_compile | |
165 'target_name': 'cloud_policy_proto_generated_compile', | |
166 'type': '<(component)', | |
167 'sources': [ | |
168 '<(cloud_policy_proto_path)', | |
169 ], | |
170 'variables': { | |
171 'proto_in_dir': '<(policy_out_dir)/policy', | |
172 'proto_out_dir': 'policy/proto', | |
173 'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:', | |
174 'cc_include': 'components/policy/policy_proto_export.h', | |
175 }, | |
176 'dependencies': [ | |
177 'cloud_policy_code_generate', | |
178 ], | |
179 'includes': [ | |
180 '../build/protoc.gypi', | |
181 ], | |
182 'defines': [ | |
183 'POLICY_PROTO_COMPILATION', | |
184 ], | |
185 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. | |
186 'msvs_disabled_warnings': [4267, ], | |
187 }, | |
188 { | |
189 # This target builds the "full" protobuf, used for tests only. | |
190 # GN version: //components/policy:chrome_settings_proto_generated_comp
ile | |
191 'target_name': 'chrome_settings_proto_generated_compile', | |
192 'type': 'static_library', | |
193 'sources': [ | |
194 '<(chrome_settings_proto_path)', | |
195 ], | |
196 'variables': { | |
197 'proto_in_dir': '<(policy_out_dir)/policy', | |
198 'proto_out_dir': 'policy/proto', | |
199 }, | |
200 'dependencies': [ | |
201 'cloud_policy_code_generate', | |
202 'cloud_policy_proto_generated_compile', | |
203 ], | |
204 'includes': [ | |
205 '../build/protoc.gypi', | |
206 ], | |
207 }, | |
208 { | |
209 # GN version: //components/policy | |
210 'target_name': 'policy', | |
211 'type': 'static_library', | |
212 'hard_dependency': 1, | |
213 'direct_dependent_settings': { | |
214 'include_dirs': [ | |
215 '<(policy_out_dir)', | |
216 '<(protoc_out_dir)', | |
217 ], | |
218 }, | |
219 'sources': [ | |
220 '<(policy_constant_header_path)', | |
221 '<(policy_constant_source_path)', | |
222 '<(risk_tag_header_path)', | |
223 '<(protobuf_decoder_path)', | |
224 ], | |
225 'include_dirs': [ | |
226 '<(DEPTH)', | |
227 ], | |
228 'dependencies': [ | |
229 'cloud_policy_code_generate', | |
230 'cloud_policy_proto_generated_compile', | |
231 '<(DEPTH)/base/base.gyp:base', | |
232 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', | |
233 ], | |
234 'defines': [ | |
235 'POLICY_COMPONENT_IMPLEMENTATION', | |
236 ], | |
237 }, | |
238 { | |
239 # GN version: //components/policy/proto | |
240 'target_name': 'cloud_policy_proto', | |
241 'type': '<(component)', | |
242 'sources': [ | |
243 'policy/proto/chrome_extension_policy.proto', | |
244 'policy/proto/device_management_backend.proto', | |
245 'policy/proto/device_management_local.proto', | |
246 'policy/proto/policy_signing_key.proto', | |
247 ], | |
248 'variables': { | |
249 'proto_in_dir': 'policy/proto', | |
250 'proto_out_dir': 'policy/proto', | |
251 'cc_generator_options': 'dllexport_decl=POLICY_PROTO_EXPORT:', | |
252 'cc_include': 'components/policy/policy_proto_export.h', | |
253 }, | |
254 'includes': [ | |
255 '../build/protoc.gypi', | |
256 ], | |
257 'conditions': [ | |
258 ['OS=="android" or OS=="ios"', { | |
259 'sources!': [ | |
260 'policy/proto/chrome_extension_policy.proto', | |
261 ], | |
262 }], | |
263 ['chromeos==0', { | |
264 'sources!': [ | |
265 'policy/proto/device_management_local.proto', | |
266 ], | |
267 }], | |
268 ], | |
269 'defines': [ | |
270 'POLICY_PROTO_COMPILATION', | |
271 ], | |
272 }, | |
273 { | |
274 # GN version: //components/policy:test_support | |
275 'target_name': 'policy_test_support', | |
276 'type': 'none', | |
277 'hard_dependency': 1, | |
278 'direct_dependent_settings': { | |
279 'include_dirs': [ | |
280 '<(policy_out_dir)', | |
281 '<(protoc_out_dir)', | |
282 ], | |
283 }, | |
284 'dependencies': [ | |
285 'chrome_settings_proto_generated_compile', | |
286 'policy', | |
287 ], | |
288 }, | |
289 { | |
290 # GN version: //components/policy:policy_component_test_support | |
291 'target_name': 'policy_component_test_support', | |
292 'type': 'static_library', | |
293 # This must be undefined so that POLICY_EXPORT works correctly in | |
294 # the static_library build. | |
295 'defines!': [ | |
296 'POLICY_COMPONENT_IMPLEMENTATION', | |
297 ], | |
298 'dependencies': [ | |
299 'cloud_policy_proto', | |
300 'policy_component', | |
301 'policy_test_support', | |
302 '../testing/gmock.gyp:gmock', | |
303 '../testing/gtest.gyp:gtest', | |
304 ], | |
305 'include_dirs': [ | |
306 '..', | |
307 ], | |
308 'sources': [ | |
309 'policy/core/browser/configuration_policy_pref_store_test.cc', | |
310 'policy/core/browser/configuration_policy_pref_store_test.h', | |
311 'policy/core/common/cloud/mock_cloud_external_data_manager.cc', | |
312 'policy/core/common/cloud/mock_cloud_external_data_manager.h', | |
313 'policy/core/common/cloud/mock_cloud_policy_client.cc', | |
314 'policy/core/common/cloud/mock_cloud_policy_client.h', | |
315 'policy/core/common/cloud/mock_cloud_policy_store.cc', | |
316 'policy/core/common/cloud/mock_cloud_policy_store.h', | |
317 'policy/core/common/cloud/mock_device_management_service.cc', | |
318 'policy/core/common/cloud/mock_device_management_service.h', | |
319 'policy/core/common/cloud/mock_user_cloud_policy_store.cc', | |
320 'policy/core/common/cloud/mock_user_cloud_policy_store.h', | |
321 'policy/core/common/cloud/policy_builder.cc', | |
322 'policy/core/common/cloud/policy_builder.h', | |
323 'policy/core/common/configuration_policy_provider_test.cc', | |
324 'policy/core/common/configuration_policy_provider_test.h', | |
325 'policy/core/common/fake_async_policy_loader.cc', | |
326 'policy/core/common/fake_async_policy_loader.h', | |
327 'policy/core/common/mock_configuration_policy_provider.cc', | |
328 'policy/core/common/mock_configuration_policy_provider.h', | |
329 'policy/core/common/mock_policy_service.cc', | |
330 'policy/core/common/mock_policy_service.h', | |
331 'policy/core/common/policy_test_utils.cc', | |
332 'policy/core/common/policy_test_utils.h', | |
333 'policy/core/common/preferences_mock_mac.cc', | |
334 'policy/core/common/preferences_mock_mac.h', | |
335 'policy/core/common/remote_commands/test_remote_command_job.cc', | |
336 'policy/core/common/remote_commands/test_remote_command_job.h', | |
337 'policy/core/common/remote_commands/testing_remote_commands_server.c
c', | |
338 'policy/core/common/remote_commands/testing_remote_commands_server.h
', | |
339 ], | |
340 'conditions': [ | |
341 ['OS=="android"', { | |
342 'sources!': [ | |
343 'policy/core/common/fake_async_policy_loader.cc', | |
344 'policy/core/common/fake_async_policy_loader.h', | |
345 ], | |
346 }], | |
347 ['chromeos==1', { | |
348 'sources!': [ | |
349 'policy/core/common/cloud/mock_user_cloud_policy_store.cc', | |
350 'policy/core/common/cloud/mock_user_cloud_policy_store.h', | |
351 ], | |
352 }], | |
353 ], | |
354 }, | |
355 ], | |
356 }], | |
357 ['OS=="android"', | |
358 { | |
359 'targets' : [ | |
360 { | |
361 'target_name' : 'policy_jni_headers', | |
362 'type': 'none', | |
363 'sources': [ | |
364 'policy/android/java/src/org/chromium/policy/CombinedPolicyProvider.
java', | |
365 'policy/android/java/src/org/chromium/policy/PolicyConverter.java', | |
366 ], | |
367 'variables': { | |
368 'jni_gen_package': 'policy', | |
369 }, | |
370 'includes': [ '../build/jni_generator.gypi' ], | |
371 }, | |
372 { | |
373 'target_name': 'components_policy_junit_tests', | |
374 'type': 'none', | |
375 'dependencies': [ | |
376 '../testing/android/junit/junit_test.gyp:junit_test_support', | |
377 ], | |
378 'variables': { | |
379 'main_class': 'org.chromium.testing.local.JunitTestMain', | |
380 'src_paths': [ | |
381 '../testing/android/junit/DummyTest.java', | |
382 ], | |
383 'wrapper_script_name': 'helper/<(_target_name)', | |
384 }, | |
385 'includes': [ '../build/host_jar.gypi' ], | |
386 }, | |
387 ], | |
388 }], | |
389 ['OS=="android" and configuration_policy==1', { | |
390 'targets': [ | |
391 { | |
392 'target_name': 'app_restrictions_resources', | |
393 'type': 'none', | |
394 'variables': { | |
395 'resources_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip', | |
396 'input_resources_dir': | |
397 '<(SHARED_INTERMEDIATE_DIR)/chrome/app/policy/android', | |
398 'create_zip_script': '../build/android/gyp/zip.py', | |
399 }, | |
400 'copies': [ | |
401 { | |
402 'destination': '<(input_resources_dir)/xml-v21/', | |
403 'files': [ | |
404 '<(SHARED_INTERMEDIATE_DIR)/policy/app_restrictions.xml' | |
405 ], | |
406 }, | |
407 ], | |
408 'actions': [ | |
409 { | |
410 'action_name': 'create_resources_zip', | |
411 'inputs': [ | |
412 '<(create_zip_script)', | |
413 '<(input_resources_dir)/xml-v21/app_restrictions.xml', | |
414 '<(input_resources_dir)/values-v21/restriction_values.xml', | |
415 ], | |
416 'outputs': [ | |
417 '<(resources_zip)' | |
418 ], | |
419 'action': [ | |
420 'python', '<(create_zip_script)', | |
421 '--input-dir', '<(input_resources_dir)', | |
422 '--output', '<(resources_zip)', | |
423 ], | |
424 } | |
425 ], | |
426 'all_dependent_settings': { | |
427 'variables': { | |
428 'additional_input_paths': ['<(resources_zip)'], | |
429 'dependencies_res_zip_paths': ['<(resources_zip)'], | |
430 }, | |
431 }, | |
432 }, | |
433 { | |
434 # GN: //components/policy/android:policy_java | |
435 'target_name': 'policy_java', | |
436 'type': 'none', | |
437 'dependencies': [ | |
438 '../base/base.gyp:base_java', | |
439 ], | |
440 'variables': { | |
441 'java_in_dir': 'policy/android/java', | |
442 }, | |
443 'includes': [ '../build/java.gypi' ], | |
444 }, | |
445 { | |
446 # GN: //components/policy/android:policy_java_test_support | |
447 'target_name': 'policy_java_test_support', | |
448 'type': 'none', | |
449 'dependencies': [ | |
450 '../base/base.gyp:base_java', | |
451 '../base/base.gyp:base_java_test_support', | |
452 'policy_java' | |
453 ], | |
454 'variables': { | |
455 'java_in_dir': 'policy/android/javatests', | |
456 }, | |
457 'includes': [ '../build/java.gypi' ], | |
458 }, | |
459 ], | |
460 }], | |
461 ['OS=="win" and target_arch=="ia32" and configuration_policy==1', { | |
462 'targets': [ | |
463 { | |
464 'target_name': 'policy_win64', | |
465 'type': 'static_library', | |
466 'hard_dependency': 1, | |
467 'sources': [ | |
468 '<(policy_constant_header_path)', | |
469 '<(policy_constant_source_path)', | |
470 '<(risk_tag_header_path)', | |
471 ], | |
472 'include_dirs': [ | |
473 '<(DEPTH)', | |
474 ], | |
475 'direct_dependent_settings': { | |
476 'include_dirs': [ | |
477 '<(policy_out_dir)' | |
478 ], | |
479 }, | |
480 'dependencies': [ | |
481 'cloud_policy_code_generate', | |
482 ], | |
483 'configurations': { | |
484 'Common_Base': { | |
485 'msvs_target_platform': 'x64', | |
486 }, | |
487 }, | |
488 }, | |
489 ], | |
490 }], | |
491 ['OS!="ios"', { | |
492 'targets': [ | |
493 { | |
494 # policy_templates has different inputs and outputs, so it can't use | |
495 # the rules of chrome_strings | |
496 'target_name': 'policy_templates', | |
497 'type': 'none', | |
498 'variables': { | |
499 'grit_grd_file': 'policy/resources/policy_templates.grd', | |
500 'grit_info_cmd': [ | |
501 'python', | |
502 '<(DEPTH)/tools/grit/grit_info.py', | |
503 '<@(grit_defines)', | |
504 ], | |
505 }, | |
506 'includes': [ | |
507 '../build/grit_target.gypi', | |
508 ], | |
509 'actions': [ | |
510 { | |
511 'action_name': 'policy_templates', | |
512 'includes': [ | |
513 '../build/grit_action.gypi', | |
514 ], | |
515 }, | |
516 ], | |
517 }, | |
518 ], | |
519 }], | |
520 ['OS=="mac"', { | |
521 'targets': [ | |
522 { | |
523 # This is the bundle of the manifest file of Chrome. | |
524 # It contains the manifest file and its string tables. | |
525 'target_name': 'chrome_manifest_bundle', | |
526 'type': 'loadable_module', | |
527 'mac_bundle': 1, | |
528 'product_extension': 'manifest', | |
529 'product_name': '<(mac_bundle_id)', | |
530 'variables': { | |
531 # This avoids stripping debugging symbols from the target, which | |
532 # would fail because there is no binary code here. | |
533 'mac_strip': 0, | |
534 }, | |
535 'dependencies': [ | |
536 # Provides app-Manifest.plist and its string tables: | |
537 'policy_templates', | |
538 ], | |
539 'actions': [ | |
540 { | |
541 'action_name': 'Copy MCX manifest file to manifest bundle', | |
542 'inputs': [ | |
543 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist', | |
544 ], | |
545 'outputs': [ | |
546 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest', | |
547 ], | |
548 'action': [ | |
549 # Use plutil -convert xml1 to put the plist into Apple's | |
550 # canonical format. As a side effect, this ensures that the | |
551 # plist is well-formed. | |
552 'plutil', | |
553 '-convert', | |
554 'xml1', | |
555 '<@(_inputs)', | |
556 '-o', | |
557 '<@(_outputs)', | |
558 ], | |
559 'message': | |
560 'Copying the MCX policy manifest file to the manifest bundle', | |
561 'process_outputs_as_mac_bundle_resources': 1, | |
562 }, | |
563 { | |
564 'action_name': | |
565 'Copy Localizable.strings files to manifest bundle', | |
566 'variables': { | |
567 'input_path': '<(grit_out_dir)/app/policy/mac/strings', | |
568 # Directory to collect the Localizable.strings files before | |
569 # they are copied to the bundle. | |
570 'output_path': '<(INTERMEDIATE_DIR)/app_manifest', | |
571 # The reason we are not enumerating all the locales is that | |
572 # the translations would eat up 3.5MB disk space in the | |
573 # application bundle: | |
574 'available_locales': 'en', | |
575 }, | |
576 'inputs': [ | |
577 # TODO: remove this helper when we have loops in GYP | |
578 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Loca
lizable.strings\' <(available_locales))', | |
579 ], | |
580 'outputs': [ | |
581 # TODO: remove this helper when we have loops in GYP | |
582 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Loc
alizable.strings\' <(available_locales))', | |
583 ], | |
584 'action': [ | |
585 'cp', '-R', | |
586 '<(input_path)/', | |
587 '<(output_path)', | |
588 ], | |
589 'message': | |
590 'Copy the Localizable.strings files to the manifest bundle', | |
591 'process_outputs_as_mac_bundle_resources': 1, | |
592 }, | |
593 ], | |
594 }, | |
595 ], | |
596 }], | |
597 ], | |
598 } | |
OLD | NEW |