Publish serialization plugin as kotlin-serialization-compiler-plugin
With this change it will have consistent naming with other compiler plugins. '-embeddable' was also renamed. 'dist' should contain two identical jar files: - 'serialization-compiler-plugin.jar' - 'kotlinx-serialization-compiler-plugin.jar' ^KT-58530 In Progress
This commit is contained in:
committed by
Space Team
parent
bc7b1094c3
commit
eef7c3e834
@@ -61,6 +61,8 @@
|
|||||||
<trust group="org.jetbrains.kotlin" name="kotlin-tooling-metadata" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
<trust group="org.jetbrains.kotlin" name="kotlin-tooling-metadata" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
<trust group="org.jetbrains.kotlin" name="kotlin-util-io" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
<trust group="org.jetbrains.kotlin" name="kotlin-util-io" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
<trust group="org.jetbrains.kotlin" name="kotlin-util-klib" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
<trust group="org.jetbrains.kotlin" name="kotlin-util-klib" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
|
<trust group="org.jetbrains.kotlin" name="kotlin-serialization-compiler-plugin" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
|
<trust group="org.jetbrains.kotlin" name="kotlin-serialization-compiler-plugin-embeddable" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin-embeddable" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin-embeddable" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||||
</trusted-artifacts>
|
</trusted-artifacts>
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
<!-- Compiler plugins. They can be added to the JPS process via KOTLIN_BUNDLED Path Variable -->
|
<!-- Compiler plugins. They can be added to the JPS process via KOTLIN_BUNDLED Path Variable -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>kotlinx-serialization-compiler-plugin</artifactId>
|
<artifactId>kotlin-serialization-compiler-plugin</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlinx-serialization-compiler-plugin</artifactId>
|
<artifactId>kotlin-serialization-compiler-plugin</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ class SerializationGradleSubplugin :
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val SERIALIZATION_GROUP_NAME = "org.jetbrains.kotlin"
|
const val SERIALIZATION_GROUP_NAME = "org.jetbrains.kotlin"
|
||||||
const val SERIALIZATION_ARTIFACT_NAME = "kotlinx-serialization-compiler-plugin-embeddable"
|
const val SERIALIZATION_ARTIFACT_NAME = "kotlin-serialization-compiler-plugin-embeddable"
|
||||||
const val SERIALIZATION_ARTIFACT_UNSHADED_NAME = "kotlinx-serialization-compiler-plugin"
|
const val SERIALIZATION_ARTIFACT_UNSHADED_NAME = "kotlin-serialization-compiler-plugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true
|
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true
|
||||||
|
|||||||
@@ -72,14 +72,37 @@ sourceSets {
|
|||||||
|
|
||||||
optInToExperimentalCompilerApi()
|
optInToExperimentalCompilerApi()
|
||||||
|
|
||||||
publish()
|
publish {
|
||||||
|
artifactId = artifactId.replace("kotlinx-", "kotlin-")
|
||||||
|
}
|
||||||
|
|
||||||
runtimeJar()
|
val runtimeJar = runtimeJar {
|
||||||
|
archiveBaseName.set("kotlin-serialization-compiler-plugin")
|
||||||
|
}
|
||||||
sourcesJar()
|
sourcesJar()
|
||||||
javadocJar()
|
javadocJar()
|
||||||
testsJar()
|
testsJar()
|
||||||
useD8Plugin()
|
useD8Plugin()
|
||||||
|
|
||||||
|
val distCompat by configurations.creating {
|
||||||
|
isCanBeResolved = false
|
||||||
|
isCanBeConsumed = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val compatJar = tasks.register<Copy>("compatJar") {
|
||||||
|
from(runtimeJar)
|
||||||
|
into(layout.buildDirectory.dir("libsCompat"))
|
||||||
|
rename {
|
||||||
|
it.replace("kotlin-", "kotlinx-")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
add(distCompat.name, compatJar) {
|
||||||
|
builtBy(runtimeJar, compatJar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
projectTest(parallel = true, jUnitMode = JUnitMode.JUnit5) {
|
projectTest(parallel = true, jUnitMode = JUnitMode.JUnit5) {
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
publish {
|
publish {
|
||||||
artifactId = artifactId.replace(".", "-")
|
artifactId = artifactId.replace(".", "-").replace("kotlinx-", "kotlin-")
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
|
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
|
||||||
|
|||||||
@@ -51,8 +51,17 @@ val libraries by configurations.creating {
|
|||||||
val librariesStripVersion by configurations.creating
|
val librariesStripVersion by configurations.creating
|
||||||
|
|
||||||
// Compiler plugins should be copied without `kotlin-` prefix
|
// Compiler plugins should be copied without `kotlin-` prefix
|
||||||
val compilerPlugins by configurations.creating {
|
val compilerPlugins by configurations.creating {
|
||||||
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
|
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
|
||||||
|
|
||||||
|
isCanBeConsumed = false
|
||||||
|
isCanBeResolved = true
|
||||||
|
}
|
||||||
|
val compilerPluginsCompat by configurations.creating {
|
||||||
|
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
|
||||||
|
|
||||||
|
isCanBeConsumed = false
|
||||||
|
isCanBeResolved = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val sources by configurations.creating {
|
val sources by configurations.creating {
|
||||||
@@ -119,6 +128,9 @@ val distCompilerPluginProjects = listOf(
|
|||||||
":kotlin-lombok-compiler-plugin",
|
":kotlin-lombok-compiler-plugin",
|
||||||
":kotlin-assignment-compiler-plugin"
|
":kotlin-assignment-compiler-plugin"
|
||||||
)
|
)
|
||||||
|
val distCompilerPluginProjectsCompat = listOf(
|
||||||
|
":kotlinx-serialization-compiler-plugin",
|
||||||
|
)
|
||||||
|
|
||||||
val distSourcesProjects = listOfNotNull(
|
val distSourcesProjects = listOfNotNull(
|
||||||
":kotlin-annotations-jvm",
|
":kotlin-annotations-jvm",
|
||||||
@@ -168,6 +180,16 @@ dependencies {
|
|||||||
distCompilerPluginProjects.forEach {
|
distCompilerPluginProjects.forEach {
|
||||||
compilerPlugins(project(it)) { isTransitive = false }
|
compilerPlugins(project(it)) { isTransitive = false }
|
||||||
}
|
}
|
||||||
|
distCompilerPluginProjectsCompat.forEach {
|
||||||
|
compilerPluginsCompat(
|
||||||
|
project(
|
||||||
|
mapOf(
|
||||||
|
"path" to it,
|
||||||
|
"configuration" to "distCompat"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
distSourcesProjects.forEach {
|
distSourcesProjects.forEach {
|
||||||
sources(project(it, configuration = "sources"))
|
sources(project(it, configuration = "sources"))
|
||||||
@@ -365,6 +387,7 @@ val distKotlinc = distTask<Sync>("distKotlinc") {
|
|||||||
val librariesStripVersionFiles = files(librariesStripVersion)
|
val librariesStripVersionFiles = files(librariesStripVersion)
|
||||||
val sourcesFiles = files(sources)
|
val sourcesFiles = files(sources)
|
||||||
val compilerPluginsFiles = files(compilerPlugins)
|
val compilerPluginsFiles = files(compilerPlugins)
|
||||||
|
val compilerPluginsCompatFiles = files(compilerPluginsCompat)
|
||||||
into("lib") {
|
into("lib") {
|
||||||
from(jarFiles) { rename { "$compilerBaseName.jar" } }
|
from(jarFiles) { rename { "$compilerBaseName.jar" } }
|
||||||
from(librariesFiles)
|
from(librariesFiles)
|
||||||
@@ -375,6 +398,17 @@ val distKotlinc = distTask<Sync>("distKotlinc") {
|
|||||||
}
|
}
|
||||||
from(sourcesFiles)
|
from(sourcesFiles)
|
||||||
from(compilerPluginsFiles) {
|
from(compilerPluginsFiles) {
|
||||||
|
rename {
|
||||||
|
// We want to migrate all compiler plugin in 'dist' to have 'kotlin-' prefix
|
||||||
|
// 'kotlin-serialization-compiler-plugin' is a new jar and should have such prefix from the start
|
||||||
|
if (!it.startsWith("kotlin-serialization")) {
|
||||||
|
it.removePrefix("kotlin-")
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
from(compilerPluginsCompatFiles) {
|
||||||
rename { it.removePrefix("kotlin-") }
|
rename { it.removePrefix("kotlin-") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user