Skip to content

Commit

Permalink
Merge pull request #160 from simple-robot/dev/update-simbot
Browse files Browse the repository at this point in the history
build(deps): Update simbot from 4.0.0 to 4.5.0
  • Loading branch information
ForteScarlet authored Aug 6, 2024
2 parents 826a04a + 44a0979 commit 6c5acba
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 246 deletions.
10 changes: 4 additions & 6 deletions buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
@file:Suppress("MemberVisibilityCanBePrivate", "unused")

import love.forte.gradle.common.core.project.ProjectDetail
import love.forte.gradle.common.core.project.Version
import love.forte.gradle.common.core.project.minus
import love.forte.gradle.common.core.property.systemProp
import love.forte.gradle.common.core.project.version as v

/*
* Copyright (c) 2022-2022 ForteScarlet <[email protected]>
Expand Down Expand Up @@ -52,10 +49,11 @@ object P : ProjectDetail() {
override val homepage: String
get() = HOMEPAGE

private val baseVersion = v(4, 0, 0)
const val VERSION = "4.0.0-beta5"
const val NEXT_VERSION = "4.0.0-beta6"

val snapshotVersion = baseVersion - Version.SNAPSHOT
override val version = if (isSnapshot()) snapshotVersion else baseVersion
override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
override val version = if (isSnapshot()) snapshotVersion else VERSION

override val group: String get() = GROUP
override val description: String get() = DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import java.util.*
data class CommitLog(val message: String, val hash: MutableList<String>, val pre: String?)

fun Project.generateChangelog(tag: String) {
println("Generate change log for $tag ...")
logger.lifecycle("Generate change log for {} ...", tag)
// configurations.runtimeClasspath
val changelogDir = rootProject.file(".changelog").also {
it.mkdirs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tasks.withType<DokkaTaskPartial>().configureEach {
}

dokkaSourceSets.configureEach {
version = P.version.toString()
version = P.version
documentedVisibilities.set(
listOf(
DokkaConfiguration.Visibility.PUBLIC,
Expand Down Expand Up @@ -83,6 +83,9 @@ tasks.withType<DokkaTaskPartial>().configureEach {
sourceLink {
localDirectory.set(projectDir.resolve("src"))
val relativeTo = projectDir.relativeTo(rootProject.projectDir)
.path
.replace('\\', '/')

remoteUrl.set(URI.create("${P.HOMEPAGE}/tree/main/$relativeTo/src/").toURL())
remoteLineSuffix.set("#L")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
/*
* Copyright (c) 2023. ForteScarlet.
* Copyright (c) 2023-2024. ForteScarlet.
*
* This file is part of simbot-component-kook.
* This file is part of simbot-component-kook.
*
* simbot-component-kook is free software: you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
* simbot-component-kook is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* simbot-component-kook is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
* simbot-component-kook is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-kook,
* If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Lesser General Public License
* along with simbot-component-kook,
* If not, see <https://www.gnu.org/licenses/>.
*/

import love.forte.gradle.common.core.Gpg
import love.forte.gradle.common.core.project.setup
import love.forte.gradle.common.core.property.systemProp
import love.forte.gradle.common.publication.configure.multiplatformConfigPublishing
import love.forte.gradle.common.publication.configure.configPublishMaven
import love.forte.gradle.common.publication.configure.publishingExtension
import love.forte.gradle.common.publication.configure.setupPom

plugins {
kotlin("multiplatform")
Expand All @@ -30,30 +35,43 @@ plugins {
setup(P)

val p = project
multiplatformConfigPublishing {
project = P
isSnapshot = project.version.toString().contains("SNAPSHOT", true)

val jarJavadoc by tasks.registering(Jar::class) {
group = "documentation"
archiveClassifier.set("javadoc")
if (!(isSnapshot || isSnapshot() || isSimbotLocal())) {
archiveClassifier.set("javadoc")
from(tasks.findByName("dokkaHtml"))
val isSnapshot = project.version.toString().contains("SNAPSHOT", true)

val jarJavadoc by tasks.registering(Jar::class) {
group = "documentation"
archiveClassifier.set("javadoc")
if (!(isSnapshot || isSnapshot() || isSimbotLocal())) {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
}
}

publishing {
repositories {
mavenLocal()
if (isSnapshot) {
configPublishMaven(SnapshotRepository)
} else {
configPublishMaven(ReleaseRepository)
}
}

artifact(jarJavadoc)
releasesRepository = ReleaseRepository
snapshotRepository = SnapshotRepository
gpg = Gpg.ofSystemPropOrNull()
publications {
withType<MavenPublication> {
artifacts {
artifact(jarJavadoc)
}

if (isSimbotLocal()) {
mainHost = null
setupPom(project.name, P)
}
}
}

publicationsFromMainHost += listOf("wasm", "wasm32", "wasm_js")
mainHostSupportedTargets += listOf("wasm", "wasm32", "wasm_js")
signing {
val gpg = Gpg.ofSystemPropOrNull() ?: return@signing
val (keyId, secretKey, password) = gpg
useInMemoryPgpKeys(keyId, secretKey, password)
sign(publishingExtension.publications)
}

// TODO see https://github.com/gradle-nexus/publish-plugin/issues/208#issuecomment-1465029831
Expand Down
50 changes: 13 additions & 37 deletions buildSrc/src/main/kotlin/simbot-kook-changelog-generator.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
/*
* Copyright (c) 2022-2023. ForteScarlet.
* Copyright (c) 2022-2024. ForteScarlet.
*
* This file is part of simbot-component-kook.
* This file is part of simbot-component-kook.
*
* simbot-component-kook is free software: you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
* simbot-component-kook is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* simbot-component-kook is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
* simbot-component-kook is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-kook,
* If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Lesser General Public License
* along with simbot-component-kook,
* If not, see <https://www.gnu.org/licenses/>.
*/

import changelog.generateChangelog
Expand Down Expand Up @@ -52,30 +55,3 @@ tasks.create("createChangelog") {
}
}

tasks.create("updateWebsiteVersionJson") {
group = "documentation"
doFirst {
val version = P.version.toString()

val websiteVersionJsonDir = rootProject.file("website/static")
if (!websiteVersionJsonDir.exists()) {
websiteVersionJsonDir.mkdirs()
}
val websiteVersionJsonFile = File(websiteVersionJsonDir, "version.json")
if (!websiteVersionJsonFile.exists()) {
websiteVersionJsonFile.createNewFile()
}

websiteVersionJsonFile.writeText(
"""
{
"version": "$version"
}
""".trimIndent()
)
}
}

//fun repoRow(moduleName: String, group: String, id: String, version: String): String {
// return "| $moduleName | [$moduleName: v$version](https://repo1.maven.org/maven2/${group.replace(".", "/")}/${id.replace(".", "/")}/$version) | [$moduleName: v$version](https://search.maven.org/artifact/$group/$id/$version/jar) |"
//}
115 changes: 0 additions & 115 deletions buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ plugins {

setup(P)
if (isSnapshot()) {
version = P.snapshotVersion.toString()
version = P.snapshotVersion
}

repositories {
Expand Down Expand Up @@ -95,14 +95,6 @@ configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}


//// show project info
logger.info("========================================================")
logger.info("== project.group: ${group}")
logger.info("== project.name: ${name}")
logger.info("== project.version: ${version}")
logger.info("========================================================")

idea {
module {
isDownloadSources = true
Expand Down
Loading

0 comments on commit 6c5acba

Please sign in to comment.