Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: chrome/BUILD.gn

Issue 2344063002: Reland of Enable whitelisting for targets other than libchrome. (Closed)
Patch Set: fix gn gen Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/chrome_paks.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/buildflag_header.gni") 5 import("//build/buildflag_header.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/features.gni") 8 import("//build/config/features.gni")
9 import("//build/config/locales.gni") 9 import("//build/config/locales.gni")
10 import("//build/config/sanitizers/sanitizers.gni") 10 import("//build/config/sanitizers/sanitizers.gni")
11 import("//build/config/ui.gni") 11 import("//build/config/ui.gni")
12 import("//build/config/win/console_app.gni") 12 import("//build/config/win/console_app.gni")
13 import("//build/config/win/manifest.gni") 13 import("//build/config/win/manifest.gni")
14 import("//chrome/chrome_repack_locales.gni") 14 import("//chrome/chrome_paks.gni")
15 import("//chrome/common/features.gni") 15 import("//chrome/common/features.gni")
16 import("//chrome/version.gni") 16 import("//chrome/version.gni")
17 import("//third_party/widevine/cdm/widevine.gni") 17 import("//third_party/widevine/cdm/widevine.gni")
18 import("//ui/base/ui_features.gni") 18 import("//ui/base/ui_features.gni")
19 import("//v8/gni/v8.gni") 19 import("//v8/gni/v8.gni")
20 20
21 if (enable_resource_whitelist_generation) {
22 android_resource_whitelist = "$root_gen_dir/chrome/resource_whitelist.txt"
23 }
24
25 if (is_android) { 21 if (is_android) {
26 import("//build/config/android/rules.gni") 22 import("//build/config/android/rules.gni")
27 } else if (is_mac) { 23 } else if (is_mac) {
28 import("//build/compiled_action.gni") 24 import("//build/compiled_action.gni")
29 import("//build/config/mac/rules.gni") 25 import("//build/config/mac/rules.gni")
30 import("//build/config/mac/symbols.gni") 26 import("//build/config/mac/symbols.gni")
31 import("//build/mac/tweak_info_plist.gni") 27 import("//build/mac/tweak_info_plist.gni")
32 import("//build/util/branding.gni") 28 import("//build/util/branding.gni")
33 import("//build/util/version.gni") 29 import("//build/util/version.gni")
34 import("//build_overrides/v8.gni") 30 import("//build_overrides/v8.gni")
35 import("//media/cdm/ppapi/cdm_paths.gni") 31 import("//media/cdm/ppapi/cdm_paths.gni")
36 import("//third_party/icu/config.gni") 32 import("//third_party/icu/config.gni")
37 } 33 }
38 34
35 if (enable_resource_whitelist_generation) {
36 chrome_resource_whitelist = "$target_gen_dir/chrome_resource_whitelist.txt"
37 }
38
39 if (is_win) { 39 if (is_win) {
40 action("reorder_imports") { 40 action("reorder_imports") {
41 script = "//build/win/reorder-imports.py" 41 script = "//build/win/reorder-imports.py"
42 42
43 # See comment in chrome_dll.gypi in the hardlink_to_output 43 # See comment in chrome_dll.gypi in the hardlink_to_output
44 # target for why this cannot be 'initial' like the DLL. 44 # target for why this cannot be 'initial' like the DLL.
45 inputs = [ 45 inputs = [
46 "$root_out_dir/initialexe/chrome.exe", 46 "$root_out_dir/initialexe/chrome.exe",
47 ] 47 ]
48 outputs = [ 48 outputs = [
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 ] 990 ]
991 991
992 public_deps = [ 992 public_deps = [
993 ":chrome_dll", 993 ":chrome_dll",
994 ] 994 ]
995 995
996 deps = [ 996 deps = [
997 ":chrome_framework_helpers", 997 ":chrome_framework_helpers",
998 ":chrome_framework_plugins", 998 ":chrome_framework_plugins",
999 ":chrome_framework_resources", 999 ":chrome_framework_resources",
1000 ":repack_locales_pack", 1000 ":packed_resources",
1001 ":widevine_cdm_library", 1001 ":widevine_cdm_library",
1002 "//build/config/sanitizers:deps", 1002 "//build/config/sanitizers:deps",
1003 "//chrome/app/nibs:chrome_xibs", 1003 "//chrome/app/nibs:chrome_xibs",
1004 ] 1004 ]
1005 1005
1006 if (is_chrome_branded) { 1006 if (is_chrome_branded) {
1007 deps += [ ":default_apps" ] 1007 deps += [ ":default_apps" ]
1008 } 1008 }
1009 1009
1010 ldflags = [ 1010 ldflags = [
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 outputs = [ 1333 outputs = [
1334 "{{bundle_root_dir}}/Default Apps/{{source_file_part}}", 1334 "{{bundle_root_dir}}/Default Apps/{{source_file_part}}",
1335 ] 1335 ]
1336 } 1336 }
1337 1337
1338 # Force anybody that depends on this to get the default apps as data files. 1338 # Force anybody that depends on this to get the default apps as data files.
1339 data = process_file_template(sources, outputs) 1339 data = process_file_template(sources, outputs)
1340 } 1340 }
1341 } 1341 }
1342 1342
1343 group("packed_resources") { 1343 chrome_paks("packed_resources") {
1344 public_deps = [ 1344 if (is_mac) {
1345 ":repack_chrome_100_percent", 1345 output_dir = "$root_gen_dir/repack"
1346 ":repack_locales_pack", 1346 copy_data_to_bundle = true
1347 ] 1347 } else {
1348 output_dir = root_out_dir
1349 }
1350
1351 if (enable_resource_whitelist_generation) {
1352 repack_whitelist = chrome_resource_whitelist
1353 deps = [
1354 "//chrome:resource_whitelist",
1355 ]
1356 }
1348 1357
1349 if (is_chrome_branded && !is_mac && !is_android) { 1358 if (is_chrome_branded && !is_mac && !is_android) {
1350 public_deps += [ ":default_apps" ] 1359 public_deps = [
1351 } 1360 ":default_apps",
1352 1361 ]
1353 if (enable_hidpi) {
1354 public_deps += [ ":repack_chrome_200_percent" ]
1355 } 1362 }
1356 } 1363 }
1357 1364
1358 repack("packed_extra_resources") { 1365 chrome_extra_paks("packed_extra_resources") {
1359 visibility = [ "./*" ]
1360 sources = [
1361 "$root_gen_dir/blink/public/resources/blink_resources.pak",
1362 "$root_gen_dir/chrome/browser_resources.pak",
1363 "$root_gen_dir/chrome/chrome_unscaled_resources.pak",
1364 "$root_gen_dir/chrome/common_resources.pak",
1365 "$root_gen_dir/chrome/invalidations_resources.pak",
1366 "$root_gen_dir/chrome/net_internals_resources.pak",
1367 "$root_gen_dir/chrome/password_manager_internals_resources.pak",
1368 "$root_gen_dir/chrome/policy_resources.pak",
1369 "$root_gen_dir/chrome/translate_internals_resources.pak",
1370 "$root_gen_dir/components/components_resources.pak",
1371 "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
1372 "$root_gen_dir/content/content_resources.pak",
1373 "$root_gen_dir/net/net_resources.pak",
1374 "$root_gen_dir/ui/resources/webui_resources.pak",
1375 ]
1376 deps = [
1377 "//chrome/app/theme:chrome_unscaled_resources",
1378 "//chrome/browser:resources",
1379 "//chrome/browser/resources:invalidations_resources",
1380 "//chrome/browser/resources:net_internals_resources",
1381 "//chrome/browser/resources:password_manager_internals_resources",
1382 "//chrome/browser/resources:policy_resources",
1383 "//chrome/browser/resources:translate_internals_resources",
1384 "//chrome/common:resources",
1385 "//components/resources",
1386 "//content:resources",
1387 "//content/browser/tracing:resources",
1388 "//net:net_resources",
1389 "//third_party/WebKit/public:resources",
1390 "//ui/resources",
1391 ]
1392
1393 if (is_android) {
1394 sources += [ "$root_gen_dir/android_webview/aw_resources.pak" ]
1395 deps += [ "//android_webview:generate_aw_resources" ]
1396 } else { # Non-Android.
1397 # New paks should be added here by default.
1398 sources += [
1399 "$root_gen_dir/blink/devtools_resources.pak",
1400 "$root_gen_dir/chrome/component_extension_resources.pak",
1401 "$root_gen_dir/chrome/options_resources.pak",
1402 "$root_gen_dir/chrome/quota_internals_resources.pak",
1403 "$root_gen_dir/chrome/settings_resources.pak",
1404 "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
1405 ]
1406 deps += [
1407 "//chrome/browser/resources:component_extension_resources",
1408 "//chrome/browser/resources:options_resources",
1409 "//chrome/browser/resources:quota_internals_resources",
1410 "//chrome/browser/resources:settings_resources",
1411 "//chrome/browser/resources:sync_file_system_internals_resources",
1412 "//content/browser/devtools:devtools_resources",
1413 ]
1414 }
1415 if (is_chromeos) {
1416 sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
1417 deps += [ "//ui/file_manager:resources" ]
1418 }
1419 if (enable_extensions) {
1420 sources += [
1421 "$root_gen_dir/extensions/extensions_renderer_resources.pak",
1422 "$root_gen_dir/extensions/extensions_resources.pak",
1423 ]
1424 deps += [ "//extensions:extensions_resources" ]
1425 }
1426
1427 if (is_mac) { 1366 if (is_mac) {
1428 output = "$root_gen_dir/repack/resources.pak" 1367 output_dir = "$root_gen_dir/repack"
1368 copy_data_to_bundle = true
1429 } else { 1369 } else {
1430 output = "$root_out_dir/resources.pak" 1370 output_dir = root_out_dir
1431 } 1371 }
1432 1372
1433 copy_data_to_bundle = is_mac 1373 copy_data_to_bundle = is_mac
1434 if (enable_resource_whitelist_generation) { 1374 if (enable_resource_whitelist_generation) {
1435 repack_whitelist = android_resource_whitelist 1375 repack_whitelist = chrome_resource_whitelist
1436 deps += [ ":resource_whitelist" ] 1376 deps = [
1377 ":resource_whitelist",
1378 ]
1437 } 1379 }
1438 } 1380 }
1439 1381
1440 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak 1382 # GYP version: chrome/chrome_resources.gyp:browser_tests_pak
1441 repack("browser_tests_pak") { 1383 repack("browser_tests_pak") {
1442 sources = [ 1384 sources = [
1443 "$root_gen_dir/chrome/options_test_resources.pak", 1385 "$root_gen_dir/chrome/options_test_resources.pak",
1444 "$root_gen_dir/chrome/webui_test_resources.pak", 1386 "$root_gen_dir/chrome/webui_test_resources.pak",
1445 ] 1387 ]
1446 output = "$root_out_dir/browser_tests.pak" 1388 output = "$root_out_dir/browser_tests.pak"
1447 deps = [ 1389 deps = [
1448 "//chrome/browser/resources:options_test_resources", 1390 "//chrome/browser/resources:options_test_resources",
1449 "//chrome/test/data:webui_test_resources", 1391 "//chrome/test/data:webui_test_resources",
1450 ] 1392 ]
1451 } 1393 }
1452 1394
1453 # Collects per-locale grit files from many sources into global per-locale files.
1454 chrome_repack_locales("repack_locales_pack") {
1455 visibility = [ ":*" ]
1456
1457 input_locales = locales
1458 copy_data_to_bundle = is_mac
1459
1460 if (is_mac) {
1461 output_locales = locales_as_mac_outputs
1462 } else {
1463 output_locales = locales
1464 }
1465
1466 if (enable_resource_whitelist_generation) {
1467 repack_whitelist = android_resource_whitelist
1468 deps = [
1469 ":resource_whitelist",
1470 ]
1471 }
1472 }
1473
1474 # Generates a rule to repack a set of resources, substituting a given string
1475 # in for the percentage (e.g. "100", "200"). It generates the repacked files in
1476 # the "gen" directory, and then introduces a copy rule to copy it to the root
1477 # build directory.
1478 #
1479 # It's not clear why this two-step dance is necessary as opposed to just
1480 # generating the file in the destination. However, this is what the GYP build
1481 # does, and for maintenance purposes, this keeps the same files in the same
1482 # place between the two builds when possible.
1483 #
1484 # Argument:
1485 # percent [required]
1486 # String to substitute for the percentage.
1487 template("chrome_repack_percent") {
1488 percent = invoker.percent
1489
1490 repack_name = "${target_name}_repack"
1491 repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
1492
1493 copy_name = target_name
1494
1495 repack(repack_name) {
1496 visibility = [ ":$copy_name" ]
1497
1498 # All sources should also have deps for completeness.
1499 sources = [
1500 "$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_per cent.pak",
1501 "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
1502 "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak",
1503 "$root_gen_dir/components/components_resources_${percent}_percent.pak",
1504 "$root_gen_dir/content/app/resources/content_resources_${percent}_percent. pak",
1505 "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
1506 ]
1507
1508 deps = [
1509 "//chrome/app/theme:theme_resources",
1510 "//chrome/renderer:resources",
1511 "//components/resources",
1512 "//components/strings",
1513 "//content/app/resources",
1514 "//net:net_resources",
1515 "//third_party/WebKit/public:image_resources",
1516 "//ui/resources",
1517 ]
1518
1519 if (use_ash) {
1520 sources +=
1521 [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
1522 deps += [ "//ash/resources" ]
1523 }
1524 if (toolkit_views) {
1525 sources += [ "$root_gen_dir/ui/views/resources/views_resources_${percent}_ percent.pak" ]
1526 deps += [ "//ui/views/resources" ]
1527 }
1528 if (is_chromeos) {
1529 sources += [ "$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${ percent}_percent.pak" ]
1530 deps += [ "//ui/chromeos/resources" ]
1531 }
1532 if (enable_extensions) {
1533 sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${perc ent}_percent.pak" ]
1534 deps += [ "//extensions:extensions_browser_resources" ]
1535 }
1536 if (enable_app_list) {
1537 sources += [ "$root_gen_dir/ui/app_list/resources/app_list_resources_${per cent}_percent.pak" ]
1538 deps += [ "//ui/app_list/resources" ]
1539 }
1540
1541 output = repack_output_file
1542 copy_data_to_bundle = is_mac
1543
1544 if (enable_resource_whitelist_generation) {
1545 repack_whitelist = android_resource_whitelist
1546 deps += [ ":resource_whitelist" ]
1547 }
1548 }
1549
1550 copy(copy_name) {
1551 visibility = [ ":*" ]
1552 deps = [
1553 ":$repack_name",
1554 ]
1555 sources = [
1556 repack_output_file,
1557 ]
1558 outputs = [
1559 "$root_build_dir/chrome_${percent}_percent.pak",
1560 ]
1561 }
1562 }
1563
1564 chrome_repack_percent("repack_chrome_100_percent") {
1565 percent = "100"
1566 }
1567
1568 if (enable_hidpi) {
1569 chrome_repack_percent("repack_chrome_200_percent") {
1570 percent = "200"
1571 }
1572 }
1573
1574 # GYP version: chrome/chrome_resources.gyp:chrome_strings 1395 # GYP version: chrome/chrome_resources.gyp:chrome_strings
1575 group("strings") { 1396 group("strings") {
1576 public_deps = [ 1397 public_deps = [
1577 "//chrome/app:chromium_strings", 1398 "//chrome/app:chromium_strings",
1578 "//chrome/app:generated_resources", 1399 "//chrome/app:generated_resources",
1579 "//chrome/app:google_chrome_strings", 1400 "//chrome/app:google_chrome_strings",
1580 "//chrome/app/resources:locale_settings", 1401 "//chrome/app/resources:locale_settings",
1581 ] 1402 ]
1582 } 1403 }
1583 1404
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 "//chrome/renderer", 1474 "//chrome/renderer",
1654 "//chrome/utility", 1475 "//chrome/utility",
1655 "//components/safe_browsing_db:safe_browsing_db_mobile", 1476 "//components/safe_browsing_db:safe_browsing_db_mobile",
1656 "//content/public/app:both", 1477 "//content/public/app:both",
1657 ] 1478 ]
1658 } 1479 }
1659 } 1480 }
1660 1481
1661 if (enable_resource_whitelist_generation) { 1482 if (enable_resource_whitelist_generation) {
1662 action("resource_whitelist") { 1483 action("resource_whitelist") {
1484 assert(is_android,
1485 "Resource whitelist currently implemented only on Android")
1486
1663 deps = [ 1487 deps = [
1664 "//chrome/android:chrome", 1488 "//chrome/android:chrome",
1665 ] 1489 ]
1666 script = "//tools/resources/generate_resource_whitelist.py" 1490 script = "//tools/resources/generate_resource_whitelist.py"
1667 1491
1668 _infile = "$root_out_dir/libchrome$shlib_extension.whitelist" 1492 _infile = "$root_out_dir/libchrome$shlib_extension.whitelist"
1669 inputs = [ 1493 inputs = [
1670 _infile, 1494 _infile,
1671 ] 1495 ]
1672 1496
1673 _outfile = android_resource_whitelist 1497 _outfile = chrome_resource_whitelist
1674 outputs = [ 1498 outputs = [
1675 _outfile, 1499 _outfile,
1676 ] 1500 ]
1677 1501
1678 args = [ 1502 args = [
1679 "-i", 1503 "-i",
1680 rebase_path(_infile, root_build_dir), 1504 rebase_path(_infile, root_build_dir),
1681 "-o", 1505 "-o",
1682 rebase_path(_outfile, root_build_dir), 1506 rebase_path(_outfile, root_build_dir),
1683 "--out-dir=.", 1507 "--out-dir=.",
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 "//chrome/app/theme/$branding_path_component/product_logo_48.png", 1586 "//chrome/app/theme/$branding_path_component/product_logo_48.png",
1763 "//chrome/tools/build/linux/chrome-wrapper", 1587 "//chrome/tools/build/linux/chrome-wrapper",
1764 "//third_party/xdg-utils/scripts/xdg-mime", 1588 "//third_party/xdg-utils/scripts/xdg-mime",
1765 "//third_party/xdg-utils/scripts/xdg-settings", 1589 "//third_party/xdg-utils/scripts/xdg-settings",
1766 ] 1590 ]
1767 outputs = [ 1591 outputs = [
1768 "$root_out_dir/{{source_file_part}}", 1592 "$root_out_dir/{{source_file_part}}",
1769 ] 1593 ]
1770 } 1594 }
1771 } 1595 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_paks.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698