Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libs.versions.toml and clean gradle files #719

Merged
merged 6 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 0 additions & 5 deletions .github/workflows/deployment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,3 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: -x test publish

# Disabled for now
#
# - name: Close and Release Repository
# run: ./gradlew closeAndReleaseRepository
lukellmann marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Push docs to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dokka
folder: build/dokka/htmlMultiModule
branch: gh-pages
git-config-name: GitHub Actions
git-config-email: [email protected]
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.gradle/
.idea/
out/
dokka/

**/build/*
!**/build/generated/
Expand Down
Empty file removed api/kord.api
Empty file.
45 changes: 6 additions & 39 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL

plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.12.1"
id("org.jetbrains.dokka")

signing
`maven-publish`
id("io.codearte.nexus-staging") version "0.30.0"
org.jetbrains.dokka // for dokkaHtmlMultiModule task
}

repositories {
Expand All @@ -18,35 +11,9 @@ repositories {
group = Library.group
version = Library.version

tasks {
wrapper {
// Steps for upgrading Gradle:
// 1. update `gradleVersion` and `distributionSha256Sum`
// (use 'Complete (-all) ZIP Checksum' found here: https://gradle.org/release-checksums/)
// 2. run `./gradlew wrapper`
// (will update 'gradle/wrapper/gradle-wrapper.properties')
// 3. run `./gradlew wrapper` again
// (might update 'gradle/wrapper/gradle-wrapper.jar', 'gradlew' and 'gradlew.bat')
// 4. commit all changes

gradleVersion = "7.5.1"
distributionType = ALL
distributionSha256Sum = "db9c8211ed63f61f60292c69e80d89196f9eb36665e369e7f00ac4cc841c2219"
}

val dokkaOutputDir = rootProject.projectDir.resolve("dokka")

clean {
delete(dokkaOutputDir)
}

dokkaHtmlMultiModule {
dependsOn(clean)
failOnWarning.set(true)
outputDirectory.set(dokkaOutputDir)
}
}

apiValidation {
ignoredProjects += listOf("ksp-annotations", "ksp-processors")
// To upgrade Gradle, run the following command twice and commit all changes:
// ./gradlew wrapper --gradle-version <version> --gradle-distribution-sha256-sum <checksum>
// (use 'Complete (-all) ZIP Checksum' from https://gradle.org/release-checksums for <checksum>)
tasks.wrapper {
distributionType = ALL
}
9 changes: 1 addition & 8 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@ plugins {

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
val kotlinVersion = "1.7.20"
implementation(kotlin("gradle-plugin", kotlinVersion))
implementation(kotlin("serialization", kotlinVersion))
implementation("org.jetbrains.dokka", "dokka-gradle-plugin", "1.7.20")
implementation("org.jetbrains.kotlinx", "atomicfu-gradle-plugin", "0.18.5")
implementation("com.google.devtools.ksp", "symbol-processing-gradle-plugin", "1.7.20-1.0.8")
implementation(gradleApi())
implementation(libs.bundles.pluginsForBuildSrc)
}
12 changes: 9 additions & 3 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// avoids warning:
// "Project accessors enabled, but root project name not explicitly set for 'buildSrc'. Checking out the project in
// different folders will impact the generated code and implicitly the buildscript classpath, breaking caching."
rootProject.name = "buildSrc"

dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
18 changes: 0 additions & 18 deletions buildSrc/src/main/kotlin/Publishing.kt

This file was deleted.

2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/kord-internal-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm")
org.jetbrains.kotlin.jvm
}

repositories {
Expand Down
19 changes: 12 additions & 7 deletions buildSrc/src/main/kotlin/kord-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL

plugins {
java
kotlin("jvm")
kotlin("plugin.serialization")
id("org.jetbrains.dokka")
id("kotlinx-atomicfu")
id("com.google.devtools.ksp")
org.jetbrains.kotlin.jvm
org.jetbrains.kotlin.plugin.serialization
org.jetbrains.dokka
`kotlinx-atomicfu`
org.jetbrains.kotlinx.`binary-compatibility-validator`
com.google.devtools.ksp
`maven-publish`
}

repositories {
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}

dependencies {
Expand All @@ -34,6 +33,12 @@ kotlin {
}
}

// https://github.com/Kotlin/kotlinx-atomicfu/issues/210
atomicfu {
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
dependenciesVersion = libs.findVersion("kotlinx-atomicfu").get().requiredVersion
}

tasks {
withType<JavaCompile> {
sourceCompatibility = Jvm.targetString
Expand Down
98 changes: 48 additions & 50 deletions buildSrc/src/main/kotlin/kord-publishing.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,71 @@ plugins {
signing
}

tasks {
publishing {
publications {
create<MavenPublication>(Library.name) {
groupId = Library.group
artifactId = "kord-${project.name}"
version = Library.version
publishing {
publications {
create<MavenPublication>(Library.name) {
groupId = Library.group
artifactId = "kord-${project.name}"
version = Library.version

pom {
name.set(Library.name)
description.set(Library.description)
url.set(Library.projectUrl)
pom {
name.set(Library.name)
description.set(Library.description)
url.set(Library.projectUrl)

organization {
name.set("Kord")
url.set("https://github.com/kordlib")
}
organization {
name.set("Kord")
url.set("https://github.com/kordlib")
}

developers {
developer {
name.set("The Kord Team")
}
developers {
developer {
name.set("The Kord Team")
}
}

issueManagement {
system.set("GitHub")
url.set("https://github.com/kordlib/kord/issues")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/kordlib/kord/issues")
}

licenses {
license {
name.set("MIT")
url.set("http://opensource.org/licenses/MIT")
}
}
scm {
connection.set("scm:git:ssh://github.com/kordlib/kord.git")
developerConnection.set("scm:git:ssh://[email protected]:kordlib/kord.git")
url.set(Library.projectUrl)
licenses {
license {
name.set("MIT")
url.set("http://opensource.org/licenses/MIT")
}
}

if (!isJitPack) {
repositories {
maven {
url = if (Library.isSnapshot) uri(Repo.snapshotsUrl)
else uri(Repo.releasesUrl)
scm {
connection.set("scm:git:ssh://github.com/kordlib/kord.git")
developerConnection.set("scm:git:ssh://[email protected]:kordlib/kord.git")
url.set(Library.projectUrl)
}
}

credentials {
username = System.getenv("NEXUS_USER")
password = System.getenv("NEXUS_PASSWORD")
}
if (!isJitPack) {
repositories {
maven {
url = uri(if (Library.isSnapshot) Repo.snapshotsUrl else Repo.releasesUrl)

credentials {
username = System.getenv("NEXUS_USER")
password = System.getenv("NEXUS_PASSWORD")
}
}
}
}
}
}
}

if (!isJitPack && Library.isRelease) {
signing {
val signingKey = findProperty("signingKey")?.toString()
val signingPassword = findProperty("signingPassword")?.toString()
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(String(Base64.getDecoder().decode(signingKey)), signingPassword)
}
sign(publishing.publications[Library.name])
if (!isJitPack && Library.isRelease) {
signing {
val signingKey = findProperty("signingKey")?.toString()
val signingPassword = findProperty("signingPassword")?.toString()
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(String(Base64.getDecoder().decode(signingKey)), signingPassword)
}
sign(publishing.publications[Library.name])
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/kord-sampled-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm")
org.jetbrains.kotlin.jvm
}

sourceSets {
Expand Down
21 changes: 8 additions & 13 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
buildscript {
repositories {
mavenCentral()
}
}

@Suppress("DSL_SCOPE_VIOLATION") // false positive for `libs` in IntelliJ
plugins {
`kord-module`
`kord-sampled-module`
`kord-publishing`

// see https://github.com/gmazzo/gradle-buildconfig-plugin
id("com.github.gmazzo.buildconfig") version "3.1.0"
alias(libs.plugins.buildconfig)
}

dependencies {
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.serialization.json)
api(libs.kotlinx.datetime)

api(libs.bundles.common)
testImplementation(libs.bundles.test.implementation)
testRuntimeOnly(libs.bundles.test.runtime)
api(libs.kotlin.logging)

compileOnly(projects.kspAnnotations)
ksp(projects.kspProcessors)

testImplementation(libs.bundles.test.implementation)
testRuntimeOnly(libs.bundles.test.runtime)
}

/*
Expand Down
4 changes: 1 addition & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ dependencies {
"voiceApi"(projects.core)
"voiceApi"(projects.voice)

implementation(libs.bundles.common)

api(libs.kord.cache.api)
api(libs.kord.cache.map)

samplesImplementation(libs.slf4j.simple)
testImplementation(libs.mockk)

testImplementation(libs.bundles.test.implementation)
testRuntimeOnly(libs.bundles.test.runtime)
}
Expand Down
5 changes: 1 addition & 4 deletions gateway/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ plugins {

dependencies {
api(projects.common)
implementation(libs.bundles.common)

api(libs.ktor.client.json)
api(libs.ktor.client.websockets)
api(libs.bundles.ktor.client.serialization)
api(libs.ktor.client.websockets)
api(libs.ktor.client.cio)


testImplementation(libs.bundles.test.implementation)
testRuntimeOnly(libs.bundles.test.runtime)
}
Loading