[CLI] K2JVMCompilerArguments: Model classpath as Array<String>

to allow interning individual file-path arguments on the IDE

KTIJ-24976
This commit is contained in:
Sebastian Sellmair
2023-03-31 10:30:59 +02:00
committed by Space Team
parent 7f91e94e7a
commit 9dcd40d7b7
14 changed files with 28 additions and 25 deletions
@@ -181,7 +181,7 @@ class KotlinFacetSettings {
if (compilerSettings != null) {
parseCommandLineArguments(compilerSettings.additionalArgumentsAsList, this)
}
if (this is K2JVMCompilerArguments) this.classpath = ""
if (this is K2JVMCompilerArguments) this.classpath = null
}
} else null
}
@@ -230,7 +230,7 @@ fun CommonCompilerArguments.convertPathsToSystemIndependent() {
when (this) {
is K2JVMCompilerArguments -> {
destination = destination?.let(FileUtilRt::toSystemIndependentName)
classpath = classpath?.let(FileUtilRt::toSystemIndependentName)
classpath?.forEachIndexed { index, s -> classpath!![index] = FileUtilRt.toSystemIndependentName(s) }
jdkHome = jdkHome?.let(FileUtilRt::toSystemIndependentName)
kotlinHome = kotlinHome?.let(FileUtilRt::toSystemIndependentName)
friendPaths?.forEachIndexed { index, s -> friendPaths!![index] = FileUtilRt.toSystemIndependentName(s) }
@@ -334,7 +334,7 @@ private fun KotlinFacetSettings.writeConfig(element: Element) {
element.addContent(
Element("externalSystemTestTasks").apply {
externalSystemRunTasks.forEach { task ->
when(task) {
when (task) {
is ExternalSystemTestRunTask -> {
addContent(
Element("externalSystemTestTask").apply { addContent(task.toStringRepresentation()) }
@@ -34,7 +34,7 @@ class CompilerArgumentsSerializationTest {
@Test
fun testLongClasspathArgumentJVM() {
doSerializeDeserializeAndCompareTest<K2JVMCompilerArguments> {
classpath = generateSequence { generateRandomString(50) }.take(10).toList().joinToString(File.pathSeparator)
classpath = generateSequence { generateRandomString(50) }.take(10).toList().toTypedArray()
}
}
@@ -958,7 +958,7 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
Files.copy(libraryJar.toPath(), module1Lib.toPath(), StandardCopyOption.REPLACE_EXISTING)
assert(module1Lib.exists())
(facet.compilerArguments as K2JVMCompilerArguments).classpath = module1Lib.path
(facet.compilerArguments as K2JVMCompilerArguments).classpath = arrayOf(module1Lib.path)
it.container.setChild(
JpsKotlinFacetModuleExtension.KIND,