diff --git a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt
index 30341ed966e..5fe37e0d674 100644
--- a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt
+++ b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt
@@ -1476,6 +1476,77 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
}
}
+ fun testNoArgInvokeInitializers() {
+ createProjectSubDirs("src/main/kotlin", "src/main/kotlin.jvm", "src/test/kotlin", "src/test/kotlin.jvm")
+
+ importProject("""
+ test
+ project
+ 1.0.0
+
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib
+ $kotlinVersion
+
+
+
+
+ src/main/kotlin
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+
+
+ compile
+
+ js
+
+
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-noarg
+ $kotlinVersion
+
+
+
+
+
+ no-arg
+
+
+
+
+
+
+
+
+
+
+ """)
+
+ assertModules("project")
+ assertImporterStatePresent()
+
+ with(facetSettings) {
+ Assert.assertEquals(
+ "-version",
+ compilerSettings!!.additionalArguments
+ )
+ Assert.assertEquals(
+ listOf("plugin:org.jetbrains.kotlin.noarg:annotation=NoArg",
+ "plugin:org.jetbrains.kotlin.noarg:invokeInitializers=true"),
+ compilerArguments!!.pluginOptions!!.toList()
+ )
+ }
+ }
+
fun testArgsOverridingInFacet() {
createProjectSubDirs("src/main/kotlin", "src/main/kotlin.jvm", "src/test/kotlin", "src/test/kotlin.jvm")
diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt
index dc23e182924..5bd945d80b8 100644
--- a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt
+++ b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.utils.PathUtil
class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
private companion object {
val ANNOTATATION_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.ANNOTATION_OPTION.name}="
+ val INVOKEINITIALIZERS_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.name}="
}
override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
@@ -48,6 +49,16 @@ class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
text.substring(ANNOTATATION_PARAMETER_PREFIX.length)
})
- return annotations.mapTo(mutableListOf()) { PluginOption(NoArgCommandLineProcessor.ANNOTATION_OPTION.name, it) }
+ val options = annotations.mapTo(mutableListOf()) { PluginOption(NoArgCommandLineProcessor.ANNOTATION_OPTION.name, it) }
+
+ val invokeInitializerOptionValue = compilerPluginOptions
+ .firstOrNull { it.startsWith(INVOKEINITIALIZERS_PARAMETER_PREFIX) }
+ ?.drop(INVOKEINITIALIZERS_PARAMETER_PREFIX.length) == "true"
+
+ if (invokeInitializerOptionValue) {
+ options.add(PluginOption(NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.name, "true"))
+ }
+
+ return options
}
}