Use new -Xinline-classes compiler flag in the corresponding IDEA intention

This commit is contained in:
victor.petukhov
2019-07-24 11:15:47 +03:00
parent 17dcdb59de
commit 94469827ba
41 changed files with 811 additions and 15 deletions
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CliArgumentStringBuilder.buildA
import org.jetbrains.kotlin.cli.common.arguments.CliArgumentStringBuilder.replaceLanguageFeature
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator.Companion.getBuildScriptSettingsPsiFile
import org.jetbrains.kotlin.idea.inspections.gradle.DifferentKotlinGradleVersionInspection
import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.idea.util.module
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
@@ -164,7 +165,8 @@ class GroovyBuildScriptManipulator(
return allBlock.statements.lastOrNull()
}
val featureArgumentString = feature.buildArgumentString(state)
val kotlinVersion = DifferentKotlinGradleVersionInspection.getKotlinPluginVersion(scriptFile)
val featureArgumentString = feature.buildArgumentString(state, kotlinVersion)
val parameterName = "freeCompilerArgs"
return addOrReplaceKotlinTaskParameter(
scriptFile,
@@ -173,7 +175,13 @@ class GroovyBuildScriptManipulator(
forTests
) { insideKotlinOptions ->
val prefix = if (insideKotlinOptions) "kotlinOptions." else ""
val newText = text.replaceLanguageFeature(feature, state, prefix = "$prefix$parameterName = [", postfix = "]")
val newText = text.replaceLanguageFeature(
feature,
state,
kotlinVersion,
prefix = "$prefix$parameterName = [",
postfix = "]"
)
replaceWithStatementFromText(newText)
}
}
@@ -229,6 +229,55 @@ class KotlinBuildScriptManipulator(
}
}
private fun KtBlockExpression.findClassPathDependencyVersion(pluginName: String): String? {
return PsiTreeUtil.getChildrenOfAnyType(this, KtCallExpression::class.java).mapNotNull {
if (it?.calleeExpression?.text == "classpath") {
val dependencyName = it.valueArguments.firstOrNull()?.text?.removeSurrounding("\"")
if (dependencyName?.startsWith(pluginName) == true) dependencyName.substringAfter("$pluginName:") else null
} else null
}.singleOrNull()
}
private fun getPluginInfoFromBuildScript(
operatorName: String?,
pluginVersion: KtExpression?,
receiverCalleeExpression: KtCallExpression?
): Pair<String, String>? {
val receiverCalleeExpressionText = receiverCalleeExpression?.calleeExpression?.text?.trim()
val receivedPluginName = when {
receiverCalleeExpressionText == "id" ->
receiverCalleeExpression.valueArguments.firstOrNull()?.text?.trim()?.removeSurrounding("\"")
operatorName == "version" -> receiverCalleeExpressionText
else -> null
}
val pluginVersionText = pluginVersion?.text?.trim()?.removeSurrounding("\"") ?: return null
return receivedPluginName?.to(pluginVersionText)
}
private fun KtBlockExpression.findPluginVersionInPluginGroup(pluginName: String): String? {
val versionsToPluginNames =
PsiTreeUtil.getChildrenOfAnyType(this, KtBinaryExpression::class.java, KtDotQualifiedExpression::class.java).mapNotNull {
when (it) {
is KtBinaryExpression -> getPluginInfoFromBuildScript(
it.operationReference.text,
it.right,
it.left as? KtCallExpression
)
is KtDotQualifiedExpression ->
(it.selectorExpression as? KtCallExpression)?.run {
getPluginInfoFromBuildScript(
calleeExpression?.text,
valueArguments.firstOrNull()?.getArgumentExpression(),
it.receiverExpression as? KtCallExpression
)
}
else -> null
}
}.toMap()
return versionsToPluginNames.getOrDefault(pluginName, null)
}
private fun KtBlockExpression.findPluginInPluginsGroup(pluginName: String): KtCallExpression? {
return PsiTreeUtil.getChildrenOfAnyType(
this,
@@ -354,14 +403,24 @@ class KotlinBuildScriptManipulator(
?.addExpressionIfMissing("languageSettings.enableLanguageFeature(\"${feature.name}\")")
}
val featureArgumentString = feature.buildArgumentString(state)
val pluginsBlock = findScriptInitializer("plugins")?.getBlock()
val kotlinVersion = pluginsBlock?.findPluginVersionInPluginGroup("kotlin")
?: pluginsBlock?.findPluginVersionInPluginGroup("org.jetbrains.kotlin.jvm")
?: findScriptInitializer("buildscript")?.getBlock()?.findBlock("dependencies")?.findClassPathDependencyVersion("org.jetbrains.kotlin:kotlin-gradle-plugin")
val featureArgumentString = feature.buildArgumentString(state, kotlinVersion)
val parameterName = "freeCompilerArgs"
return addOrReplaceKotlinTaskParameter(
parameterName,
"listOf(\"$featureArgumentString\")",
forTests
) {
val newText = text.replaceLanguageFeature(feature, state, prefix = "$parameterName = listOf(", postfix = ")")
val newText = text.replaceLanguageFeature(
feature,
state,
kotlinVersion,
prefix = "$parameterName = listOf(",
postfix = ")"
)
replace(psiFactory.createExpression(newText))
}
}
@@ -32,6 +32,10 @@ class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportMultiplatformWithXFlag() = testEnableFeatureSupportMultiplatform()
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportMultiplatform2() {
@@ -569,6 +569,10 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testChangeFeatureSupportWithXFlag() = testChangeFeatureSupport()
@Test
fun testDisableFeatureSupport() {
val files = importProjectFromTestData()
@@ -584,6 +588,10 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testDisableFeatureSupportWithXFlag() = testDisableFeatureSupport()
@Test
fun testEnableFeatureSupport() {
val files = importProjectFromTestData()
@@ -599,6 +607,11 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
@JvmName("testEnableFeatureSupportWithXFlag")
fun testEnableFeatureSupportWithXFlag() = testEnableFeatureSupport()
@Test
fun testEnableFeatureSupportToExistentArguments() {
val files = importProjectFromTestData()
@@ -614,6 +627,10 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportToExistentArgumentsWithXFlag() = testEnableFeatureSupportToExistentArguments()
@Test
fun testChangeFeatureSupportGSK() {
val files = importProjectFromTestData()
@@ -629,6 +646,10 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testChangeFeatureSupportGSKWithXFlag() = testChangeFeatureSupportGSK()
@Test
fun testDisableFeatureSupportGSK() {
val files = importProjectFromTestData()
@@ -644,6 +665,10 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testDisableFeatureSupportGSKWithXFlag() = testDisableFeatureSupportGSK()
@Test
fun testEnableFeatureSupportGSK() {
val files = importProjectFromTestData()
@@ -659,6 +684,18 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportGSKWithXFlag() = testEnableFeatureSupportGSK()
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportGSKWithNotInfixVersionCallAndXFlag() = testEnableFeatureSupportGSK()
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportGSKWithSpecifyingPluginThroughIdAndXFlag() = testEnableFeatureSupportGSK()
override fun testDataDirName(): String {
return "configurator"
}
@@ -5,10 +5,20 @@
package org.jetbrains.kotlin.cli.common.arguments
import com.intellij.openapi.util.text.StringUtil.compareVersionNumbers
import org.jetbrains.kotlin.config.LanguageFeature
object CliArgumentStringBuilder {
private const val languagePrefix = "-XXLanguage:"
private const val LANGUAGE_FEATURE_FLAG_PREFIX = "-XXLanguage:"
private const val LANGUAGE_FEATURE_DEDICATED_FLAG_PREFIX = "-X"
private val versionRegex = Regex("""^(\d+)\.(\d+)\.(\d+)""")
private val LanguageFeature.dedicatedFlagInfo
get() = when (this) {
LanguageFeature.InlineClasses -> Pair("inline-classes", KotlinVersion(1, 3, 50))
else -> null
}
private val LanguageFeature.State.sign: String
get() = when (this) {
@@ -18,24 +28,50 @@ object CliArgumentStringBuilder {
LanguageFeature.State.ENABLED_WITH_ERROR -> "-" // not supported normally
}
fun LanguageFeature.buildArgumentString(state: LanguageFeature.State): String {
return "$languagePrefix${state.sign}$name"
private fun LanguageFeature.getFeatureMentionInCompilerArgsRegex(): Regex {
val basePattern = "$LANGUAGE_FEATURE_FLAG_PREFIX(?:-|\\+)$name"
val fullPattern =
if (dedicatedFlagInfo != null) "(?:$basePattern)|$LANGUAGE_FEATURE_DEDICATED_FLAG_PREFIX${dedicatedFlagInfo!!.first}" else basePattern
return Regex(fullPattern)
}
fun LanguageFeature.buildArgumentString(state: LanguageFeature.State, kotlinVersion: String?): String {
val shouldBeFeatureEnabled = state == LanguageFeature.State.ENABLED || state == LanguageFeature.State.ENABLED_WITH_WARNING
val dedicatedFlag = dedicatedFlagInfo?.run {
val (xFlag, xFlagSinceVersion) = this
// TODO: replace to returning xFlag in 1.4 (behaviour for fallback)
if (kotlinVersion == null) return@run null
val isAtLeastSpecifiedVersion = versionRegex.find(kotlinVersion)?.destructured?.let { (major, minor, patch) ->
KotlinVersion(major.toInt(), minor.toInt(), patch.toInt()) >= xFlagSinceVersion
} == true
if (isAtLeastSpecifiedVersion) xFlag else null
}
return if (shouldBeFeatureEnabled && dedicatedFlag != null) {
LANGUAGE_FEATURE_DEDICATED_FLAG_PREFIX + dedicatedFlag
} else {
"$LANGUAGE_FEATURE_FLAG_PREFIX${state.sign}$name"
}
}
fun String.replaceLanguageFeature(
feature: LanguageFeature,
state: LanguageFeature.State,
kotlinVersion: String?,
prefix: String = "",
postfix: String = "",
separator: String = ", ",
quoted: Boolean = true
): String {
val existingFeatureIndex = indexOf(feature.name)
val languagePrefixIndex = lastIndexOf(languagePrefix, existingFeatureIndex)
val featureArgumentString = feature.buildArgumentString(state)
val quote = if (quoted) "\"" else ""
return if (languagePrefixIndex != -1) {
replaceRange(languagePrefixIndex, existingFeatureIndex + feature.name.length, featureArgumentString)
val featureArgumentString = feature.buildArgumentString(state, kotlinVersion)
val existingFeatureMatchResult = feature.getFeatureMentionInCompilerArgsRegex().find(this)
return if (existingFeatureMatchResult != null) {
replace(existingFeatureMatchResult.value, featureArgumentString)
} else {
val splitText = if (postfix.isNotEmpty()) split(postfix) else listOf(this, "")
if (splitText.size != 2) {
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.idea.facet.getCleanRuntimeLibraryVersion
import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion
import org.jetbrains.kotlin.idea.facet.toApiVersion
import org.jetbrains.kotlin.idea.framework.ui.CreateLibraryDialogWithModules
@@ -371,7 +372,13 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro
facetSettings.apiLevel = feature.sinceVersion
facetSettings.languageLevel = feature.sinceVersion
facetSettings.compilerSettings?.apply {
additionalArguments = additionalArguments.replaceLanguageFeature(feature, state, separator = " ", quoted = false)
additionalArguments = additionalArguments.replaceLanguageFeature(
feature,
state,
getCleanRuntimeLibraryVersion(module),
separator = " ",
quoted = false
)
}
}
}
@@ -20,7 +20,9 @@ import org.jetbrains.kotlin.idea.configuration.findApplicableConfigurator
import org.jetbrains.kotlin.idea.configuration.getBuildSystemType
import org.jetbrains.kotlin.idea.core.isInTestSourceContentKotlinAware
import org.jetbrains.kotlin.idea.facet.KotlinFacet
import org.jetbrains.kotlin.idea.facet.getCleanRuntimeLibraryVersion
import org.jetbrains.kotlin.idea.roots.invalidateProjectRoots
import org.jetbrains.kotlin.idea.util.module
import org.jetbrains.kotlin.psi.KtFile
sealed class ChangeGeneralLanguageFeatureSupportFix(
@@ -56,7 +58,13 @@ sealed class ChangeGeneralLanguageFeatureSupportFix(
if (!checkUpdateRuntime(project, feature.sinceApiVersion)) return
}
KotlinCompilerSettings.getInstance(project).update {
additionalArguments = additionalArguments.replaceLanguageFeature(feature, featureSupport, separator = " ", quoted = false)
additionalArguments = additionalArguments.replaceLanguageFeature(
feature,
featureSupport,
file.module?.let { getCleanRuntimeLibraryVersion(it) },
separator = " ",
quoted = false
)
}
project.invalidateProjectRoots()
}
@@ -711,7 +711,7 @@ fun PomFile.changeFeatureConfiguration(
}
argsSubTag.findSubTags("arg").filter { feature.name in it.value.text }.forEach { it.deleteCascade() }
val featureArgumentString = feature.buildArgumentString(state)
val featureArgumentString = feature.buildArgumentString(state, kotlinPlugin.version.stringValue)
val childTag = argsSubTag.createChildTag("arg", featureArgumentString)
return argsSubTag.add(childTag)
}
@@ -82,6 +82,11 @@ class MavenUpdateConfigurationQuickFixTest : MavenImportingTestCase() {
doTest("Enable inline classes support in the current module")
}
@Test
fun testEnableInlineClassesWithXFlag() {
doTest("Enable inline classes support in the current module")
}
@Test
fun testAddKotlinReflect() {
doTest("Add kotlin-reflect.jar to the classpath")
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<kotlin.version>1.3.50</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>wrong-goal</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<kotlin.version>1.3.50</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>wrong-goal</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-Xinline-classes</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1 @@
inline class My(val x: Int)
@@ -0,0 +1,15 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.50"
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
}
@@ -0,0 +1,15 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.50"
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-XXLanguage:-InlineClasses")
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
}
}
rootProject.name = "my-app"
@@ -0,0 +1,24 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:-InlineClasses"]
}
}
@@ -0,0 +1,24 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xinline-classes"]
}
}
@@ -0,0 +1,7 @@
plugins {
kotlin("jvm") version "1.3.50"
}
repositories {
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
@@ -0,0 +1,13 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.50"
}
repositories {
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-XXLanguage:-InlineClasses")
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
}
}
rootProject.name = "my-app"
@@ -0,0 +1,15 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951")
}
}
apply(plugin="kotlin-multiplatform")
repositories {
jcenter()
mavenCentral()
}
@@ -0,0 +1,21 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
jcenter()
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50-eap-2")
}
}
apply(plugin="kotlin-multiplatform")
repositories {
jcenter()
mavenCentral()
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-XXLanguage:-InlineClasses")
}
@@ -0,0 +1,19 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
@@ -0,0 +1,24 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:-InlineClasses"]
}
}
@@ -0,0 +1,8 @@
plugins {
id("org.jetbrains.kotlin.jvm").version("1.3.50")
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
@@ -0,0 +1,14 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm").version("1.3.50")
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
}
}
rootProject.name = "my-app"
@@ -0,0 +1,8 @@
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.50"
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
@@ -0,0 +1,14 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.50"
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
}
}
rootProject.name = "my-app"
@@ -0,0 +1,12 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951")
}
}
apply(plugin ="kotlin")
@@ -0,0 +1,18 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
jcenter()
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951")
}
}
apply(plugin ="kotlin")
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
}
@@ -0,0 +1,29 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50"
}
}
apply plugin: "kotlin-multiplatform"
repositories {
jcenter()
mavenCentral()
}
kotlin {
targets.fromPreset(presets.jvm, 'jvm')
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
}
}
@@ -0,0 +1,36 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50-eap-2"
}
}
apply plugin: "kotlin-multiplatform"
repositories {
jcenter()
mavenCentral()
}
kotlin {
targets.fromPreset(presets.jvm, 'jvm')
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
}
targets {
configure([jvm]) {
tasks.getByName(compilations.main.compileKotlinTaskName).kotlinOptions {
freeCompilerArgs = ["-Xinline-classes"]
}
}
}
}
@@ -0,0 +1,32 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50-eap-5"
}
}
apply plugin: "kotlin-multiplatform"
repositories {
jcenter()
mavenCentral()
}
kotlin {
targets {
fromPreset(presets.jvm, 'jvm')
}
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
}
}
@@ -0,0 +1,35 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50-eap-5"
}
}
apply plugin: "kotlin-multiplatform"
repositories {
jcenter()
mavenCentral()
}
kotlin {
targets {
fromPreset(presets.jvm, 'jvm')
}
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
all {
languageSettings.enableLanguageFeature("InlineClasses")
}
}
}
@@ -0,0 +1,7 @@
pluginManagement {
repositories {
maven {
url 'http://dl.bintray.com/kotlin/kotlin-eap'
}
}
}
@@ -0,0 +1,24 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:+SamConversionForKotlinFunctions"] // Free compiler arguments
}
}
@@ -0,0 +1,25 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:+SamConversionForKotlinFunctions", "-Xinline-classes"]
// Free compiler arguments
}
}
@@ -0,0 +1,19 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
@@ -0,0 +1,24 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60-dev-1951"
}
}
apply plugin: "kotlin"
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xinline-classes"]
}
}