Skip to content

Commit 2e062f5

Browse files
committed
Fix: Sonatype Nexus publishing
There seems to be a problem with `group` and `version` set on the root project conflicting with the same set on the subprojects when trying to use the Nexus publishing plugin: gradle-nexus/publish-plugin#150 These changes resolve this by aligning all of them. Once this needs to deviate we may have to revisit.
1 parent 5a1f454 commit 2e062f5

File tree

7 files changed

+36
-23
lines changed

7 files changed

+36
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ val size: Duration = interval.size // 100 seconds
3131
This library includes a generic base class `Interval<T, TSize>` which can be used to create intervals for any type.
3232
To achieve this, it directs type operations to `IntervalTypeOperations` which the constructor takes as a parameter.
3333

34-
The following interval types are included in `io.github.whathecode.kotlinx.interval:kotlinx.interval` on Maven:
34+
The following interval types are included in `io.github.whathecode.kotlinx.interval:kotlinx-interval` on Maven:
3535

3636
| Type | Values (`T`) | Distances (`TSize`) |
3737
|:----------------:|:------------:|:-------------------:|
@@ -49,4 +49,4 @@ The following interval types are included in `io.github.whathecode.kotlinx.inter
4949

5050
### Date/time intervals
5151
Date/time intervals are implemented as `InstantInterval` using the [kotlinx datetime](https://github.com/Kotlin/kotlinx-datetime) library.
52-
Since you may not always want to pull in this dependency, this class is published separately in `io.github.whathecode.kotlinx.interval:kotlinx.interval.datetime`.
52+
Since you may not always want to pull in this dependency, this class is published separately in `io.github.whathecode.kotlinx.interval:kotlinx-interval-datetime`.

build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ val publishPropertiesFile = File("publish.properties")
1515
if (publishPropertiesFile.exists()) {
1616
publishProperties.load(java.io.FileInputStream(publishPropertiesFile))
1717
}
18+
group = "io.github.whathecode.kotlinx.interval"
19+
version = "1.0.0-alpha.3"
1820
nexusPublishing {
1921
repositories {
2022
sonatype {
@@ -25,3 +27,12 @@ nexusPublishing {
2527
}
2628
}
2729
}
30+
val setSnapshotVersion: Task by tasks.creating {
31+
doFirst {
32+
val versionSplit = version.toString().split("-")
33+
val snapshotVersion = "${versionSplit[0]}-SNAPSHOT"
34+
version = snapshotVersion
35+
36+
rootProject.subprojects.forEach { it.version = snapshotVersion }
37+
}
38+
}

buildSrc/src/main/kotlin/interval.library-conventions.gradle.kts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ repositories {
1515
mavenCentral()
1616
}
1717

18-
group = "io.github.whathecode.kotlinx.interval"
19-
version = "1.0.0-alpha.3"
20-
2118

2219
kotlin {
2320
jvm {
@@ -125,10 +122,3 @@ signing {
125122
sign(publishing.publications)
126123
}
127124
}
128-
val setSnapshotVersion by tasks.creating {
129-
doFirst {
130-
val versionSplit = version.toString().split("-")
131-
val snapshotVersion = "${versionSplit[0]}-SNAPSHOT"
132-
version = snapshotVersion
133-
}
134-
}

kotlinx.interval.datetime/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
group = rootProject.group
2+
version = rootProject.version
3+
14
plugins {
25
id( "interval.library-conventions" )
36
}
47

58
publishing {
69
publications.filterIsInstance<MavenPublication>().forEach {
710
it.pom {
8-
name.set("kotlinx.interval.datetime")
11+
name.set("kotlinx-interval-datetime")
912
description.set("Kotlin multiplatform bounded open/closed date/time intervals.")
1013
}
1114
}
@@ -15,13 +18,13 @@ kotlin {
1518
sourceSets {
1619
commonMain {
1720
dependencies {
18-
api(project(":kotlinx.interval"))
21+
api(project(":kotlinx-interval"))
1922
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2")
2023
}
2124
}
2225
commonTest {
2326
dependencies {
24-
implementation(project(":kotlinx.interval.test"))
27+
implementation(project(":kotlinx-interval-test"))
2528
}
2629
}
2730
}

kotlinx.interval.test/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
group = rootProject.group
2+
version = rootProject.version
3+
14
plugins {
25
id( "interval.library-conventions" )
36
}
47

58
publishing {
69
publications.filterIsInstance<MavenPublication>().forEach {
710
it.pom {
8-
name.set("kotlinx.interval.test")
11+
name.set("kotlinx-interval-test")
912
description.set("Base test classes for extensions of kotlinx.interval.")
1013
}
1114
}
@@ -15,7 +18,7 @@ kotlin {
1518
sourceSets {
1619
commonMain {
1720
dependencies {
18-
api(project(":kotlinx.interval"))
21+
api(project(":kotlinx-interval"))
1922
implementation(kotlin("test"))
2023
}
2124
}

kotlinx.interval/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
group = rootProject.group
2+
version = rootProject.version
3+
14
plugins {
25
id( "interval.library-conventions" )
36
}
47

58
publishing {
69
publications.filterIsInstance<MavenPublication>().forEach {
710
it.pom {
8-
name.set("kotlinx.interval")
11+
name.set("kotlinx-interval")
912
description.set("Kotlin multiplatform bounded open/closed generic intervals.")
1013
}
1114
}
@@ -15,7 +18,7 @@ kotlin {
1518
sourceSets {
1619
commonTest {
1720
dependencies {
18-
implementation(project(":kotlinx.interval.test"))
21+
implementation(project(":kotlinx-interval-test"))
1922
}
2023
}
2124
}

settings.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
rootProject.name = "kotlinx-interval"
1+
include("kotlinx.interval")
2+
project(":kotlinx.interval").name = "kotlinx-interval"
23

3-
include( "kotlinx.interval" )
4-
include( "kotlinx.interval.test" )
5-
include( "kotlinx.interval.datetime" )
4+
include("kotlinx.interval.test")
5+
project(":kotlinx.interval.test").name = "kotlinx-interval-test"
6+
7+
include("kotlinx.interval.datetime")
8+
project(":kotlinx.interval.datetime").name = "kotlinx-interval-datetime"

0 commit comments

Comments
 (0)