-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What's done: * Renamed project to kotlin-multiplatform-diff * Bump gradle version from 6.8.2 to 6.8.3, made gradlew executable, increased gradle memory limits * Bump kotlin version form 1.4.30 to 1.4.31 * Bump junit-jupiter-engine version from 5.0.0 to 5.7.1 * Introduced buildSrc * Added reckon plugin * Added RELEASING.md * Added release.yml * Added PublishingConfiguration.kt
- Loading branch information
Showing
11 changed files
with
244 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
env: | ||
GPG_SEC: ${{ secrets.PGP_SEC }} | ||
GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }} | ||
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }} | ||
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
|
||
jobs: | ||
release_linux: | ||
name: Build release on main platform (Linux) | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.11 | ||
- uses: burrunan/gradle-cache-action@v1 | ||
name: Gradle release with caches caching | ||
with: | ||
arguments: publishToSonatype closeSonatypeStagingRepository | ||
gradle-version: wrapper | ||
- name: Create Github Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
release_macos: | ||
name: Build release on MacOS | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.11 | ||
- uses: burrunan/gradle-cache-action@v1 | ||
name: Gradle release with caches caching | ||
with: | ||
arguments: publishToSonatype closeSonatypeStagingRepository | ||
gradle-version: wrapper | ||
release_windows: | ||
name: Build release on Windows | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.11 | ||
- uses: burrunan/gradle-cache-action@v1 | ||
name: Gradle release with caches caching | ||
with: | ||
arguments: publishToSonatype closeSonatypeStagingRepository | ||
gradle-version: wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1. Push a new git tag of a format 'v*', e.g. v1.0.0 | ||
2. Github Actions workflow will start, building release and pushing it to maven central. It will then create a github release. | ||
3. Update github release with release notes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
implementation("org.ajoberstar.reckon:reckon-gradle:0.13.0") | ||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20") | ||
implementation("io.github.gradle-nexus:publish-plugin:1.0.0") | ||
} |
120 changes: 120 additions & 0 deletions
120
buildSrc/src/main/kotlin/io/github/petertrr/PublishingConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package io.github.petertrr | ||
|
||
import org.gradle.api.Project | ||
import io.github.gradlenexus.publishplugin.NexusPublishPlugin | ||
import io.github.gradlenexus.publishplugin.NexusPublishExtension | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin | ||
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven | ||
import org.gradle.api.tasks.bundling.Jar | ||
import org.gradle.kotlin.dsl.* | ||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform | ||
import org.gradle.plugins.signing.SigningExtension | ||
import org.gradle.plugins.signing.SigningPlugin | ||
|
||
fun Project.configurePublishing() { | ||
apply<MavenPublishPlugin>() | ||
apply<SigningPlugin>() | ||
apply<NexusPublishPlugin>() | ||
|
||
// If present, set properties from env variables. If any are absent, release will fail. | ||
System.getenv("OSSRH_USERNAME")?.let { | ||
extra.set("sonatypeUsername", it) | ||
} | ||
System.getenv("OSSRH_PASSWORD")?.let { | ||
extra.set("sonatypePassword", it) | ||
} | ||
System.getenv("GPG_SEC")?.let { | ||
extra.set("signingKey", it) | ||
} | ||
System.getenv("GPG_PASSWORD")?.let { | ||
extra.set("signingPassword", it) | ||
} | ||
|
||
configurePublications() | ||
// https://kotlinlang.org/docs/mpp-publish-lib.html#avoid-duplicate-publications | ||
val publicationsFromMainHost = listOf("jvm", "js", "kotlinMultiplatform") | ||
configure<PublishingExtension> { | ||
publications { | ||
matching { it.name in publicationsFromMainHost }.all { | ||
val targetPublication = this@all | ||
tasks.withType<AbstractPublishToMaven>() | ||
.matching { it.publication == targetPublication } | ||
.configureEach { | ||
onlyIf { | ||
// main publishing CI job is executed on Linux host | ||
DefaultNativePlatform.getCurrentOperatingSystem().isLinux | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (hasProperty("signingKey")) { | ||
configureSigning() | ||
} | ||
if (hasProperty("sonatypeUsername")) { | ||
configureNexusPublishing() | ||
} | ||
} | ||
|
||
private fun Project.configurePublications() { | ||
val dokkaJar = tasks.create<Jar>("dokkaJar") { | ||
group = "documentation" | ||
archiveClassifier.set("javadoc") | ||
from(tasks.findByName("dokkaHtml")) | ||
} | ||
configure<PublishingExtension> { | ||
repositories { | ||
mavenLocal() | ||
} | ||
publications.withType<MavenPublication>().forEach { publication -> | ||
publication.artifact(dokkaJar) | ||
publication.pom { | ||
name.set(project.name) | ||
description.set(project.description ?: project.name) | ||
url.set("https://github.com/petertrr/kotlin-multiplatform-diff") | ||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("petertrr") | ||
name.set("Petr Trifanov") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set("https://github.com/petertrr/kotlin-multiplatform-diff") | ||
connection.set("scm:git:git://github.com/petertrr/kotlin-multiplatform-diff.git") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun Project.configureSigning() { | ||
configure<SigningExtension> { | ||
useInMemoryPgpKeys(property("signingKey") as String?, property("signingPassword") as String?) | ||
logger.lifecycle("The following publications are getting signed: ${extensions.getByType<PublishingExtension>().publications.map { it.name }}") | ||
sign(*extensions.getByType<PublishingExtension>().publications.toTypedArray()) | ||
} | ||
} | ||
|
||
private fun Project.configureNexusPublishing() { | ||
configure<NexusPublishExtension> { | ||
repositories { | ||
sonatype { //only for users registered in Sonatype after 24 Feb 2021 | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
username.set(property("sonatypeUsername") as String) | ||
password.set(property("sonatypePassword") as String) | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
buildSrc/src/main/kotlin/io/github/petertrr/VersioningConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.github.petertrr | ||
|
||
import org.ajoberstar.reckon.gradle.ReckonExtension | ||
import org.ajoberstar.reckon.gradle.ReckonPlugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.apply | ||
import org.gradle.kotlin.dsl.configure | ||
|
||
fun Project.configureVersioning() { | ||
apply<ReckonPlugin>() | ||
|
||
configure<ReckonExtension> { | ||
scopeFromProp() | ||
stageFromProp("alpha", "rc", "final") // version string will be based on last commit; when checking out a tag, that tag will be used | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
kotlin.code.style=official | ||
kotlin.code.style=official | ||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = "kotlin-diff-utils" | ||
rootProject.name = "kotlin-multiplatform-diff" |