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-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-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-embeddable" version="1.9.2?[0-9](-.+)?" regex="true"/>
|
||||
</trusted-artifacts>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
<!-- Compiler plugins. They can be added to the JPS process via KOTLIN_BUNDLED Path Variable -->
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>kotlinx-serialization-compiler-plugin</artifactId>
|
||||
<artifactId>kotlin-serialization-compiler-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlinx-serialization-compiler-plugin</artifactId>
|
||||
<artifactId>kotlin-serialization-compiler-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ class SerializationGradleSubplugin :
|
||||
|
||||
companion object {
|
||||
const val SERIALIZATION_GROUP_NAME = "org.jetbrains.kotlin"
|
||||
const val SERIALIZATION_ARTIFACT_NAME = "kotlinx-serialization-compiler-plugin-embeddable"
|
||||
const val SERIALIZATION_ARTIFACT_UNSHADED_NAME = "kotlinx-serialization-compiler-plugin"
|
||||
const val SERIALIZATION_ARTIFACT_NAME = "kotlin-serialization-compiler-plugin-embeddable"
|
||||
const val SERIALIZATION_ARTIFACT_UNSHADED_NAME = "kotlin-serialization-compiler-plugin"
|
||||
}
|
||||
|
||||
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true
|
||||
|
||||
@@ -72,14 +72,37 @@ sourceSets {
|
||||
|
||||
optInToExperimentalCompilerApi()
|
||||
|
||||
publish()
|
||||
publish {
|
||||
artifactId = artifactId.replace("kotlinx-", "kotlin-")
|
||||
}
|
||||
|
||||
runtimeJar()
|
||||
val runtimeJar = runtimeJar {
|
||||
archiveBaseName.set("kotlin-serialization-compiler-plugin")
|
||||
}
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
testsJar()
|
||||
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) {
|
||||
workingDir = rootDir
|
||||
useJUnitPlatform()
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
}
|
||||
|
||||
publish {
|
||||
artifactId = artifactId.replace(".", "-")
|
||||
artifactId = artifactId.replace(".", "-").replace("kotlinx-", "kotlin-")
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
|
||||
|
||||
@@ -53,6 +53,15 @@ val librariesStripVersion by configurations.creating
|
||||
// Compiler plugins should be copied without `kotlin-` prefix
|
||||
val compilerPlugins by configurations.creating {
|
||||
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 {
|
||||
@@ -119,6 +128,9 @@ val distCompilerPluginProjects = listOf(
|
||||
":kotlin-lombok-compiler-plugin",
|
||||
":kotlin-assignment-compiler-plugin"
|
||||
)
|
||||
val distCompilerPluginProjectsCompat = listOf(
|
||||
":kotlinx-serialization-compiler-plugin",
|
||||
)
|
||||
|
||||
val distSourcesProjects = listOfNotNull(
|
||||
":kotlin-annotations-jvm",
|
||||
@@ -168,6 +180,16 @@ dependencies {
|
||||
distCompilerPluginProjects.forEach {
|
||||
compilerPlugins(project(it)) { isTransitive = false }
|
||||
}
|
||||
distCompilerPluginProjectsCompat.forEach {
|
||||
compilerPluginsCompat(
|
||||
project(
|
||||
mapOf(
|
||||
"path" to it,
|
||||
"configuration" to "distCompat"
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
distSourcesProjects.forEach {
|
||||
sources(project(it, configuration = "sources"))
|
||||
@@ -365,6 +387,7 @@ val distKotlinc = distTask<Sync>("distKotlinc") {
|
||||
val librariesStripVersionFiles = files(librariesStripVersion)
|
||||
val sourcesFiles = files(sources)
|
||||
val compilerPluginsFiles = files(compilerPlugins)
|
||||
val compilerPluginsCompatFiles = files(compilerPluginsCompat)
|
||||
into("lib") {
|
||||
from(jarFiles) { rename { "$compilerBaseName.jar" } }
|
||||
from(librariesFiles)
|
||||
@@ -375,6 +398,17 @@ val distKotlinc = distTask<Sync>("distKotlinc") {
|
||||
}
|
||||
from(sourcesFiles)
|
||||
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-") }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user