Fix plugin uploading (#2157)
* Fix plugin uploading * Fix plugin version in bundle samples * [gradle-plugin] Use unshaded compiler plugin configuration
This commit is contained in:
+6
-1
@@ -49,7 +49,12 @@ ext {
|
|||||||
kotlinScriptRuntimeModule="org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}"
|
kotlinScriptRuntimeModule="org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}"
|
||||||
|
|
||||||
konanVersionFull = KonanVersion.Companion.CURRENT
|
konanVersionFull = KonanVersion.Companion.CURRENT
|
||||||
gradlePluginVersion = konanVersionFull.toString()
|
|
||||||
|
if (konanVersionFull.meta == MetaVersion.RELEASE) {
|
||||||
|
gradlePluginVersion = kotlinVersion
|
||||||
|
} else {
|
||||||
|
gradlePluginVersion = "$kotlinVersion-native-${KonanVersion.Companion.CURRENT.toString()}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.konan.KonanVersion
|
import org.jetbrains.kotlin.konan.KonanVersion
|
||||||
import org.jetbrains.kotlin.konan.MetaVersion
|
import org.jetbrains.kotlin.konan.MetaVersion
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One may use bintrayUser/bintrayKey project properties or BINTRAY_USER/BINTRAY_KEY environment variables to upload
|
* One may use bintrayUser/bintrayKey project properties or BINTRAY_USER/BINTRAY_KEY environment variables to upload
|
||||||
@@ -101,7 +100,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task jar(type: ShadowJar, overwrite: true) {
|
shadowJar {
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
configurations = [project.configurations.bundleDependencies]
|
configurations = [project.configurations.bundleDependencies]
|
||||||
classifier = null
|
classifier = null
|
||||||
@@ -126,14 +125,22 @@ task jar(type: ShadowJar, overwrite: true) {
|
|||||||
exclude('META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin')
|
exclude('META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin')
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble.dependsOn shadowJar
|
jar {
|
||||||
|
dependsOn shadowJar
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
pluginUnderTestMetadata {
|
pluginUnderTestMetadata {
|
||||||
dependsOn jar
|
dependsOn shadowJar
|
||||||
pluginClasspath = files(jar.archivePath) + configurations.shadow
|
pluginClasspath = files(shadowJar.archivePath) + configurations.shadow
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
dependsOn shadowJar
|
||||||
|
classpath = configurations.testRuntimeClasspath +
|
||||||
|
sourceSets.test.output +
|
||||||
|
files(shadowJar.archivePath) +
|
||||||
|
configurations.shadow
|
||||||
systemProperty("kotlin.version", buildKotlinVersion)
|
systemProperty("kotlin.version", buildKotlinVersion)
|
||||||
systemProperty("kotlin.repo", buildKotlinCompilerRepo)
|
systemProperty("kotlin.repo", buildKotlinCompilerRepo)
|
||||||
if (project.hasProperty("konan.home")) {
|
if (project.hasProperty("konan.home")) {
|
||||||
|
|||||||
+9
-3
@@ -34,6 +34,7 @@ import org.gradle.language.plugins.NativeBasePlugin
|
|||||||
import org.gradle.nativeplatform.test.tasks.RunTestExecutable
|
import org.gradle.nativeplatform.test.tasks.RunTestExecutable
|
||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME
|
import org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME
|
||||||
import org.jetbrains.kotlin.gradle.plugin.SubpluginEnvironment
|
import org.jetbrains.kotlin.gradle.plugin.SubpluginEnvironment
|
||||||
import org.jetbrains.kotlin.gradle.plugin.experimental.CInteropSettings
|
import org.jetbrains.kotlin.gradle.plugin.experimental.CInteropSettings
|
||||||
@@ -130,8 +131,13 @@ class KotlinNativeBasePlugin: Plugin<ProjectInternal> {
|
|||||||
assembleTask.dependsOn(it)
|
assembleTask.dependsOn(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
project.configurations.maybeCreate(PLUGIN_CLASSPATH_CONFIGURATION_NAME).apply {
|
project.configurations.apply {
|
||||||
isTransitive = false
|
maybeCreate(NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME).apply {
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
|
maybeCreate(PLUGIN_CLASSPATH_CONFIGURATION_NAME).apply {
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
components.withType(AbstractKotlinNativeBinary::class.java) { binary ->
|
components.withType(AbstractKotlinNativeBinary::class.java) { binary ->
|
||||||
@@ -149,7 +155,7 @@ class KotlinNativeBasePlugin: Plugin<ProjectInternal> {
|
|||||||
|
|
||||||
SubpluginEnvironment.loadSubplugins(this, kotlinVersion)
|
SubpluginEnvironment.loadSubplugins(this, kotlinVersion)
|
||||||
.addSubpluginOptions<CommonCompilerArguments>(this, it, it.compilerPluginOptions)
|
.addSubpluginOptions<CommonCompilerArguments>(this, it, it.compilerPluginOptions)
|
||||||
it.compilerPluginClasspath = project.configurations.getByName(PLUGIN_CLASSPATH_CONFIGURATION_NAME)
|
it.compilerPluginClasspath = project.configurations.getByName(NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME)
|
||||||
|
|
||||||
// Register an API header produced for shared/static library as a task output.
|
// Register an API header produced for shared/static library as a task output.
|
||||||
if (binary.kind == CompilerOutputKind.DYNAMIC || binary.kind == CompilerOutputKind.STATIC) {
|
if (binary.kind == CompilerOutputKind.DYNAMIC || binary.kind == CompilerOutputKind.STATIC) {
|
||||||
|
|||||||
@@ -844,4 +844,25 @@ class ExperimentalPluginTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Test
|
||||||
|
fun `Plugin should provide a correct serialization compiler plugin`() {
|
||||||
|
withProject {
|
||||||
|
pluginManager.apply("kotlinx-serialization-native")
|
||||||
|
repositories.apply {
|
||||||
|
jcenter()
|
||||||
|
maven { it.setUrl("http://kotlin.bintray.com/kotlin-eap") }
|
||||||
|
maven { it.setUrl("http://kotlin.bintray.com/kotlin-dev") }
|
||||||
|
}
|
||||||
|
evaluate()
|
||||||
|
tasks.withType(KotlinNativeCompile::class.java).all {
|
||||||
|
val compileClassPath = it.compilerPluginClasspath
|
||||||
|
assertNotNull(compileClassPath)
|
||||||
|
val files = compileClassPath.files
|
||||||
|
assertTrue(files.isNotEmpty(), "No compiler plugins in the classpath")
|
||||||
|
assertEquals(1, files.size, "More than one compiler plugin in the classpath")
|
||||||
|
assertTrue(files.single().absolutePath.contains("kotlin-serialization-unshaded"), "No unshaded version of serialization plugin in the classpath")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user