Commit ba1a9938 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Always use interface classpath for javac

Not sure if something has changed, but it seems to work fine now even
with Annotation Processors.

Change-Id: I3c803c0170e883b5266726418d0980d5e23fa1e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898277
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712612}
parent a0fd7570
...@@ -402,14 +402,7 @@ def _ParseOptions(argv): ...@@ -402,14 +402,7 @@ def _ParseOptions(argv):
parser.add_option( parser.add_option(
'--java-version', '--java-version',
help='Java language version to use in -source and -target args to javac.') help='Java language version to use in -source and -target args to javac.')
parser.add_option( parser.add_option('--classpath', action='append', help='Classpath to use.')
'--full-classpath',
action='append',
help='Classpath to use when annotation processors are present.')
parser.add_option(
'--interface-classpath',
action='append',
help='Classpath to use when no annotation processors are present.')
parser.add_option( parser.add_option(
'--processors', '--processors',
action='append', action='append',
...@@ -462,9 +455,7 @@ def _ParseOptions(argv): ...@@ -462,9 +455,7 @@ def _ParseOptions(argv):
build_utils.CheckOptions(options, parser, required=('jar_path',)) build_utils.CheckOptions(options, parser, required=('jar_path',))
options.bootclasspath = build_utils.ParseGnList(options.bootclasspath) options.bootclasspath = build_utils.ParseGnList(options.bootclasspath)
options.full_classpath = build_utils.ParseGnList(options.full_classpath) options.classpath = build_utils.ParseGnList(options.classpath)
options.interface_classpath = build_utils.ParseGnList(
options.interface_classpath)
options.processorpath = build_utils.ParseGnList(options.processorpath) options.processorpath = build_utils.ParseGnList(options.processorpath)
options.processors = build_utils.ParseGnList(options.processors) options.processors = build_utils.ParseGnList(options.processors)
options.java_srcjars = build_utils.ParseGnList(options.java_srcjars) options.java_srcjars = build_utils.ParseGnList(options.java_srcjars)
...@@ -558,14 +549,6 @@ def main(argv): ...@@ -558,14 +549,6 @@ def main(argv):
if options.bootclasspath: if options.bootclasspath:
javac_cmd.extend(['-bootclasspath', ':'.join(options.bootclasspath)]) javac_cmd.extend(['-bootclasspath', ':'.join(options.bootclasspath)])
# Annotation processors crash when given interface jars.
active_classpath = (
options.full_classpath
if options.processors else options.interface_classpath)
classpath = []
if active_classpath:
classpath.extend(active_classpath)
if options.processorpath: if options.processorpath:
javac_cmd.extend(['-processorpath', ':'.join(options.processorpath)]) javac_cmd.extend(['-processorpath', ':'.join(options.processorpath)])
if options.processor_args: if options.processor_args:
...@@ -574,8 +557,8 @@ def main(argv): ...@@ -574,8 +557,8 @@ def main(argv):
javac_cmd.extend(options.javac_arg) javac_cmd.extend(options.javac_arg)
classpath_inputs = (options.bootclasspath + options.interface_classpath + classpath_inputs = (
options.processorpath) options.bootclasspath + options.classpath + options.processorpath)
# GN already knows of java_files, so listing them just make things worse when # GN already knows of java_files, so listing them just make things worse when
# they change. # they change.
...@@ -588,11 +571,11 @@ def main(argv): ...@@ -588,11 +571,11 @@ def main(argv):
options.jar_path + '.info', options.jar_path + '.info',
] ]
input_strings = javac_cmd + classpath + java_files input_strings = javac_cmd + options.classpath + java_files
if options.jar_info_exclude_globs: if options.jar_info_exclude_globs:
input_strings.append(options.jar_info_exclude_globs) input_strings.append(options.jar_info_exclude_globs)
build_utils.CallAndWriteDepfileIfStale( build_utils.CallAndWriteDepfileIfStale(
lambda: _OnStaleMd5(options, javac_cmd, java_files, classpath), lambda: _OnStaleMd5(options, javac_cmd, java_files, options.classpath),
options, options,
depfile_deps=depfile_deps, depfile_deps=depfile_deps,
input_paths=input_paths, input_paths=input_paths,
......
...@@ -2820,8 +2820,7 @@ if (enable_java_templates) { ...@@ -2820,8 +2820,7 @@ if (enable_java_templates) {
"--jar-path=$_rebased_javac_jar_path", "--jar-path=$_rebased_javac_jar_path",
"--java-srcjars=$_rebased_java_srcjars", "--java-srcjars=$_rebased_java_srcjars",
"--java-version=1.8", "--java-version=1.8",
"--full-classpath=@FileArg($_rebased_build_config:deps_info:javac_full_classpath)", "--classpath=@FileArg($_rebased_build_config:deps_info:javac_full_interface_classpath)",
"--interface-classpath=@FileArg($_rebased_build_config:deps_info:javac_full_interface_classpath)",
"--processorpath=@FileArg($_rebased_build_config:javac:processor_classpath)", "--processorpath=@FileArg($_rebased_build_config:javac:processor_classpath)",
"--processors=@FileArg($_rebased_build_config:javac:processor_classes)", "--processors=@FileArg($_rebased_build_config:javac:processor_classes)",
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment