Maven: Fix <args> parsing on import to the Kotlin facet

#KT-22153 Fixed
This commit is contained in:
Alexey Sedunov
2018-01-10 16:05:15 +03:00
parent 6f135e89d7
commit 258bd1e8c0
2 changed files with 51 additions and 1 deletions
@@ -175,7 +175,6 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
}
}
}
argsElement?.getChildren("arg")?.mapNotNullTo(this) { it.text }
}
parseCommandLineArguments(additionalArgs, arguments)
@@ -2250,6 +2250,57 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
TestCase.assertTrue(dependencies.any { it.name.asString() == "<test sources for module module-with-java>" })
}
fun testNoArgDuplication() {
createProjectSubDirs("src/main/kotlin", "src/main/kotlin.jvm", "src/test/kotlin", "src/test/kotlin.jvm")
importProject("""
<groupId>test</groupId>
<artifactId>project</artifactId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>$kotlinVersion</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
""")
assertModules("project")
assertImporterStatePresent()
with (facetSettings) {
Assert.assertEquals("-Xjsr305=strict", compilerSettings!!.additionalArguments)
}
}
private fun assertImporterStatePresent() {
assertNotNull("Kotlin importer component is not present", myTestFixture.module.getComponent(KotlinImporterComponent::class.java))
}