Skip to content

Commit b822227

Browse files
committed
build logic cleanup
* align build-logic plugins with Gradle suggestions * introduce build-logic-settings for multiple settings configuration * move kotlin version to Version Catalog * move build-logic to root of the project * remove build-parameters * rename build-logic plugins * minor cleanup in the publication script * extract gradle related versions to Version Catalog
1 parent f696d6a commit b822227

File tree

44 files changed

+330
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+330
-338
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ jobs:
117117
--scan
118118
--info
119119
--continue
120-
-Pskip.test
120+
-Prsocketbuild.skipTests=true

gradle/plugins/build-logic/build.gradle.kts renamed to build-logic/build.gradle.kts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,11 +18,6 @@ plugins {
1818
`kotlin-dsl`
1919
}
2020

21-
kotlin {
22-
jvmToolchain(8)
23-
}
24-
2521
dependencies {
2622
implementation(kotlinLibs.gradle.plugin)
27-
implementation("rsocket.build:build-parameters")
2823
}

build-logic/settings.gradle.kts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2015-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
pluginManagement {
18+
includeBuild("../build-settings")
19+
}
20+
21+
plugins {
22+
id("rsocketsettings.default")
23+
}
24+
25+
dependencyResolutionManagement {
26+
versionCatalogs {
27+
create("libs") {
28+
from(files("../gradle/libs.versions.toml"))
29+
}
30+
}
31+
}
32+
33+
rootProject.name = "build-logic"

gradle/plugins/build-logic/src/main/kotlin/TestOptIn.kt renamed to build-logic/src/main/kotlin/TestOptIn.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

gradle/plugins/build-logic/src/main/kotlin/rsocket.multiplatform.gradle.kts renamed to build-logic/src/main/kotlin/rsocketbuild.multiplatform.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17+
import org.jetbrains.kotlin.gradle.tasks.*
18+
1719
plugins {
1820
kotlin("multiplatform")
19-
id("build-parameters")
2021
}
2122

2223
kotlin {
@@ -38,6 +39,11 @@ kotlin {
3839
}
3940
}
4041

41-
val buildParameters = the<buildparameters.BuildParametersExtension>()
42-
if (buildParameters.skip.test) tasks.matching { it.name.endsWith("test", ignoreCase = true) }.configureEach { onlyIf { false } }
43-
if (buildParameters.skip.link) tasks.matching { it.name.startsWith("link", ignoreCase = true) }.configureEach { onlyIf { false } }
42+
43+
if (providers.gradleProperty("rsocketbuild.skipTests").map(String::toBoolean).getOrElse(false)) {
44+
tasks.withType<AbstractTestTask>().configureEach { onlyIf { false } }
45+
}
46+
47+
if (providers.gradleProperty("rsocketbuild.skipNativeLink").map(String::toBoolean).getOrElse(false)) {
48+
tasks.withType<KotlinNativeLink>().configureEach { onlyIf { false } }
49+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
import org.jetbrains.kotlin.gradle.plugin.mpp.*
1818

1919
plugins {
20-
id("rsocket.multiplatform")
20+
id("rsocketbuild.multiplatform")
2121
}
2222

2323
kotlin {
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* Copyright 2015-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
`maven-publish`
19+
signing
20+
}
21+
22+
val githubUsername: String? by project
23+
val githubPassword: String? by project
24+
25+
val sonatypeUsername: String? by project
26+
val sonatypePassword: String? by project
27+
28+
val signingKey: String? by project
29+
val signingPassword: String? by project
30+
31+
// TODO: refactor publication a bit, so that version in gradle.properties will not contain SNAPSHOT
32+
val versionSuffix = providers.gradleProperty("rsocketbuild.versionSuffix").orNull
33+
if (versionSuffix != null) {
34+
val versionString = project.version.toString()
35+
require(versionString.endsWith("-SNAPSHOT"))
36+
project.version = versionString.replace("-", "-${versionSuffix}-")
37+
println("Current version: ${project.version}")
38+
}
39+
40+
// empty javadoc for maven central
41+
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") }
42+
43+
// this is somewhat a hack because we have a single javadoc artifact which is used for all publications
44+
tasks.withType<Sign>().configureEach { mustRunAfter(javadocJar) }
45+
tasks.withType<AbstractPublishToMaven>().configureEach { mustRunAfter(tasks.withType<Sign>()) }
46+
47+
publishing {
48+
publications.withType<MavenPublication> {
49+
artifact(javadocJar)
50+
pom {
51+
name.set(project.name)
52+
description.set(provider {
53+
checkNotNull(project.description) { "Project description isn't set for project: ${project.path}" }
54+
})
55+
url.set("http://rsocket.io")
56+
57+
licenses {
58+
license {
59+
name.set("The Apache Software License, Version 2.0")
60+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
61+
distribution.set("repo")
62+
}
63+
}
64+
developers {
65+
developer {
66+
id.set("whyoleg")
67+
name.set("Oleg Yukhnevich")
68+
email.set("[email protected]")
69+
}
70+
developer {
71+
id.set("OlegDokuka")
72+
name.set("Oleh Dokuka")
73+
email.set("[email protected]")
74+
}
75+
}
76+
scm {
77+
connection.set("https://github.com/rsocket/rsocket-kotlin.git")
78+
developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git")
79+
url.set("https://github.com/rsocket/rsocket-kotlin")
80+
}
81+
}
82+
}
83+
84+
repositories {
85+
// TODO: drop github and use sonatype (?)
86+
maven {
87+
name = "github"
88+
url = uri("https://maven.pkg.github.com/rsocket/rsocket-kotlin")
89+
credentials {
90+
username = githubUsername
91+
password = githubPassword
92+
}
93+
}
94+
maven {
95+
name = "sonatype"
96+
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
97+
credentials {
98+
username = sonatypeUsername
99+
password = sonatypePassword
100+
}
101+
}
102+
}
103+
}
104+
105+
signing {
106+
isRequired = sonatypeUsername != null && sonatypePassword != null
107+
useInMemoryPgpKeys(signingKey, signingPassword)
108+
sign(publishing.publications)
109+
}

gradle/plugins/build-logic/src/main/kotlin/rsocket.target.all.gradle.kts renamed to build-logic/src/main/kotlin/rsocketbuild.target.all.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
1515
*/
1616

1717
plugins {
18-
id("rsocket.target.js.all")
19-
id("rsocket.target.jvm")
20-
id("rsocket.target.native.all")
18+
id("rsocketbuild.target.js.all")
19+
id("rsocketbuild.target.jvm")
20+
id("rsocketbuild.target.native.all")
2121
}

gradle/plugins/build-logic/src/main/kotlin/rsocket.target.js.all.gradle.kts renamed to build-logic/src/main/kotlin/rsocketbuild.target.js.all.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,6 @@
1515
*/
1616

1717
plugins {
18-
id("rsocket.target.js.browser")
19-
id("rsocket.target.js.node")
18+
id("rsocketbuild.target.js.browser")
19+
id("rsocketbuild.target.js.node")
2020
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
1515
*/
1616

1717
plugins {
18-
id("rsocket.multiplatform")
18+
id("rsocketbuild.multiplatform")
1919
}
2020

2121
kotlin {

0 commit comments

Comments
 (0)