Maven: KT-17093 Import from maven: please provide a special tag for coroutine option

This commit is contained in:
Sergey Mashkov
2017-04-13 16:40:29 +03:00
parent 5010047b1b
commit 2521dacc25
3 changed files with 19 additions and 4 deletions
@@ -38,10 +38,7 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.parseArguments
import org.jetbrains.kotlin.compilerRunner.ArgumentUtils
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.TargetPlatformKind
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
import org.jetbrains.kotlin.idea.facet.*
import org.jetbrains.kotlin.idea.maven.configuration.KotlinMavenConfigurator
@@ -118,6 +115,11 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
arguments.languageVersion = configuration.getChild("languageVersion")?.text
arguments.multiPlatform = configuration.getChild("multiPlatform")?.text?.trim()?.toBoolean() ?: false
arguments.suppressWarnings = configuration.getChild("nowarn")?.text?.trim()?.toBoolean() ?: false
configuration.getChild("experimentalCoroutines")?.text?.trim()?.let { coroutines ->
parseArguments(arrayOf("-Xcoroutines=$coroutines"), arguments, false)
}
when (arguments) {
is K2JVMCompilerArguments -> {
arguments.classpath = configuration.getChild("classpath")?.text
+2
View File
@@ -19,6 +19,8 @@
<param name="defaultSourceDirs/sourceDir" refProvider="org.jetbrains.idea.maven.plugins.api.common.MavenCommonParamReferenceProviders$DirPath"/>
<param name="defaultSourceDirs/dir" refProvider="org.jetbrains.idea.maven.plugins.api.common.MavenCommonParamReferenceProviders$DirPath"/>
<param name="experimentalCoroutines" values="enable,warn,error"/>
<param name="script" language="kotlin" />
</pluginDescriptor>
</extensions>
@@ -174,6 +174,13 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
@Parameter(property = "kotlin.compiler.apiVersion", required = false, readonly = false)
protected String apiVersion;
/**
* possible values are: enable, error, warn
*/
@Parameter(property = "kotlin.compiler.experimental.coroutines", required = false, readonly = false)
@Nullable
protected String experimentalCoroutines;
/**
* Additional command line arguments for Kotlin compiler.
*/
@@ -447,6 +454,10 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
arguments.apiVersion = apiVersion;
arguments.multiPlatform = multiPlatform;
if (experimentalCoroutines != null) {
compiler.parseArguments(new String[] { "-Xcoroutines=" + experimentalCoroutines }, arguments);
}
configureSpecificCompilerArguments(arguments);
try {