File tree 8 files changed +28
-10
lines changed
gradle-conventions/src/main
gradle-conventions-settings/src/main/kotlin/util
tests/compiler-plugin-tests
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
12
12
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
13
13
import java.io.File
14
14
15
- fun ProjectKotlinConfig.configureJsAndWasmJs () {
15
+ fun ProjectKotlinConfig.configureJs () {
16
16
if (! js) {
17
17
return
18
18
}
Original file line number Diff line number Diff line change @@ -9,17 +9,26 @@ package util
9
9
import org.gradle.api.Project
10
10
import org.gradle.api.artifacts.dsl.RepositoryHandler
11
11
import org.gradle.api.provider.Property
12
+ import org.gradle.api.publish.PublishingExtension
12
13
import org.gradle.api.publish.maven.MavenPublication
13
14
import org.gradle.kotlin.dsl.maven
15
+ import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
14
16
import java.io.File
15
17
16
18
const val KOTLINX_RPC_PREFIX = " kotlinx-rpc"
17
19
20
+ /* *
21
+ * Important to configure inside [KotlinTarget.mavenPublication]
22
+ * AND in [PublishingExtension.configurePublication] in the conventions-publishing.gradle.kts file.
23
+ */
24
+ @Suppress(" KDocUnresolvedReference" )
18
25
fun MavenPublication.setPublicArtifactId (project : Project ) {
19
26
val publication = this
20
27
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
+ }
23
32
}
24
33
25
34
/* *
Original file line number Diff line number Diff line change @@ -69,8 +69,6 @@ private fun Project.configureDetekt(targets: List<KotlinTarget>) {
69
69
}
70
70
71
71
fun ProjectKotlinConfig.configureKotlin (action : Action <KotlinMultiplatformExtension > = Action { }) {
72
- configureJsAndWasmJs()
73
-
74
72
kotlin {
75
73
val includedTargets = configureTargets(this @configureKotlin)
76
74
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ fun NamedDomainObjectContainer<KotlinSourceSet>.applyCompilerSpecificSourceSets(
33
33
// choose 'latest' if there are no more specific ones
34
34
val mostSpecificApplicable = vsSets.mostSpecificVersionOrLatest(kotlinVersion)
35
35
36
- logger.info (
36
+ logger.lifecycle (
37
37
" ${project.name} : included version specific source sets: " +
38
38
" ${core.name}${mostSpecificApplicable?.let { " , $name " } ? : " " } "
39
39
)
@@ -49,7 +49,9 @@ fun NamedDomainObjectContainer<KotlinSourceSet>.applyCompilerSpecificSourceSets(
49
49
set.configureResources(sourceSetPath)
50
50
51
51
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
+ )
53
55
}
54
56
}
55
57
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ configure<KotlinMultiplatformExtension> {
18
18
19
19
withKotlinConfig {
20
20
configureKotlin()
21
+ configureJs()
21
22
configureWasm()
22
23
}
23
24
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ fun PublishingExtension.configurePublication() {
47
47
publication.artifact(javadocJar)
48
48
}
49
49
50
+ // mainly for kotlinMultiplatform publication
50
51
publication.setPublicArtifactId(project)
51
52
52
53
if (! isGradlePlugin) {
Original file line number Diff line number Diff line change 5
5
package util
6
6
7
7
import org.gradle.kotlin.dsl.invoke
8
+ import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
8
9
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
9
10
10
11
@OptIn(ExperimentalWasmDsl ::class )
11
12
fun ProjectKotlinConfig.configureWasm () {
13
+ fun KotlinTarget.configurePublication () {
14
+ mavenPublication {
15
+ setPublicArtifactId(project)
16
+ }
17
+ }
18
+
12
19
kotlin {
13
20
if (wasmJs) {
14
21
wasmJs {
@@ -19,7 +26,7 @@ fun ProjectKotlinConfig.configureWasm() {
19
26
d8()
20
27
21
28
binaries.library()
22
- }
29
+ }.configurePublication()
23
30
24
31
sourceSets {
25
32
wasmJsMain {
@@ -39,7 +46,7 @@ fun ProjectKotlinConfig.configureWasm() {
39
46
nodejs()
40
47
41
48
binaries.library()
42
- }
49
+ }.configurePublication()
43
50
}
44
51
}
45
52
}
Original file line number Diff line number Diff line change @@ -161,6 +161,6 @@ fun Test.setJarPathAsProperty(
161
161
}
162
162
163
163
fun Test.systemPropertyLogged (name : String , value : Any ) {
164
- logger.info (" Setting prop $name =$value " )
164
+ logger.lifecycle (" Setting test prop $name =$value " )
165
165
systemProperty(name, value)
166
166
}
You can’t perform that action at this time.
0 commit comments