[CLI] K2JVMCompilerArguments: Model modulePath as Array<String>
to allow interning individual file-path arguments on the IDE KTIJ-24976
This commit is contained in:
committed by
Space Team
parent
9dcd40d7b7
commit
fb66764c4d
+1
-1
@@ -33,7 +33,7 @@ fun copyK2JVMCompilerArguments(from: K2JVMCompilerArguments, to: K2JVMCompilerAr
|
|||||||
to.friendPaths = from.friendPaths?.copyOf()
|
to.friendPaths = from.friendPaths?.copyOf()
|
||||||
to.includeRuntime = from.includeRuntime
|
to.includeRuntime = from.includeRuntime
|
||||||
to.inheritMultifileParts = from.inheritMultifileParts
|
to.inheritMultifileParts = from.inheritMultifileParts
|
||||||
to.javaModulePath = from.javaModulePath
|
to.javaModulePath = from.javaModulePath?.copyOf()
|
||||||
to.javaPackagePrefix = from.javaPackagePrefix
|
to.javaPackagePrefix = from.javaPackagePrefix
|
||||||
to.javaParameters = from.javaParameters
|
to.javaParameters = from.javaParameters
|
||||||
to.javaSourceRoots = from.javaSourceRoots?.copyOf()
|
to.javaSourceRoots = from.javaSourceRoots?.copyOf()
|
||||||
|
|||||||
+7
-2
@@ -210,8 +210,13 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
|||||||
field = value
|
field = value
|
||||||
}
|
}
|
||||||
|
|
||||||
@Argument(value = "-Xmodule-path", valueDescription = "<path>", description = "Paths where to find Java 9+ modules")
|
@Argument(
|
||||||
var javaModulePath: String? = null
|
value = "-Xmodule-path",
|
||||||
|
valueDescription = "<path>",
|
||||||
|
description = "Paths where to find Java 9+ modules",
|
||||||
|
delimiter = Argument.Delimiters.pathSeparator
|
||||||
|
)
|
||||||
|
var javaModulePath: Array<String>? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
checkFrozen()
|
checkFrozen()
|
||||||
field = if (value.isNullOrEmpty()) null else value
|
field = if (value.isNullOrEmpty()) null else value
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): B
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun CompilerConfiguration.configureJavaModulesContentRoots(arguments: K2JVMCompilerArguments) {
|
fun CompilerConfiguration.configureJavaModulesContentRoots(arguments: K2JVMCompilerArguments) {
|
||||||
for (modularRoot in arguments.javaModulePath?.split(File.pathSeparatorChar).orEmpty()) {
|
for (modularRoot in arguments.javaModulePath.orEmpty()) {
|
||||||
add(CLIConfigurationKeys.CONTENT_ROOTS, JvmModulePathRoot(File(modularRoot)))
|
add(CLIConfigurationKeys.CONTENT_ROOTS, JvmModulePathRoot(File(modularRoot)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ abstract class AbstractFrontendModularizedTest : AbstractModularizedTest() {
|
|||||||
if (originalArguments != null) {
|
if (originalArguments != null) {
|
||||||
configuration.put(JVMConfigurationKeys.NO_JDK, originalArguments.noJdk)
|
configuration.put(JVMConfigurationKeys.NO_JDK, originalArguments.noJdk)
|
||||||
|
|
||||||
for (modularRoot in originalArguments.javaModulePath?.split(File.pathSeparatorChar).orEmpty()) {
|
for (modularRoot in originalArguments.javaModulePath.orEmpty()) {
|
||||||
configuration.add(CLIConfigurationKeys.CONTENT_ROOTS, JvmModulePathRoot(modularRoot.fixPath()))
|
configuration.add(CLIConfigurationKeys.CONTENT_ROOTS, JvmModulePathRoot(modularRoot.fixPath()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -165,13 +165,14 @@ public class K2JVMCompileMojo extends KotlinCompileMojoBase<K2JVMCompilerArgumen
|
|||||||
|
|
||||||
if (!classpathList.isEmpty()) {
|
if (!classpathList.isEmpty()) {
|
||||||
String classPathString = join(classpathList, File.pathSeparator);
|
String classPathString = join(classpathList, File.pathSeparator);
|
||||||
|
String[] classPath = classpathList.toArray(new String[0]);
|
||||||
if (isJava9Module(sourceRoots)) {
|
if (isJava9Module(sourceRoots)) {
|
||||||
getLog().debug("Module path: " + classPathString);
|
getLog().debug("Module path: " + classPathString);
|
||||||
arguments.setJavaModulePath(classPathString);
|
arguments.setJavaModulePath(classPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getLog().debug("Classpath: " + classPathString);
|
getLog().debug("Classpath: " + classPathString);
|
||||||
arguments.setClasspath(classpathList.toArray(String[]::new));
|
arguments.setClasspath(classPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user