Stop using -Xbuild-file in Gradle Plugin
#KT-27640 fixed
#KT-27778 fixed
#KT-27638 fixed
This commit is contained in:
+14
@@ -191,6 +191,20 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var javacArguments: Array<String>? by FreezableVar(null)
|
||||
|
||||
|
||||
@Argument(
|
||||
value = "-Xjava-source-roots",
|
||||
valueDescription = "<path>",
|
||||
description = "Paths to output directories for friend modules (whose internals should be visible)"
|
||||
)
|
||||
var javaSourceRoots: Array<String>? by FreezableVar(null)
|
||||
|
||||
@Argument(
|
||||
value = "-Xjava-package-prefix",
|
||||
description = "Package prefix for Java files"
|
||||
)
|
||||
var javaPackagePrefix: String? by FreezableVar(null)
|
||||
|
||||
@Argument(
|
||||
value = "-Xjsr305",
|
||||
deprecatedName = "-Xjsr305-annotations",
|
||||
|
||||
@@ -85,6 +85,10 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (path in arguments.javaSourceRoots ?: emptyArray()) {
|
||||
configuration.addJavaSourceRoot(File(path), arguments.javaPackagePrefix)
|
||||
}
|
||||
}
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, arguments.moduleName ?: JvmAbi.DEFAULT_MODULE_NAME)
|
||||
@@ -108,11 +112,17 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
val destination = arguments.destination
|
||||
|
||||
if (arguments.buildFile != null) {
|
||||
fun strongWarning(message: String) {
|
||||
messageCollector.report(STRONG_WARNING, message)
|
||||
}
|
||||
if (destination != null) {
|
||||
messageCollector.report(
|
||||
STRONG_WARNING,
|
||||
"The '-d' option with a directory destination is ignored because '-Xbuild-file' is specified"
|
||||
)
|
||||
strongWarning("The '-d' option with a directory destination is ignored because '-Xbuild-file' is specified")
|
||||
}
|
||||
if (arguments.javaSourceRoots != null) {
|
||||
strongWarning("The '-Xjava-source-roots' option is ignored because '-Xbuild-file' is specified")
|
||||
}
|
||||
if (arguments.javaPackagePrefix != null) {
|
||||
strongWarning("The '-Xjava-package-prefix' option is ignored because '-Xbuild-file' is specified")
|
||||
}
|
||||
|
||||
val sanitizedCollector = FilteringMessageCollector(messageCollector, VERBOSE::contains)
|
||||
|
||||
+5
-3
@@ -420,9 +420,11 @@ object KotlinToJVMBytecodeCompiler {
|
||||
|
||||
private fun GenerationState.Builder.withModule(module: Module?) =
|
||||
apply {
|
||||
targetId(module?.let { TargetId(it) })
|
||||
moduleName(module?.getModuleName())
|
||||
outDirectory(module?.let { File(it.getOutputDirectory()) })
|
||||
if (module != null) {
|
||||
targetId(TargetId(module))
|
||||
moduleName(module.getModuleName())
|
||||
outDirectory(File(module.getOutputDirectory()))
|
||||
}
|
||||
}
|
||||
|
||||
private fun generate(
|
||||
|
||||
Reference in New Issue
Block a user