Skip to content

Commit 1ce546c

Browse files
committed
Fixes to publication, update to docs
### What's done: * Fixed publication not being skipped on not main workers * Updated ROADMAP.md * Updated gradle.properties
1 parent 72ee22e commit 1ce546c

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

ROADMAP.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Library:
2-
* [ ] More kotlin-way
2+
* [ ] More kotlin-way API
33
* [ ] Refactor DiffRowGenerator to use kotlin-dsl-style builder
44
* [x] Explicit API mode
5+
* [ ] Working with files
56
* [ ] Binary compatibility validator for JVM
67
* [ ] Benchmarks on JVM to compare with the original library
78

89
Infra:
910
* [ ] Static analysis (detekt, diktat)
10-
* [ ] Git hooks
11-
* [ ] Main CI worker depends on other two, executes task closeAndReleaseSonatypeStagingRepository if everything is successful
11+
* [ ] Git hooks

buildSrc/src/main/kotlin/io/github/petertrr/PublishingConfiguration.kt

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,37 @@ fun Project.configurePublishing() {
3333
}
3434

3535
configurePublications()
36+
37+
if (hasProperty("signingKey")) {
38+
configureSigning()
39+
}
40+
if (hasProperty("sonatypeUsername")) {
41+
configureNexusPublishing()
42+
}
43+
3644
// https://kotlinlang.org/docs/mpp-publish-lib.html#avoid-duplicate-publications
37-
// publication with name `kotlinMultiplatform` is for the default artifact
38-
// fixme: doesn't work as expected
39-
val publicationsFromMainHost = listOf("jvm", "js", "linuxX64", "kotlinMultiplatform", "metadata")
40-
configure<PublishingExtension> {
41-
publications {
42-
matching { it.name in publicationsFromMainHost }.all {
45+
// Publication with name `kotlinMultiplatform` is for the default artifact.
46+
// `configureNexusPublishing` adds sonatype publication tasks inside `afterEvaluate`.
47+
rootProject.afterEvaluate {
48+
val publicationsFromMainHost = listOf("jvm", "js", "linuxX64", "kotlinMultiplatform", "metadata")
49+
configure<PublishingExtension> {
50+
publications.matching { it.name in publicationsFromMainHost }.all {
4351
val targetPublication = this@all
4452
tasks.withType<AbstractPublishToMaven>()
4553
.matching { it.publication == targetPublication }
4654
.configureEach {
4755
onlyIf {
4856
// main publishing CI job is executed on Linux host
49-
DefaultNativePlatform.getCurrentOperatingSystem().isLinux
57+
DefaultNativePlatform.getCurrentOperatingSystem().isLinux.apply {
58+
if (!this) {
59+
logger.lifecycle("Publication ${(it as AbstractPublishToMaven).publication.name} is skipped on current host")
60+
}
61+
}
5062
}
5163
}
52-
}
64+
}
5365
}
5466
}
55-
56-
if (hasProperty("signingKey")) {
57-
configureSigning()
58-
}
59-
if (hasProperty("sonatypeUsername")) {
60-
configureNexusPublishing()
61-
}
6267
}
6368

6469
private fun Project.configurePublications() {

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
kotlin.code.style=official
2-
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
2+
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
3+
org.gradle.parallel=true
4+
org.gradle.vfs.watch=true

0 commit comments

Comments
 (0)