Deduplicate classpath roots in compiler when -Xbuild-file is used

In kotlin-gradle-plugin, the compiler is invoked with a
K2JVMCompilerArguments instance where both the classpath is set, and the
buildFile is used (containing the same classpath entries in XML).
Previously, the compiler concatenated those two classpaths, which
resulted in duplicated entries, which could slow down compilation. Now,
if buildFile is used, the classpath passed explicitly is ignored
(exactly as, for example, destination ("-d"), which is also stored in
the XML build file).

No test added because there doesn't seem to be any change in
user-visible behavior
This commit is contained in:
Alexander Udalov
2017-11-28 18:52:22 +01:00
parent d65b999c2c
commit 2be7116b0b
@@ -91,17 +91,19 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
}
}
configureContentRoots(paths, arguments, configuration)
configuration.put(CommonConfigurationKeys.MODULE_NAME, arguments.moduleName ?: JvmAbi.DEFAULT_MODULE_NAME)
if (arguments.buildFile == null && arguments.freeArgs.isEmpty() && !arguments.version) {
if (arguments.script) {
messageCollector.report(ERROR, "Specify script source path to evaluate")
return COMPILATION_ERROR
if (arguments.buildFile == null) {
configureContentRoots(paths, arguments, configuration)
if (arguments.freeArgs.isEmpty() && !arguments.version) {
if (arguments.script) {
messageCollector.report(ERROR, "Specify script source path to evaluate")
return COMPILATION_ERROR
}
ReplFromTerminal.run(rootDisposable, configuration)
return ExitCode.OK
}
ReplFromTerminal.run(rootDisposable, configuration)
return ExitCode.OK
}
if (arguments.includeRuntime) {