summaryrefslogtreecommitdiffstats
path: root/chromium/build/android/gyp/dex.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-06 12:48:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:33:43 +0000
commit7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (patch)
treefa14ba0ca8d2683ba2efdabd246dc9b18a1229c6 /chromium/build/android/gyp/dex.py
parent79b4f909db1049fca459c07cca55af56a9b54fe3 (diff)
BASELINE: Update Chromium to 84.0.4147.141
Change-Id: Ib85eb4cfa1cbe2b2b81e5022c8cad5c493969535 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/build/android/gyp/dex.py')
-rwxr-xr-xchromium/build/android/gyp/dex.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/chromium/build/android/gyp/dex.py b/chromium/build/android/gyp/dex.py
index 82ddac000b1..0b3dcbd28b9 100755
--- a/chromium/build/android/gyp/dex.py
+++ b/chromium/build/android/gyp/dex.py
@@ -24,7 +24,12 @@ import convert_dex_profile
_IGNORE_WARNINGS = (
# A play services library triggers this.
- 'Type `libcore.io.Memory` was not found', )
+ r'Type `libcore.io.Memory` was not found',
+ # Filter out warnings caused by our fake main dex list used to enable
+ # multidex on library targets.
+ # Warning: Application does not contain `Foo` as referenced in main-dex-list
+ r'does not contain `Foo`',
+)
def _ParseArgs(args):
@@ -64,6 +69,8 @@ def _ParseArgs(args):
action='append',
help='GN-list of bootclasspath. Needed for --desugar')
parser.add_argument(
+ '--desugar-jdk-libs-json', help='Path to desugar_jdk_libs.json.')
+ parser.add_argument(
'--classpath',
action='append',
help='GN-list of full classpath. Needed for --desugar')
@@ -114,11 +121,6 @@ def _ParseArgs(args):
if options.main_dex_list_path and not options.multi_dex:
parser.error('--main-dex-list-path is unused if multidex is not enabled')
- if options.desugar and options.classpath is None:
- parser.error('--classpath required with use of --desugar')
- if options.desugar and options.bootclasspath is None:
- parser.error('--bootclasspath required with use of --desugar')
-
options.class_inputs = build_utils.ParseGnList(options.class_inputs)
options.class_inputs_filearg = build_utils.ParseGnList(
options.class_inputs_filearg)
@@ -135,12 +137,18 @@ def _RunD8(dex_cmd, input_paths, output_path):
dex_cmd = dex_cmd + ['--output', output_path] + input_paths
def stderr_filter(output):
- # Filter out warnings caused by our fake main dex list used to enable
- # multidex on library targets.
- # Warning: Application does not contain `Foo` as referenced in main-dex-list
- pattern = r'does not contain `Foo`'
- pattern += '|' + '|'.join(re.escape(p) for p in _IGNORE_WARNINGS)
- output = build_utils.FilterLines(output, pattern)
+ patterns = _IGNORE_WARNINGS
+ # No classpath means we are using Bazel's Desugar tool to desugar lambdas
+ # and interface methods, in which case we intentionally do not pass a
+ # classpath to D8.
+ # Not having a classpath makes incremental dexing much more effective.
+ # D8 will still be used for backported method desugaring.
+ # We still use D8 for backported method desugaring.
+ if '--classpath' not in dex_cmd:
+ patterns = list(patterns) + ['default or static interface methods']
+
+ combined_pattern = '|'.join(re.escape(p) for p in patterns)
+ output = build_utils.FilterLines(output, combined_pattern)
# Each warning has a prefix line of tthe file it's from. If we've filtered
# out the warning, then also filter out the file header.
@@ -252,7 +260,7 @@ def _ZipMultidex(file_dir, dex_files):
"""
ordered_files = [] # List of (archive name, file name)
for f in dex_files:
- if f.endswith('classes.dex.zip'):
+ if f.endswith('dex.jar'):
ordered_files.append(('classes.dex', f))
break
if not ordered_files:
@@ -478,7 +486,10 @@ def main(args):
if options.min_api:
dex_cmd += ['--min-api', options.min_api]
- if options.desugar:
+ if not options.desugar:
+ dex_cmd += ['--no-desugaring']
+ elif options.classpath:
+ # Don't pass classpath when Desugar.jar is doing interface desugaring.
dex_cmd += ['--lib', build_utils.JAVA_HOME]
for path in options.bootclasspath:
dex_cmd += ['--lib', path]
@@ -488,9 +499,9 @@ def main(args):
depfile_deps += options.bootclasspath
input_paths += options.classpath
input_paths += options.bootclasspath
- else:
- dex_cmd += ['--no-desugaring']
+ if options.desugar_jdk_libs_json:
+ dex_cmd += ['--desugared-lib', options.desugar_jdk_libs_json]
if options.force_enable_assertions:
dex_cmd += ['--force-enable-assertions']