OLD | NEW |
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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
10 import("//third_party/android_platform/config.gni") | 10 import("//third_party/android_platform/config.gni") |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 # target which are *generated* by a dependency. |generated_resource_files| | 569 # target which are *generated* by a dependency. |generated_resource_files| |
570 # must be specified if |generated_resource_dirs| is specified. | 570 # must be specified if |generated_resource_dirs| is specified. |
571 # generated_resource_files: List of all files in |generated_resource_dirs|. | 571 # generated_resource_files: List of all files in |generated_resource_dirs|. |
572 # |generated_resource_dirs| must be specified in |generated_resource_files| | 572 # |generated_resource_dirs| must be specified in |generated_resource_files| |
573 # is specified. | 573 # is specified. |
574 # android_manifest: AndroidManifest.xml for this target. Defaults to | 574 # android_manifest: AndroidManifest.xml for this target. Defaults to |
575 # //build/android/AndroidManifest.xml. | 575 # //build/android/AndroidManifest.xml. |
576 # custom_package: java package for generated .java files. | 576 # custom_package: java package for generated .java files. |
577 # v14_skip: If true, don't run v14 resource generator on this. Defaults to | 577 # v14_skip: If true, don't run v14 resource generator on this. Defaults to |
578 # false. (see build/android/gyp/generate_v14_compatible_resources.py) | 578 # false. (see build/android/gyp/generate_v14_compatible_resources.py) |
579 # | |
580 # shared_resources: If true make a resource package that can be loaded by a | 579 # shared_resources: If true make a resource package that can be loaded by a |
581 # different application at runtime to access the package's resources. | 580 # different application at runtime to access the package's resources. |
582 # | 581 # app_as_shared_lib: If true make a resource package that can be loaded as |
| 582 # both shared_resources and normal application. |
583 | 583 |
584 # Example: | 584 # Example: |
585 # android_resources("foo_resources") { | 585 # android_resources("foo_resources") { |
586 # deps = [":foo_strings_grd"] | 586 # deps = [":foo_strings_grd"] |
587 # resource_dirs = ["res"] | 587 # resource_dirs = ["res"] |
588 # custom_package = "org.chromium.foo" | 588 # custom_package = "org.chromium.foo" |
589 # } | 589 # } |
590 # | 590 # |
591 # android_resources("foo_resources_overrides") { | 591 # android_resources("foo_resources_overrides") { |
592 # deps = [":foo_resources"] | 592 # deps = [":foo_resources"] |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 type = "android_resources" | 628 type = "android_resources" |
629 resources_zip = zip_path | 629 resources_zip = zip_path |
630 srcjar = srcjar_path | 630 srcjar = srcjar_path |
631 } | 631 } |
632 | 632 |
633 process_resources(process_resources_target_name) { | 633 process_resources(process_resources_target_name) { |
634 visibility = [ ":$final_target_name" ] | 634 visibility = [ ":$final_target_name" ] |
635 deps = [] | 635 deps = [] |
636 forward_variables_from(invoker, | 636 forward_variables_from(invoker, |
637 [ | 637 [ |
| 638 "app_as_shared_lib", |
638 "android_manifest", | 639 "android_manifest", |
639 "custom_package", | 640 "custom_package", |
640 "deps", | 641 "deps", |
641 "generated_resource_dirs", | 642 "generated_resource_dirs", |
642 "generated_resource_files", | 643 "generated_resource_files", |
643 "resource_dirs", | 644 "resource_dirs", |
644 "shared_resources", | 645 "shared_resources", |
645 "v14_skip", | 646 "v14_skip", |
646 ]) | 647 ]) |
647 deps += [ ":$build_config_target_name" ] | 648 deps += [ ":$build_config_target_name" ] |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 requires_android = true | 1176 requires_android = true |
1176 } | 1177 } |
1177 } | 1178 } |
1178 | 1179 |
1179 # Declare an Android apk target | 1180 # Declare an Android apk target |
1180 # | 1181 # |
1181 # This target creates an Android APK containing java code, resources, assets, | 1182 # This target creates an Android APK containing java code, resources, assets, |
1182 # and (possibly) native libraries. | 1183 # and (possibly) native libraries. |
1183 # | 1184 # |
1184 # Variables | 1185 # Variables |
| 1186 # alternative_android_sdk_jar: The alternative android sdk jar used in |
| 1187 # proguard. |
| 1188 # android_aapt_path: Android aapt tool to replace default one to build |
| 1189 # resource. |
1185 # android_manifest: Path to AndroidManifest.xml. | 1190 # android_manifest: Path to AndroidManifest.xml. |
1186 # android_manifest_dep: Target that generates AndroidManifest (if applicable) | 1191 # android_manifest_dep: Target that generates AndroidManifest (if applicable) |
1187 # chromium_code: If true, extra analysis warning/errors will be enabled. | 1192 # chromium_code: If true, extra analysis warning/errors will be enabled. |
1188 # data_deps: List of dependencies needed at runtime. These will be built but | 1193 # data_deps: List of dependencies needed at runtime. These will be built but |
1189 # won't change the generated .apk in any way (in fact they may be built | 1194 # won't change the generated .apk in any way (in fact they may be built |
1190 # after the .apk is). | 1195 # after the .apk is). |
1191 # deps: List of dependencies. All Android java resources and libraries in the | 1196 # deps: List of dependencies. All Android java resources and libraries in the |
1192 # "transitive closure" of these dependencies will be included in the apk. | 1197 # "transitive closure" of these dependencies will be included in the apk. |
1193 # Note: this "transitive closure" actually only includes such targets if | 1198 # Note: this "transitive closure" actually only includes such targets if |
1194 # they are depended on through android_library or android_resources targets | 1199 # they are depended on through android_library or android_resources targets |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 native_libs = _native_libs | 1407 native_libs = _native_libs |
1403 } | 1408 } |
1404 | 1409 |
1405 _final_deps = [] | 1410 _final_deps = [] |
1406 | 1411 |
1407 _generated_proguard_config = "$base_path.resources.proguard.txt" | 1412 _generated_proguard_config = "$base_path.resources.proguard.txt" |
1408 process_resources_target = "${_template_name}__process_resources" | 1413 process_resources_target = "${_template_name}__process_resources" |
1409 process_resources(process_resources_target) { | 1414 process_resources(process_resources_target) { |
1410 forward_variables_from(invoker, | 1415 forward_variables_from(invoker, |
1411 [ | 1416 [ |
| 1417 "android_aapt_path", |
| 1418 "app_as_shared_lib", |
1412 "include_all_resources", | 1419 "include_all_resources", |
1413 "shared_resources", | 1420 "shared_resources", |
1414 ]) | 1421 ]) |
1415 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1422 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1416 r_text_path = "${target_gen_dir}/${target_name}_R.txt" | 1423 r_text_path = "${target_gen_dir}/${target_name}_R.txt" |
1417 android_manifest = _android_manifest | 1424 android_manifest = _android_manifest |
1418 resource_dirs = [ "//build/android/ant/empty/res" ] | 1425 resource_dirs = [ "//build/android/ant/empty/res" ] |
1419 zip_path = resources_zip_path | 1426 zip_path = resources_zip_path |
1420 all_resources_zip_path = _all_resources_zip_path | 1427 all_resources_zip_path = _all_resources_zip_path |
1421 generate_constant_ids = true | 1428 generate_constant_ids = true |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 } | 1540 } |
1534 } | 1541 } |
1535 | 1542 |
1536 if (_proguard_enabled) { | 1543 if (_proguard_enabled) { |
1537 _proguard_configs = [ _generated_proguard_config ] | 1544 _proguard_configs = [ _generated_proguard_config ] |
1538 if (defined(invoker.proguard_configs)) { | 1545 if (defined(invoker.proguard_configs)) { |
1539 _proguard_configs += invoker.proguard_configs | 1546 _proguard_configs += invoker.proguard_configs |
1540 } | 1547 } |
1541 _proguard_target = "${_template_name}__proguard" | 1548 _proguard_target = "${_template_name}__proguard" |
1542 proguard(_proguard_target) { | 1549 proguard(_proguard_target) { |
| 1550 forward_variables_from(invoker, [ "alternative_android_sdk_jar" ]) |
1543 deps = [ | 1551 deps = [ |
1544 ":$build_config_target", | 1552 ":$build_config_target", |
1545 ":$java_target", | 1553 ":$java_target", |
1546 ":$process_resources_target", | 1554 ":$process_resources_target", |
1547 ] | 1555 ] |
1548 inputs = [ | 1556 inputs = [ |
1549 _build_config, | 1557 _build_config, |
1550 _jar_path, | 1558 _jar_path, |
1551 ] + _proguard_configs | 1559 ] + _proguard_configs |
1552 | 1560 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 } | 1670 } |
1663 if (defined(invoker.loadable_modules) && invoker.loadable_modules != []) { | 1671 if (defined(invoker.loadable_modules) && invoker.loadable_modules != []) { |
1664 _extra_native_libs_even_when_incremental += invoker.loadable_modules | 1672 _extra_native_libs_even_when_incremental += invoker.loadable_modules |
1665 } | 1673 } |
1666 | 1674 |
1667 _final_deps += [ ":${_template_name}__create" ] | 1675 _final_deps += [ ":${_template_name}__create" ] |
1668 create_apk("${_template_name}__create") { | 1676 create_apk("${_template_name}__create") { |
1669 deps = [] | 1677 deps = [] |
1670 forward_variables_from(invoker, | 1678 forward_variables_from(invoker, |
1671 [ | 1679 [ |
| 1680 "android_aapt_path", |
| 1681 "app_as_shared_lib", |
1672 "deps", | 1682 "deps", |
1673 "extensions_to_not_compress", | 1683 "extensions_to_not_compress", |
1674 "language_splits", | 1684 "language_splits", |
1675 "public_deps", | 1685 "public_deps", |
1676 "shared_resources", | 1686 "shared_resources", |
1677 "write_asset_list", | 1687 "write_asset_list", |
1678 ]) | 1688 ]) |
1679 apk_path = _final_apk_path | 1689 apk_path = _final_apk_path |
1680 android_manifest = _android_manifest | 1690 android_manifest = _android_manifest |
1681 assets_build_config = _build_config | 1691 assets_build_config = _build_config |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 | 1764 |
1755 keystore_name = _keystore_name | 1765 keystore_name = _keystore_name |
1756 keystore_path = _keystore_path | 1766 keystore_path = _keystore_path |
1757 keystore_password = _keystore_password | 1767 keystore_password = _keystore_password |
1758 | 1768 |
1759 # Placeholders necessary for some older devices. | 1769 # Placeholders necessary for some older devices. |
1760 # http://crbug.com/395038 | 1770 # http://crbug.com/395038 |
1761 deps = [] | 1771 deps = [] |
1762 forward_variables_from(invoker, | 1772 forward_variables_from(invoker, |
1763 [ | 1773 [ |
| 1774 "android_aapt_path", |
1764 "deps", | 1775 "deps", |
1765 "native_lib_placeholders", | 1776 "native_lib_placeholders", |
1766 "public_deps", | 1777 "public_deps", |
1767 ]) | 1778 ]) |
1768 | 1779 |
1769 incremental_deps = deps + _extra_native_libs_even_when_incremental_deps + | 1780 incremental_deps = deps + _extra_native_libs_even_when_incremental_deps + |
1770 [ ":$_manifest_rule" ] | 1781 [ ":$_manifest_rule" ] |
1771 deps = [] | 1782 deps = [] |
1772 deps = incremental_deps + _native_libs_deps + _extra_native_libs_deps + | 1783 deps = incremental_deps + _native_libs_deps + _extra_native_libs_deps + |
1773 [ _native_libs_file_arg_dep ] | 1784 [ _native_libs_file_arg_dep ] |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 } | 2246 } |
2236 | 2247 |
2237 android_library(target_name) { | 2248 android_library(target_name) { |
2238 java_files = [] | 2249 java_files = [] |
2239 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2250 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2240 deps = [ | 2251 deps = [ |
2241 "//third_party/android_protobuf:protobuf_nano_javalib", | 2252 "//third_party/android_protobuf:protobuf_nano_javalib", |
2242 ] | 2253 ] |
2243 } | 2254 } |
2244 } | 2255 } |
OLD | NEW |