Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ on:
tags:
- 'v*'
env:
GPG_SEC: ${{ secrets.PGP_SEC }}
GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# TODO: required to use the in-memory PGP key.
# See https://github.com/vanniktech/gradle-maven-publish-plugin/issues/253#issuecomment-841637159
# ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.PGP_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.PGP_SEC }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.PGP_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}

jobs:
release:
Expand All @@ -35,4 +38,4 @@ jobs:
with:
gradle-version: wrapper
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- run: ./gradlew publishToSonatype closeSonatypeStagingRepository
- run: ./gradlew publishToMavenCentral
92 changes: 83 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import io.github.petertrr.configurePublishing
import io.github.petertrr.ext.booleanProperty
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest

plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.dokka)
alias(libs.plugins.detekt)
id("jacoco-convention")
alias(libs.plugins.vanniktech)
jacoco
}

group = "io.github.petertrr"
Expand All @@ -20,10 +20,9 @@ dependencies {

kotlin {
explicitApi()

compilerOptions {
apiVersion = KotlinVersion.KOTLIN_2_1
languageVersion = KotlinVersion.KOTLIN_2_1
apiVersion = KotlinVersion.KOTLIN_2_2
languageVersion = KotlinVersion.KOTLIN_2_2
}

jvm {
Expand Down Expand Up @@ -117,16 +116,91 @@ kotlin {
}
}

configurePublishing()
mavenPublishing {
coordinates(
groupId = project.group.toString(),
artifactId = project.name,
version = project.version.toString(),
)

// Publishing to Maven Central requires the following Gradle properties:
// mavenCentralUsername=central_username
// mavenCentralPassword=central_password
publishToMavenCentral()

// Signing is enabled only if the key is actually provided.
// We do not want missing signing info to block publication to local.
val signingKey = project.providers.gradleProperty("signingInMemoryKey")

if (signingKey.isPresent) {
// Signing requires the following Gradle properties:
// signingInMemoryKeyId=pgp_key_id
// signingInMemoryKey=pgp_key
// signingInMemoryKeyPassword=pgp_key_password
signAllPublications()
}

pom {
name.set(project.name)
description.set(project.description)
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("peter.trifanov@mail.ru")
}
}

scm {
url.set("https://github.com/petertrr/kotlin-multiplatform-diff")
connection.set("scm:git:git://github.com/petertrr/kotlin-multiplatform-diff.git")
}
}
}

jacoco {
toolVersion = "0.8.13"
}

detekt {
buildUponDefaultConfig = true
config.setFrom(files("detekt.yml"))
autoCorrect = booleanProperty("detektAutoCorrect", default = true)
autoCorrect = project.providers.gradleProperty("detektAutoCorrect").map(String::toBoolean).getOrElse(true)
}

tasks {
check {
dependsOn(detekt)
}

val jvmTest = named<Test>("jvmTest")
val jacocoReport = register<JacocoReport>("jacocoTestReport") {
dependsOn(jvmTest)

val commonMainSources = kotlin.sourceSets["commonMain"].kotlin.sourceDirectories
val jvmMainSources = kotlin.sourceSets["jvmMain"].kotlin.sourceDirectories

sourceDirectories.setFrom(files(commonMainSources, jvmMainSources))
classDirectories.setFrom(layout.buildDirectory.file("classes/kotlin/jvm/main"))
executionData.setFrom(layout.buildDirectory.files("jacoco/jvmTest.exec"))

reports {
xml.required = true
html.required = true
}
}

jvmTest.configure {
finalizedBy(jacocoReport)
}
}
9 changes: 0 additions & 9 deletions buildSrc/build.gradle.kts

This file was deleted.

13 changes: 0 additions & 13 deletions buildSrc/settings.gradle.kts

This file was deleted.

111 changes: 0 additions & 111 deletions buildSrc/src/main/kotlin/io/github/petertrr/PublishingConfiguration.kt

This file was deleted.

12 changes: 0 additions & 12 deletions buildSrc/src/main/kotlin/io/github/petertrr/ext/Project.ext.kt

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#########################
# Gradle settings
#########################
org.gradle.jvmargs = -Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs = -Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel = true
org.gradle.caching = true
org.gradle.configuration-cache = false
org.gradle.configuration-cache = true

#########################
# Kotlin settings
Expand Down
14 changes: 6 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[versions]
kotlin = "2.1.20"
kotlin = "2.2.20"
detekt = "1.23.8"
dokka = "1.9.20"
nexus = "2.0.0"
dokka = "2.1.0-Beta"
vanniktech = "0.34.0"

[plugins]
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
vanniktech = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech" }

[libraries]
detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" }

# Gradle plugins
kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
dokka-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" }
nexus-plugin = { group = "io.github.gradle-nexus", name = "publish-plugin", version.ref = "nexus" }
Loading
Loading