File tree Expand file tree Collapse file tree 8 files changed +28
-10
lines changed
gradle-conventions-settings/src/main/kotlin/util
gradle-conventions/src/main
tests/compiler-plugin-tests Expand file tree Collapse file tree 8 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
1212import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
1313import java.io.File
1414
15- fun ProjectKotlinConfig.configureJsAndWasmJs () {
15+ fun ProjectKotlinConfig.configureJs () {
1616 if (! js) {
1717 return
1818 }
Original file line number Diff line number Diff line change @@ -9,17 +9,26 @@ package util
99import org.gradle.api.Project
1010import org.gradle.api.artifacts.dsl.RepositoryHandler
1111import org.gradle.api.provider.Property
12+ import org.gradle.api.publish.PublishingExtension
1213import org.gradle.api.publish.maven.MavenPublication
1314import org.gradle.kotlin.dsl.maven
15+ import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
1416import java.io.File
1517
1618const val KOTLINX_RPC_PREFIX = " kotlinx-rpc"
1719
20+ /* *
21+ * Important to configure inside [KotlinTarget.mavenPublication]
22+ * AND in [PublishingExtension.configurePublication] in the conventions-publishing.gradle.kts file.
23+ */
24+ @Suppress(" KDocUnresolvedReference" )
1825fun MavenPublication.setPublicArtifactId (project : Project ) {
1926 val publication = this
2027
21- publication.artifactId = " $KOTLINX_RPC_PREFIX -$artifactId "
22- project.logger.info(" Altered artifactId for $name publication: $artifactId " )
28+ if (! publication.artifactId.startsWith(KOTLINX_RPC_PREFIX )) {
29+ publication.artifactId = " $KOTLINX_RPC_PREFIX -$artifactId "
30+ project.logger.info(" Altered artifactId for $name publication: $artifactId " )
31+ }
2332}
2433
2534/* *
Original file line number Diff line number Diff line change @@ -69,8 +69,6 @@ private fun Project.configureDetekt(targets: List<KotlinTarget>) {
6969}
7070
7171fun ProjectKotlinConfig.configureKotlin (action : Action <KotlinMultiplatformExtension > = Action { }) {
72- configureJsAndWasmJs()
73-
7472 kotlin {
7573 val includedTargets = configureTargets(this @configureKotlin)
7674
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ fun NamedDomainObjectContainer<KotlinSourceSet>.applyCompilerSpecificSourceSets(
3333 // choose 'latest' if there are no more specific ones
3434 val mostSpecificApplicable = vsSets.mostSpecificVersionOrLatest(kotlinVersion)
3535
36- logger.info (
36+ logger.lifecycle (
3737 " ${project.name} : included version specific source sets: " +
3838 " ${core.name}${mostSpecificApplicable?.let { " , $name " } ? : " " } "
3939 )
@@ -49,7 +49,9 @@ fun NamedDomainObjectContainer<KotlinSourceSet>.applyCompilerSpecificSourceSets(
4949 set.configureResources(sourceSetPath)
5050
5151 val excluded = vsSets.filter { it != mostSpecificApplicable }
52- logger.info(" ${project.name} : excluded version specific source sets: [${excluded.joinToString { it.name }} ]" )
52+ logger.lifecycle(
53+ " ${project.name} : excluded version specific source sets: [${excluded.joinToString { it.name }} ]"
54+ )
5355 }
5456}
5557
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ configure<KotlinMultiplatformExtension> {
1818
1919withKotlinConfig {
2020 configureKotlin()
21+ configureJs()
2122 configureWasm()
2223}
2324
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ fun PublishingExtension.configurePublication() {
4747 publication.artifact(javadocJar)
4848 }
4949
50+ // mainly for kotlinMultiplatform publication
5051 publication.setPublicArtifactId(project)
5152
5253 if (! isGradlePlugin) {
Original file line number Diff line number Diff line change 55package util
66
77import org.gradle.kotlin.dsl.invoke
8+ import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
89import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
910
1011@OptIn(ExperimentalWasmDsl ::class )
1112fun ProjectKotlinConfig.configureWasm () {
13+ fun KotlinTarget.configurePublication () {
14+ mavenPublication {
15+ setPublicArtifactId(project)
16+ }
17+ }
18+
1219 kotlin {
1320 if (wasmJs) {
1421 wasmJs {
@@ -19,7 +26,7 @@ fun ProjectKotlinConfig.configureWasm() {
1926 d8()
2027
2128 binaries.library()
22- }
29+ }.configurePublication()
2330
2431 sourceSets {
2532 wasmJsMain {
@@ -39,7 +46,7 @@ fun ProjectKotlinConfig.configureWasm() {
3946 nodejs()
4047
4148 binaries.library()
42- }
49+ }.configurePublication()
4350 }
4451 }
4552}
Original file line number Diff line number Diff line change @@ -161,6 +161,6 @@ fun Test.setJarPathAsProperty(
161161}
162162
163163fun Test.systemPropertyLogged (name : String , value : Any ) {
164- logger.info (" Setting prop $name =$value " )
164+ logger.lifecycle (" Setting test prop $name =$value " )
165165 systemProperty(name, value)
166166}
You can’t perform that action at this time.
0 commit comments