Skip to content

Commit 335da7d

Browse files
committed
eliminates bintray. fixes sonotype release. minor fixes to build. increments patch version
Signed-off-by: Oleh Dokuka <[email protected]>
1 parent 9c3b585 commit 335da7d

File tree

10 files changed

+165
-159
lines changed

10 files changed

+165
-159
lines changed

.github/workflows/gradle-release.yml

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -8,94 +8,6 @@ on:
88
- '*' # Push events to matching *, i.e. 1.0, 20.15.10
99

1010
jobs:
11-
test:
12-
name: ${{ matrix.target }} Test Run (JVM ${{ matrix.jvm }})
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
os: [ macos-latest ]
17-
target: [ macosX64, iosX64, tvosX64, watchosX86 ]
18-
jvm: [ 11 ]
19-
include:
20-
- os: windows-latest
21-
target: mingwX64
22-
jvm: 11
23-
- os: ubuntu-latest
24-
target: linuxX64
25-
jvm: 11
26-
- os: ubuntu-latest
27-
target: jsIrNode
28-
jvm: 11
29-
- os: ubuntu-latest
30-
target: jsIrBrowser
31-
jvm: 11
32-
- os: ubuntu-latest
33-
target: jsLegacyNode
34-
jvm: 11
35-
- os: ubuntu-latest
36-
target: jsLegacyBrowser
37-
jvm: 11
38-
- os: ubuntu-latest
39-
target: jvm
40-
jvm: 8
41-
- os: ubuntu-latest
42-
target: jvm
43-
jvm: 11
44-
- os: ubuntu-latest
45-
target: jvm
46-
jvm: 15
47-
runs-on: ${{ matrix.os }}
48-
steps:
49-
- uses: actions/checkout@v2
50-
- uses: actions/setup-java@v2
51-
with:
52-
distribution: 'adopt'
53-
java-version: ${{ matrix.jvm }}
54-
- uses: actions/cache@v2
55-
with:
56-
path: |
57-
~/.gradle/caches/modules-2
58-
~/.gradle/wrapper
59-
~/.konan
60-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }}
61-
restore-keys: ${{ runner.os }}-gradle-
62-
- name: Test rsocket-core module
63-
if: success() || failure()
64-
timeout-minutes: 10
65-
uses: eskatos/gradle-command-action@v1
66-
with:
67-
arguments: rsocket-core:${{ matrix.target }}Test --scan --info
68-
wrapper-cache-enabled: false
69-
dependencies-cache-enabled: false
70-
configuration-cache-enabled: false
71-
- name: Test rsocket-transport-local module
72-
if: success() || failure()
73-
timeout-minutes: 10
74-
uses: eskatos/gradle-command-action@v1
75-
with:
76-
arguments: rsocket-transport-local:${{ matrix.target }}Test --scan --info
77-
wrapper-cache-enabled: false
78-
dependencies-cache-enabled: false
79-
configuration-cache-enabled: false
80-
- name: Test rsocket-transport-ktor module
81-
if: matrix.target != 'mingwX64' && matrix.target != 'jsIrNode' && matrix.target != 'jsIrBrowser' && matrix.target != 'jsLegacyNode' && matrix.target != 'jsLegacyBrowser' && (success() || failure())
82-
timeout-minutes: 10
83-
uses: eskatos/gradle-command-action@v1
84-
with:
85-
arguments: rsocket-transport-ktor:${{ matrix.target }}Test --scan --info
86-
wrapper-cache-enabled: false
87-
dependencies-cache-enabled: false
88-
configuration-cache-enabled: false
89-
90-
- name: Publish Test Report
91-
if: always()
92-
uses: mikepenz/action-junit-report@v2
93-
with:
94-
fail_on_failure: true
95-
check_name: ${{ matrix.target }} Test Report (JVM ${{ matrix.jvm }})
96-
report_paths: '**/build/test-results/*Test/TEST-*.xml'
97-
github_token: ${{ secrets.GITHUB_TOKEN }}
98-
9911
build:
10012
strategy:
10113
matrix:
@@ -150,21 +62,14 @@ jobs:
15062
- name: Set TAG_NAME for publication
15163
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
15264
shell: bash
153-
- name: Sign Packages
65+
- name: Publish Packages to Sonotype (version ${{ env.TAG_NAME }})
15466
uses: eskatos/gradle-command-action@v1
15567
with:
156-
arguments: sign --info
68+
arguments: publishAllPublicationsToSonatypeRepository -Pversion=${{ env.TAG_NAME }} --info --no-daemon
15769
wrapper-cache-enabled: false
15870
dependencies-cache-enabled: false
15971
configuration-cache-enabled: false
16072
ORG_GRADLE_PROJECT_signingKey: ${{secrets.signingKey}}
16173
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.signingPassword}}
162-
- name: Publish Packages to Sonotype (version ${{ env.TAG_NAME }})
163-
uses: eskatos/gradle-command-action@v1
164-
with:
165-
arguments: publishMavenPublicationToSonatypeRepository -Pversion=${{ env.TAG_NAME }} --info
166-
wrapper-cache-enabled: false
167-
dependencies-cache-enabled: false
168-
configuration-cache-enabled: false
16974
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.sonatypeUsername}}
17075
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.sonatypePassword}}

build.gradle.kts

Lines changed: 145 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import groovy.util.Node
18+
import groovy.util.NodeList
1719
import org.gradle.api.publish.maven.internal.artifact.FileBasedMavenArtifact
1820
import org.jetbrains.kotlin.gradle.dsl.*
1921
import org.jetbrains.kotlin.gradle.plugin.mpp.*
@@ -202,52 +204,117 @@ subprojects {
202204
}
203205
}
204206

207+
fun publishPlatformArtifactsInRootModule(platformPublication:MavenPublication,
208+
kotlinMultiplatformPublication: MavenPublication) {
209+
lateinit var platformXml: XmlProvider
210+
211+
platformPublication.pom.withXml { platformXml = this }
212+
213+
kotlinMultiplatformPublication.apply {
214+
pom.withXml {
215+
val root = asNode()
216+
// Remove the original content and add the content from the platform POM:
217+
root.children().toList().forEach { root.remove(it as Node) }
218+
platformXml.asNode().children()
219+
.forEach { root.append(it as Node) }
220+
221+
// Adjust the self artifact ID, as it should match the root module's coordinates:
222+
((root.get("artifactId") as NodeList)[0] as Node).setValue(artifactId)
223+
224+
// Set packaging to POM to indicate that there's no artifact:
225+
root.appendNode("packaging", "pom")
226+
227+
// Remove the original platform dependencies and add a single dependency on the platform module:
228+
val dependencies = (root.get("dependencies") as NodeList)[0] as Node
229+
dependencies.children().toList()
230+
.forEach { dependencies.remove(it as Node) }
231+
val singleDependency = dependencies.appendNode("dependency")
232+
singleDependency.appendNode(
233+
"groupId",
234+
platformPublication.groupId
235+
)
236+
singleDependency.appendNode(
237+
"artifactId",
238+
platformPublication.artifactId
239+
)
240+
singleDependency.appendNode(
241+
"version",
242+
platformPublication.version
243+
)
244+
singleDependency.appendNode("scope", "compile")
245+
}
246+
}
247+
248+
tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication" }
249+
.configureEach {
250+
dependsOn(tasks["generatePomFileFor${platformPublication.name.capitalize()}Publication"])
251+
}
252+
253+
}
205254

206255
//publication
207256
subprojects {
257+
afterEvaluate {
208258

209-
val versionSuffix: String? by project
210-
if (versionSuffix != null) {
211-
project.version = project.version.toString() + versionSuffix
212-
}
259+
val versionSuffix: String? by project
260+
if (versionSuffix != null) {
261+
project.version = project.version.toString() + versionSuffix
262+
}
213263

214-
plugins.withId("org.jetbrains.kotlin.multiplatform") {
215-
extensions.configure<KotlinMultiplatformExtension> {
216-
targets.all {
217-
mavenPublication {
218-
pom {
219-
name.set(project.name)
220-
description.set(project.description)
221-
url.set("http://rsocket.io")
222-
223-
licenses {
224-
license {
225-
name.set("The Apache Software License, Version 2.0")
226-
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
227-
distribution.set("repo")
264+
task<Jar>("javadocJar") {
265+
archiveClassifier.set("javadoc")
266+
}
267+
268+
tasks.withType<Sign> {
269+
dependsOn("javadocJar")
270+
}
271+
272+
plugins.withId("org.jetbrains.kotlin.multiplatform") {
273+
extensions.configure<KotlinMultiplatformExtension> {
274+
targets.all {
275+
mavenPublication {
276+
pom {
277+
name.set(project.name)
278+
description.set(project.description)
279+
url.set("http://rsocket.io")
280+
281+
licenses {
282+
license {
283+
name.set("The Apache Software License, Version 2.0")
284+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
285+
distribution.set("repo")
286+
}
228287
}
229-
}
230-
developers {
231-
developer {
232-
id.set("whyoleg")
233-
name.set("Oleg Yukhnevich")
234-
email.set("[email protected]")
288+
developers {
289+
developer {
290+
id.set("whyoleg")
291+
name.set("Oleg Yukhnevich")
292+
email.set("[email protected]")
293+
}
294+
developer {
295+
id.set("OlegDokuka")
296+
name.set("Oleh Dokuka")
297+
email.set("[email protected]")
298+
}
235299
}
236-
developer {
237-
id.set("OlegDokuka")
238-
name.set("Oleh Dokuka")
239-
email.set("oleh.dokuka@icloud.com")
300+
scm {
301+
connection.set("https://github.com/rsocket/rsocket-kotlin.git")
302+
developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git")
303+
url.set("https://github.com/rsocket/rsocket-kotlin")
240304
}
241305
}
242-
scm {
243-
connection.set("https://github.com/rsocket/rsocket-kotlin.git")
244-
developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git")
245-
url.set("https://github.com/rsocket/rsocket-kotlin")
246-
}
247306
}
248307
}
249308
}
250309
}
310+
311+
tasks.withType<PublishToMavenRepository> {
312+
dependsOn(tasks.withType<Sign>())
313+
}
314+
315+
tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication"}.configureEach {
316+
dependsOn(tasks["generatePomFileForJvmPublication"])
317+
}
251318
}
252319
}
253320

@@ -282,14 +349,16 @@ if (bintrayUser != null && bintrayKey != null) {
282349
}
283350
}
284351
}
352+
}
285353

286-
//configure bintray / maven central
287-
val sonatypeUsername: String? by project
288-
val sonatypePassword: String? by project
289-
if (sonatypeUsername != null && sonatypePassword != null) {
290-
subprojects {
291-
plugins.withType<MavenPublishPlugin> {
292-
plugins.withType<SigningPlugin> {
354+
//configure bintray / maven central
355+
val sonatypeUsername: String? by project
356+
val sonatypePassword: String? by project
357+
if (sonatypeUsername != null && sonatypePassword != null) {
358+
subprojects {
359+
afterEvaluate {
360+
plugins.withId("maven-publish") {
361+
plugins.withId("signing") {
293362
extensions.configure<SigningExtension> {
294363
//requiring signature if there is a publish task that is not to MavenLocal
295364
isRequired = gradle.taskGraph.allTasks.any {
@@ -303,20 +372,23 @@ if (bintrayUser != null && bintrayKey != null) {
303372
useInMemoryPgpKeys(signingKey, signingPassword)
304373
val names = publicationNames
305374
val publishing: PublishingExtension by project.extensions
306-
afterEvaluate {
375+
beforeEvaluate {
307376
publishing.publications
308-
.filterIsInstance<MavenPublication>()
309-
.filter { it.name in names }
310-
.forEach { publication ->
311-
val moduleFile = buildDir.resolve("publications/${publication.name}/module.json")
312-
if (moduleFile.exists()) {
313-
publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
314-
override fun getDefaultExtension() = "module"
315-
})
377+
.filterIsInstance<MavenPublication>()
378+
.filter { it.name in names }
379+
.forEach { publication ->
380+
val moduleFile =
381+
buildDir.resolve("publications/${publication.name}/module.json")
382+
if (moduleFile.exists()) {
383+
publication.artifact(object :
384+
FileBasedMavenArtifact(moduleFile) {
385+
override fun getDefaultExtension() = "module"
386+
})
387+
}
316388
}
317-
sign(publication)
318-
}
319-
389+
}
390+
afterEvaluate {
391+
sign(*publishing.publications.toTypedArray())
320392
}
321393
}
322394

@@ -331,6 +403,27 @@ if (bintrayUser != null && bintrayKey != null) {
331403
}
332404
}
333405
}
406+
407+
publications.filterIsInstance<MavenPublication>().forEach {
408+
// add empty javadocs
409+
if (name != "kotlinMultiplatform") {
410+
it.artifact(tasks["javadocJar"])
411+
}
412+
413+
val type = it.name
414+
when (type) {
415+
"kotlinMultiplatform" -> {
416+
// With Kotlin 1.4 & HMPP, the root module should have no suffix in the ID, but for compatibility with
417+
// the consumers who can't read Gradle module metadata, we publish the JVM artifacts in it, too
418+
it.artifactId = project.name
419+
publishPlatformArtifactsInRootModule(
420+
publications["jvm"] as MavenPublication,
421+
it
422+
)
423+
}
424+
else -> it.artifactId = "${project.name}-$type"
425+
}
426+
}
334427
}
335428
}
336429
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#Project
1818
group=io.rsocket.kotlin
19-
version=0.13.0
19+
version=0.13.1
2020

2121
#Versions
2222
kotlinVersion=1.5.20

rsocket-core/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
id("kotlinx-atomicfu")
2020

2121
signing
22-
id("maven-publish")
22+
`maven-publish`
2323
id("com.jfrog.artifactory")
2424
}
2525

@@ -41,3 +41,5 @@ kotlin {
4141
}
4242
}
4343
}
44+
45+
description = "Core functionality for the RSocket library"

0 commit comments

Comments
 (0)