|
| 1 | +From 0c52a2cf2a39da0f534a7b0106fe42077bec75d8 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Qiu Jianlin < [email protected]> |
| 3 | +Date: Wed, 7 Apr 2021 14:08:10 +0800 |
| 4 | +Subject: [PATCH] Remove custom d8 dependency |
| 5 | + |
| 6 | +--- |
| 7 | + android/gyp/dex.py | 31 +++++-------------------------- |
| 8 | + config/android/internal_rules.gni | 24 ------------------------ |
| 9 | + 2 files changed, 5 insertions(+), 50 deletions(-) |
| 10 | + |
| 11 | +diff --git a/android/gyp/dex.py b/android/gyp/dex.py |
| 12 | +index 0f05009b5..2b95c06a2 100755 |
| 13 | +--- a/android/gyp/dex.py |
| 14 | ++++ b/android/gyp/dex.py |
| 15 | +@@ -71,11 +71,6 @@ def _ParseArgs(args): |
| 16 | + action='store_true', |
| 17 | + help='Allow numerous dex files within output.') |
| 18 | + parser.add_argument('--r8-jar-path', required=True, help='Path to R8 jar.') |
| 19 | +- parser.add_argument('--custom-d8-jar-path', |
| 20 | +- required=True, |
| 21 | +- help='Path to our customized d8 jar.') |
| 22 | +- parser.add_argument('--desugar-dependencies', |
| 23 | +- help='Path to store desugar dependencies.') |
| 24 | + parser.add_argument('--desugar', action='store_true') |
| 25 | + parser.add_argument( |
| 26 | + '--bootclasspath', |
| 27 | +@@ -502,8 +497,6 @@ def _CreateIntermediateDexFiles(changes, options, tmp_dir, dex_cmd): |
| 28 | + if class_files: |
| 29 | + # Dex necessary classes into intermediate dex files. |
| 30 | + dex_cmd = dex_cmd + ['--intermediate', '--file-per-class-file'] |
| 31 | +- if options.desugar_dependencies: |
| 32 | +- dex_cmd += ['--file-tmp-prefix', tmp_extract_dir] |
| 33 | + _RunD8(dex_cmd, class_files, options.incremental_dir, |
| 34 | + options.warnings_as_errors, |
| 35 | + options.show_desugar_default_interface_warnings) |
| 36 | +@@ -545,7 +538,6 @@ def main(args): |
| 37 | + |
| 38 | + input_paths = options.class_inputs + options.dex_inputs |
| 39 | + input_paths.append(options.r8_jar_path) |
| 40 | +- input_paths.append(options.custom_d8_jar_path) |
| 41 | + if options.main_dex_rules_path: |
| 42 | + input_paths.extend(options.main_dex_rules_path) |
| 43 | + |
| 44 | +@@ -565,8 +557,8 @@ def main(args): |
| 45 | + |
| 46 | + dex_cmd = build_utils.JavaCmd(options.warnings_as_errors) + [ |
| 47 | + '-cp', |
| 48 | +- '{}:{}'.format(options.r8_jar_path, options.custom_d8_jar_path), |
| 49 | +- 'org.chromium.build.CustomD8', |
| 50 | ++ options.r8_jar_path, |
| 51 | ++ 'com.android.tools.r8.D8', |
| 52 | + ] |
| 53 | + if options.release: |
| 54 | + dex_cmd += ['--release'] |
| 55 | +@@ -576,25 +568,12 @@ def main(args): |
| 56 | + if not options.desugar: |
| 57 | + dex_cmd += ['--no-desugaring'] |
| 58 | + elif options.classpath: |
| 59 | +- # The classpath is used by D8 to for interface desugaring. |
| 60 | +- if options.desugar_dependencies: |
| 61 | +- dex_cmd += ['--desugar-dependencies', options.desugar_dependencies] |
| 62 | +- if track_subpaths_allowlist: |
| 63 | +- track_subpaths_allowlist += options.classpath |
| 64 | +- depfile_deps += options.classpath |
| 65 | +- input_paths += options.classpath |
| 66 | +- # Still pass the entire classpath in case a new dependency is needed by |
| 67 | +- # desugar, so that desugar_dependencies will be updated for the next build. |
| 68 | +- for path in options.classpath: |
| 69 | +- dex_cmd += ['--classpath', path] |
| 70 | +- |
| 71 | +- if options.classpath or options.main_dex_rules_path: |
| 72 | +- # --main-dex-rules requires bootclasspath. |
| 73 | ++ # --main-dex-rules requires bootclasspath. |
| 74 | + dex_cmd += ['--lib', build_utils.JAVA_HOME] |
| 75 | +- for path in options.bootclasspath: |
| 76 | ++ for path in options.classpath: |
| 77 | + dex_cmd += ['--lib', path] |
| 78 | + depfile_deps += options.bootclasspath |
| 79 | +- input_paths += options.bootclasspath |
| 80 | ++ input_paths += options.classpath |
| 81 | + |
| 82 | + |
| 83 | + if options.desugar_jdk_libs_json: |
| 84 | +diff --git a/config/android/internal_rules.gni b/config/android/internal_rules.gni |
| 85 | +index ca50d6a26..36adc2ca9 100644 |
| 86 | +--- a/config/android/internal_rules.gni |
| 87 | ++++ b/config/android/internal_rules.gni |
| 88 | +@@ -82,7 +82,6 @@ _java_library_patterns = [ |
| 89 | + java_target_patterns = _java_library_patterns + _java_resource_patterns |
| 90 | + |
| 91 | + _r8_path = "//third_party/r8/lib/r8.jar" |
| 92 | +-_custom_d8_path = "//third_party/r8/custom_d8.jar" |
| 93 | + _desugar_jdk_libs_json = "//third_party/r8/desugar_jdk_libs.json" |
| 94 | + _desugar_jdk_libs_jar = "//third_party/android_deps/libs/com_android_tools_desugar_jdk_libs/desugar_jdk_libs-1.0.10.jar" |
| 95 | + _desugar_jdk_libs_configuration_jar = "//third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/desugar_jdk_libs_configuration-1.0.10.jar" |
| 96 | +@@ -1572,7 +1571,6 @@ if (enable_java_templates) { |
| 97 | + outputs = [ invoker.output ] |
| 98 | + inputs = [ |
| 99 | + _r8_path, |
| 100 | +- _custom_d8_path, |
| 101 | + ] |
| 102 | + |
| 103 | + if (!_is_library) { |
| 104 | +@@ -1592,8 +1590,6 @@ if (enable_java_templates) { |
| 105 | + "--min-api=$_min_sdk_version", |
| 106 | + "--r8-jar-path", |
| 107 | + rebase_path(_r8_path, root_build_dir), |
| 108 | +- "--custom-d8-jar-path", |
| 109 | +- rebase_path(_custom_d8_path, root_build_dir), |
| 110 | + ] |
| 111 | + if (treat_warnings_as_errors) { |
| 112 | + args += [ "--warnings-as-errors" ] |
| 113 | +@@ -1689,11 +1685,7 @@ if (enable_java_templates) { |
| 114 | + } |
| 115 | + } |
| 116 | + if (_desugar_needs_classpath) { |
| 117 | +- _desugar_dependencies_path = |
| 118 | +- "$target_gen_dir/$target_name.desugardeps" |
| 119 | + args += [ |
| 120 | +- "--desugar-dependencies", |
| 121 | +- rebase_path(_desugar_dependencies_path, root_build_dir), |
| 122 | + "--bootclasspath=@FileArg($_rebased_build_config:android:sdk_jars)", |
| 123 | + |
| 124 | + # Pass the full classpath to find new dependencies that are not in |
| 125 | +@@ -3185,21 +3177,6 @@ if (enable_java_templates) { |
| 126 | + args += [ "--jar-info-exclude-globs=${invoker.jar_excluded_patterns}" ] |
| 127 | + } |
| 128 | + |
| 129 | +- if (invoker.enable_errorprone) { |
| 130 | +- # Our custom plugin pulls in the main errorprone dep transitively. |
| 131 | +- _errorprone_dep = "//tools/android/errorprone_plugin:errorprone_plugin" |
| 132 | +- deps += [ _errorprone_dep ] |
| 133 | +- _dep_gen_dir = get_label_info(_errorprone_dep, "target_gen_dir") |
| 134 | +- _dep_name = get_label_info(_errorprone_dep, "name") |
| 135 | +- _rebased_errorprone_buildconfig = |
| 136 | +- rebase_path("$_dep_gen_dir/$_dep_name.build_config", root_build_dir) |
| 137 | +- _target_label = get_label_info(target_name, "dir") |
| 138 | +- args += [ |
| 139 | +- "--target-name=${_target_label}", |
| 140 | +- "--processorpath=@FileArg($_rebased_errorprone_buildconfig:deps_info:host_classpath)", |
| 141 | +- "--enable-errorprone", |
| 142 | +- ] |
| 143 | +- } |
| 144 | + foreach(e, _processor_args) { |
| 145 | + args += [ "--processor-arg=" + e ] |
| 146 | + } |
| 147 | +@@ -4014,7 +3991,6 @@ if (enable_java_templates) { |
| 148 | + ]) |
| 149 | + input_class_jars = [ _device_processed_jar_path ] |
| 150 | + enable_desugar = _enable_desugar |
| 151 | +- ignore_desugar_missing_deps = !_enable_bytecode_checks |
| 152 | + |
| 153 | + # There's no value in per-class dexing prebuilts since they never |
| 154 | + # change just one class at a time. |
| 155 | +-- |
| 156 | +2.17.1 |
| 157 | + |
0 commit comments