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

Side by Side Diff: build/config/android/internal_rules.gni

Issue 1551863002: Port android_aapt_path, app_as_shared_lib and alternative_sdk to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 11 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 | build/config/android/rules.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/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/zip.gni") 7 import("//build/config/zip.gni")
8 import("//third_party/ijar/ijar.gni") 8 import("//third_party/ijar/ijar.gni")
9 9
10 assert(is_android) 10 assert(is_android)
11 11
12 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) 12 rebased_android_sdk = rebase_path(android_sdk, root_build_dir)
13 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) 13 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir)
14 rebased_android_sdk_build_tools = 14 rebased_android_sdk_build_tools =
15 rebase_path(android_sdk_build_tools, root_build_dir) 15 rebase_path(android_sdk_build_tools, root_build_dir)
16 16
17 android_sdk_jar = "$android_sdk/android.jar" 17 android_sdk_jar = "$android_sdk/android.jar"
18 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) 18 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
19 android_aapt_path = "$rebased_android_sdk_build_tools/aapt" 19 android_default_aapt_path = "$rebased_android_sdk_build_tools/aapt"
20 20
21 android_configuration_name = "Release" 21 android_configuration_name = "Release"
22 if (is_debug) { 22 if (is_debug) {
23 android_configuration_name = "Debug" 23 android_configuration_name = "Debug"
24 } 24 }
25 25
26 template("android_lint") { 26 template("android_lint") {
27 set_sources_assignment_filter([]) 27 set_sources_assignment_filter([])
28 28
29 jar_path = invoker.jar_path 29 jar_path = invoker.jar_path
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 [ 82 [
83 "deps", 83 "deps",
84 "data_deps", 84 "data_deps",
85 "public_deps", 85 "public_deps",
86 "testonly", 86 "testonly",
87 ]) 87 ])
88 script = "//build/android/gyp/proguard.py" 88 script = "//build/android/gyp/proguard.py"
89 _proguard_jar_path = "//third_party/proguard/lib/proguard.jar" 89 _proguard_jar_path = "//third_party/proguard/lib/proguard.jar"
90 _output_jar_path = invoker.output_jar_path 90 _output_jar_path = invoker.output_jar_path
91 inputs = [ 91 inputs = [
92 android_sdk_jar,
93 _proguard_jar_path, 92 _proguard_jar_path,
94 ] 93 ]
94 if (defined(invoker.alternative_android_sdk_jar)) {
95 inputs += [ invoker.alternative_android_sdk_jar ]
96 _rebased_android_sdk_jar =
97 rebase_path(invoker.alternative_android_sdk_jar)
98 } else {
99 inputs += [ android_sdk_jar ]
100 _rebased_android_sdk_jar = rebased_android_sdk_jar
101 }
95 if (defined(invoker.inputs)) { 102 if (defined(invoker.inputs)) {
96 inputs += invoker.inputs 103 inputs += invoker.inputs
97 } 104 }
98 depfile = "${target_gen_dir}/${target_name}.d" 105 depfile = "${target_gen_dir}/${target_name}.d"
99 outputs = [ 106 outputs = [
100 depfile, 107 depfile,
101 _output_jar_path, 108 _output_jar_path,
102 "$_output_jar_path.dump", 109 "$_output_jar_path.dump",
103 "$_output_jar_path.seeds", 110 "$_output_jar_path.seeds",
104 "$_output_jar_path.mapping", 111 "$_output_jar_path.mapping",
105 "$_output_jar_path.usage", 112 "$_output_jar_path.usage",
106 ] 113 ]
107 args = [ 114 args = [
108 "--depfile", 115 "--depfile",
109 rebase_path(depfile, root_build_dir), 116 rebase_path(depfile, root_build_dir),
110 "--proguard-path", 117 "--proguard-path",
111 rebase_path(_proguard_jar_path, root_build_dir), 118 rebase_path(_proguard_jar_path, root_build_dir),
112 "--output-path", 119 "--output-path",
113 rebase_path(_output_jar_path, root_build_dir), 120 rebase_path(_output_jar_path, root_build_dir),
114 "--classpath", 121 "--classpath",
115 rebased_android_sdk_jar, 122 _rebased_android_sdk_jar,
116 ] 123 ]
117 if (defined(invoker.args)) { 124 if (defined(invoker.args)) {
118 args += invoker.args 125 args += invoker.args
119 } 126 }
120 } 127 }
121 } 128 }
122 129
123 template("findbugs") { 130 template("findbugs") {
124 jar_path = invoker.jar_path 131 jar_path = invoker.jar_path
125 132
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 _base_apk_path = _base_path + ".apk_intermediates" 868 _base_apk_path = _base_path + ".apk_intermediates"
862 869
863 _resource_packaged_apk_path = _base_apk_path + ".ap_" 870 _resource_packaged_apk_path = _base_apk_path + ".ap_"
864 _incremental_resource_packaged_apk_path = _base_apk_path + "_incremental.ap_" 871 _incremental_resource_packaged_apk_path = _base_apk_path + "_incremental.ap_"
865 _packaged_apk_path = _base_apk_path + ".unfinished.apk" 872 _packaged_apk_path = _base_apk_path + ".unfinished.apk"
866 _incremental_packaged_apk_path = 873 _incremental_packaged_apk_path =
867 _base_apk_path + "_incremental.unfinished.apk" 874 _base_apk_path + "_incremental.unfinished.apk"
868 _shared_resources = 875 _shared_resources =
869 defined(invoker.shared_resources) && invoker.shared_resources 876 defined(invoker.shared_resources) && invoker.shared_resources
870 assert(_shared_resources || true) # Mark as used. 877 assert(_shared_resources || true) # Mark as used.
878 _app_as_shared_lib =
879 defined(invoker.app_as_shared_lib) && invoker.app_as_shared_lib
880 assert(_app_as_shared_lib || true) # Mark as used.
881 assert(!(_shared_resources && _app_as_shared_lib))
871 882
872 _keystore_path = invoker.keystore_path 883 _keystore_path = invoker.keystore_path
873 _keystore_name = invoker.keystore_name 884 _keystore_name = invoker.keystore_name
874 _keystore_password = invoker.keystore_password 885 _keystore_password = invoker.keystore_password
875 886
876 _split_densities = [] 887 _split_densities = []
877 if (defined(invoker.create_density_splits) && invoker.create_density_splits) { 888 if (defined(invoker.create_density_splits) && invoker.create_density_splits) {
878 _split_densities = [ 889 _split_densities = [
879 "hdpi", 890 "hdpi",
880 "xhdpi", 891 "xhdpi",
(...skipping 18 matching lines...) Expand all
899 invoker.android_manifest, 910 invoker.android_manifest,
900 ] 911 ]
901 if (defined(_resources_zip)) { 912 if (defined(_resources_zip)) {
902 inputs += [ _resources_zip ] 913 inputs += [ _resources_zip ]
903 } 914 }
904 outputs = [ 915 outputs = [
905 depfile, 916 depfile,
906 invoker.resource_packaged_apk_path, 917 invoker.resource_packaged_apk_path,
907 ] 918 ]
908 919
920 if (defined(invoker.android_aapt_path)) {
921 _android_aapt_path = invoker.android_aapt_path
922 } else {
923 _android_aapt_path = android_default_aapt_path
924 }
925
909 args = [ 926 args = [
910 "--depfile", 927 "--depfile",
911 rebase_path(depfile, root_build_dir), 928 rebase_path(depfile, root_build_dir),
912 "--android-sdk", 929 "--android-sdk",
913 rebased_android_sdk, 930 rebased_android_sdk,
914 "--aapt-path", 931 "--aapt-path",
915 android_aapt_path, 932 _android_aapt_path,
916 "--configuration-name=$android_configuration_name", 933 "--configuration-name=$android_configuration_name",
917 "--android-manifest", 934 "--android-manifest",
918 rebase_path(invoker.android_manifest, root_build_dir), 935 rebase_path(invoker.android_manifest, root_build_dir),
919 "--version-code", 936 "--version-code",
920 _version_code, 937 _version_code,
921 "--version-name", 938 "--version-name",
922 _version_name, 939 _version_name,
923 "--apk-path", 940 "--apk-path",
924 rebase_path(invoker.resource_packaged_apk_path, root_build_dir), 941 rebase_path(invoker.resource_packaged_apk_path, root_build_dir),
925 ] 942 ]
926 943
927 if (defined(_resources_zip)) { 944 if (defined(_resources_zip)) {
928 args += [ 945 args += [
929 "--resource-zips", 946 "--resource-zips",
930 rebase_path(_resources_zip, root_build_dir), 947 rebase_path(_resources_zip, root_build_dir),
931 ] 948 ]
932 } 949 }
933 if (_shared_resources) { 950 if (_shared_resources) {
934 args += [ "--shared-resources" ] 951 args += [ "--shared-resources" ]
935 } 952 }
953 if (_app_as_shared_lib) {
954 args += [ "--app-as-shared-lib" ]
955 }
936 if (_split_densities != []) { 956 if (_split_densities != []) {
937 args += [ "--create-density-splits" ] 957 args += [ "--create-density-splits" ]
938 foreach(_density, _split_densities) { 958 foreach(_density, _split_densities) {
939 outputs += [ "${invoker.resource_packaged_apk_path}_${_density}" ] 959 outputs += [ "${invoker.resource_packaged_apk_path}_${_density}" ]
940 } 960 }
941 } 961 }
942 if (_split_languages != []) { 962 if (_split_languages != []) {
943 args += [ "--language-splits=$_split_languages" ] 963 args += [ "--language-splits=$_split_languages" ]
944 foreach(_language, _split_languages) { 964 foreach(_language, _split_languages) {
945 outputs += [ "${invoker.resource_packaged_apk_path}_${_language}" ] 965 outputs += [ "${invoker.resource_packaged_apk_path}_${_language}" ]
946 } 966 }
947 } 967 }
948 if (defined(invoker.extensions_to_not_compress)) { 968 if (defined(invoker.extensions_to_not_compress)) {
949 args += [ 969 args += [
950 "--no-compress", 970 "--no-compress",
951 invoker.extensions_to_not_compress, 971 invoker.extensions_to_not_compress,
952 ] 972 ]
953 } 973 }
954 } 974 }
955 } 975 }
956 976
957 _package_resources_target_name = "${target_name}__package_resources" 977 _package_resources_target_name = "${target_name}__package_resources"
958 package_resources_helper(_package_resources_target_name) { 978 package_resources_helper(_package_resources_target_name) {
959 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) 979 forward_variables_from(invoker,
980 [
981 "android_aapt_path",
982 "extensions_to_not_compress",
983 ])
960 deps = _deps 984 deps = _deps
961 android_manifest = _android_manifest 985 android_manifest = _android_manifest
962 resource_packaged_apk_path = _resource_packaged_apk_path 986 resource_packaged_apk_path = _resource_packaged_apk_path
963 } 987 }
964 988
965 _generate_incremental_manifest_target_name = 989 _generate_incremental_manifest_target_name =
966 "${target_name}_incremental_generate_manifest" 990 "${target_name}_incremental_generate_manifest"
967 _incremental_android_manifest = 991 _incremental_android_manifest =
968 get_label_info(_generate_incremental_manifest_target_name, 992 get_label_info(_generate_incremental_manifest_target_name,
969 "target_gen_dir") + "/AndroidManifest.xml" 993 "target_gen_dir") + "/AndroidManifest.xml"
(...skipping 22 matching lines...) Expand all
992 args += [ "--disable-isolated-processes" ] 1016 args += [ "--disable-isolated-processes" ]
993 } 1017 }
994 } 1018 }
995 1019
996 _incremental_package_resources_target_name = 1020 _incremental_package_resources_target_name =
997 "${target_name}_incremental__package_resources" 1021 "${target_name}_incremental__package_resources"
998 1022
999 # TODO(agrieve): See if we can speed up this step by swapping the manifest 1023 # TODO(agrieve): See if we can speed up this step by swapping the manifest
1000 # from the result of the main package_resources step. 1024 # from the result of the main package_resources step.
1001 package_resources_helper(_incremental_package_resources_target_name) { 1025 package_resources_helper(_incremental_package_resources_target_name) {
1002 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) 1026 forward_variables_from(invoker,
1027 [
1028 "android_aapt_path",
1029 "extensions_to_not_compress",
1030 ])
1003 deps = 1031 deps =
1004 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ] 1032 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ]
1005 android_manifest = _incremental_android_manifest 1033 android_manifest = _incremental_android_manifest
1006 resource_packaged_apk_path = _incremental_resource_packaged_apk_path 1034 resource_packaged_apk_path = _incremental_resource_packaged_apk_path
1007 } 1035 }
1008 1036
1009 package_target = "${target_name}__package" 1037 package_target = "${target_name}__package"
1010 package_apk(package_target) { 1038 package_apk(package_target) {
1011 forward_variables_from(invoker, 1039 forward_variables_from(invoker,
1012 [ 1040 [
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 sources += invoker.generated_resource_files 1756 sources += invoker.generated_resource_files
1729 } 1757 }
1730 1758
1731 inputs = [ 1759 inputs = [
1732 build_config, 1760 build_config,
1733 android_manifest, 1761 android_manifest,
1734 ] 1762 ]
1735 1763
1736 _rebased_all_resource_dirs = rebase_path(_all_resource_dirs, root_build_dir) 1764 _rebased_all_resource_dirs = rebase_path(_all_resource_dirs, root_build_dir)
1737 rebase_build_config = rebase_path(build_config, root_build_dir) 1765 rebase_build_config = rebase_path(build_config, root_build_dir)
1766
1767 if (defined(invoker.android_aapt_path)) {
1768 _android_aapt_path = invoker.android_aapt_path
1769 } else {
1770 _android_aapt_path = android_default_aapt_path
1771 }
1772
1738 args = [ 1773 args = [
1739 "--depfile", 1774 "--depfile",
1740 rebase_path(depfile, root_build_dir), 1775 rebase_path(depfile, root_build_dir),
1741 "--android-sdk", 1776 "--android-sdk",
1742 rebase_path(android_sdk, root_build_dir), 1777 rebase_path(android_sdk, root_build_dir),
1743 "--aapt-path", 1778 "--aapt-path",
1744 android_aapt_path, 1779 _android_aapt_path,
1745 "--android-manifest", 1780 "--android-manifest",
1746 rebase_path(android_manifest, root_build_dir), 1781 rebase_path(android_manifest, root_build_dir),
1747 "--resource-dirs=$_rebased_all_resource_dirs", 1782 "--resource-dirs=$_rebased_all_resource_dirs",
1748 "--srcjar-out", 1783 "--srcjar-out",
1749 rebase_path(srcjar_path, root_build_dir), 1784 rebase_path(srcjar_path, root_build_dir),
1750 "--resource-zip-out", 1785 "--resource-zip-out",
1751 rebase_path(zip_path, root_build_dir), 1786 rebase_path(zip_path, root_build_dir),
1752 "--r-text-out", 1787 "--r-text-out",
1753 rebase_path(r_text_path, root_build_dir), 1788 rebase_path(r_text_path, root_build_dir),
1754 "--dependencies-res-zips=@FileArg($rebase_build_config:resources:dependenc y_zips)", 1789 "--dependencies-res-zips=@FileArg($rebase_build_config:resources:dependenc y_zips)",
(...skipping 13 matching lines...) Expand all
1768 } 1803 }
1769 1804
1770 if (defined(invoker.v14_skip) && invoker.v14_skip) { 1805 if (defined(invoker.v14_skip) && invoker.v14_skip) {
1771 args += [ "--v14-skip" ] 1806 args += [ "--v14-skip" ]
1772 } 1807 }
1773 1808
1774 if (defined(invoker.shared_resources) && invoker.shared_resources) { 1809 if (defined(invoker.shared_resources) && invoker.shared_resources) {
1775 args += [ "--shared-resources" ] 1810 args += [ "--shared-resources" ]
1776 } 1811 }
1777 1812
1813 if (defined(invoker.app_as_shared_lib) && invoker.app_as_shared_lib) {
1814 args += [ "--app-as-shared-lib" ]
1815 }
1816
1778 if (defined(invoker.include_all_resources) && 1817 if (defined(invoker.include_all_resources) &&
1779 invoker.include_all_resources) { 1818 invoker.include_all_resources) {
1780 args += [ "--include-all-resources" ] 1819 args += [ "--include-all-resources" ]
1781 } 1820 }
1782 1821
1783 if (defined(invoker.all_resources_zip_path)) { 1822 if (defined(invoker.all_resources_zip_path)) {
1784 all_resources_zip = invoker.all_resources_zip_path 1823 all_resources_zip = invoker.all_resources_zip_path
1785 outputs += [ all_resources_zip ] 1824 outputs += [ all_resources_zip ]
1786 args += [ 1825 args += [
1787 "--all-resources-zip-out", 1826 "--all-resources-zip-out",
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 ] 2056 ]
2018 args = [ 2057 args = [
2019 "--depfile", 2058 "--depfile",
2020 rebase_path(depfile, root_build_dir), 2059 rebase_path(depfile, root_build_dir),
2021 "--script-output-path", 2060 "--script-output-path",
2022 rebase_path(generated_script, root_build_dir), 2061 rebase_path(generated_script, root_build_dir),
2023 ] 2062 ]
2024 args += test_runner_args 2063 args += test_runner_args
2025 } 2064 }
2026 } 2065 }
OLDNEW
« no previous file with comments | « no previous file | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698