Maven: KT-17093 Import from maven: please provide a special tag for coroutine option
This commit is contained in:
@@ -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.K2MetadataCompilerArguments
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.parseArguments
|
import org.jetbrains.kotlin.cli.common.arguments.parseArguments
|
||||||
import org.jetbrains.kotlin.compilerRunner.ArgumentUtils
|
import org.jetbrains.kotlin.compilerRunner.ArgumentUtils
|
||||||
import org.jetbrains.kotlin.config.JvmTarget
|
import org.jetbrains.kotlin.config.*
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
|
||||||
import org.jetbrains.kotlin.config.LanguageVersion
|
|
||||||
import org.jetbrains.kotlin.config.TargetPlatformKind
|
|
||||||
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
|
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
|
||||||
import org.jetbrains.kotlin.idea.facet.*
|
import org.jetbrains.kotlin.idea.facet.*
|
||||||
import org.jetbrains.kotlin.idea.maven.configuration.KotlinMavenConfigurator
|
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.languageVersion = configuration.getChild("languageVersion")?.text
|
||||||
arguments.multiPlatform = configuration.getChild("multiPlatform")?.text?.trim()?.toBoolean() ?: false
|
arguments.multiPlatform = configuration.getChild("multiPlatform")?.text?.trim()?.toBoolean() ?: false
|
||||||
arguments.suppressWarnings = configuration.getChild("nowarn")?.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) {
|
when (arguments) {
|
||||||
is K2JVMCompilerArguments -> {
|
is K2JVMCompilerArguments -> {
|
||||||
arguments.classpath = configuration.getChild("classpath")?.text
|
arguments.classpath = configuration.getChild("classpath")?.text
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
<param name="defaultSourceDirs/sourceDir" refProvider="org.jetbrains.idea.maven.plugins.api.common.MavenCommonParamReferenceProviders$DirPath"/>
|
<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="defaultSourceDirs/dir" refProvider="org.jetbrains.idea.maven.plugins.api.common.MavenCommonParamReferenceProviders$DirPath"/>
|
||||||
|
|
||||||
|
<param name="experimentalCoroutines" values="enable,warn,error"/>
|
||||||
|
|
||||||
<param name="script" language="kotlin" />
|
<param name="script" language="kotlin" />
|
||||||
</pluginDescriptor>
|
</pluginDescriptor>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|||||||
+11
@@ -174,6 +174,13 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
|||||||
@Parameter(property = "kotlin.compiler.apiVersion", required = false, readonly = false)
|
@Parameter(property = "kotlin.compiler.apiVersion", required = false, readonly = false)
|
||||||
protected String apiVersion;
|
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.
|
* Additional command line arguments for Kotlin compiler.
|
||||||
*/
|
*/
|
||||||
@@ -447,6 +454,10 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
|||||||
arguments.apiVersion = apiVersion;
|
arguments.apiVersion = apiVersion;
|
||||||
arguments.multiPlatform = multiPlatform;
|
arguments.multiPlatform = multiPlatform;
|
||||||
|
|
||||||
|
if (experimentalCoroutines != null) {
|
||||||
|
compiler.parseArguments(new String[] { "-Xcoroutines=" + experimentalCoroutines }, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
configureSpecificCompilerArguments(arguments);
|
configureSpecificCompilerArguments(arguments);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user