From 1ea6c05aac28fb873f0f7c1e428a201a7f7e0731 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 30 Mar 2023 18:10:08 +0800 Subject: [PATCH] release: v0.2.7 --- .github/workflows/publish-release.yml | 2 +- buildSrc/src/main/kotlin/IProject.kt | 2 +- ...end-transform.jvm-maven-publish.gradle.kts | 41 +++++++++++-------- .../src/main/kotlin/utils/PropertiesUtil.kt | 3 ++ 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 4c0b69d..5a90ddb 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -55,7 +55,7 @@ jobs: -Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" -Porg.gradle.daemon=false env: - PLUGIN_AUTO: false + PLUGIN_AUTO: ${{ matrix.os == 'ubuntu-latest' }} publish-gradle-plugin: name: Publish Gradle Plugin diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index b779789..0b0c57d 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -8,7 +8,7 @@ object IProject : ProjectDetail() { const val DESCRIPTION = "Generate platform-compatible functions for Kotlin suspend functions" const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin" - override val version: Version = version(0, 2, 6) + override val version: Version = version(0, 2, 7) override val homepage: String get() = HOMEPAGE diff --git a/buildSrc/src/main/kotlin/suspend-transform.jvm-maven-publish.gradle.kts b/buildSrc/src/main/kotlin/suspend-transform.jvm-maven-publish.gradle.kts index 2abcdc5..7a0e234 100644 --- a/buildSrc/src/main/kotlin/suspend-transform.jvm-maven-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/suspend-transform.jvm-maven-publish.gradle.kts @@ -2,6 +2,8 @@ import love.forte.gradle.common.core.Gpg import love.forte.gradle.common.core.project.setup import love.forte.gradle.common.publication.configure.jvmConfigPublishing import love.forte.gradle.common.publication.configure.setupPom +import utils.isCi +import utils.isLinux plugins { id("org.jetbrains.dokka") @@ -14,30 +16,32 @@ setup(IProject) //val (sonatypeUsername, sonatypePassword) = sonatypeUserInfoOrNull //val sonatypeContains = sonatypeUserInfoOrNull != null +if (!isCi() || isLinux) { + jvmConfigPublishing { + project = IProject + val jarSources by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) + } -jvmConfigPublishing { - project = IProject - val jarSources by tasks.registering(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets["main"].allSource) - } - - val jarJavadoc by tasks.registering(Jar::class) { - dependsOn(tasks.dokkaJavadoc) - from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) - archiveClassifier.set("javadoc") - } + val jarJavadoc by tasks.registering(Jar::class) { + dependsOn(tasks.dokkaJavadoc) + from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) + archiveClassifier.set("javadoc") + } - artifact(jarSources) - artifact(jarJavadoc) + artifact(jarSources) + artifact(jarJavadoc) - isSnapshot = project.version.toString().contains("SNAPSHOT", true) - releasesRepository = ReleaseRepository - snapshotRepository = SnapshotRepository - gpg = Gpg.ofSystemPropOrNull() + isSnapshot = project.version.toString().contains("SNAPSHOT", true) + releasesRepository = ReleaseRepository + snapshotRepository = SnapshotRepository + gpg = Gpg.ofSystemPropOrNull() + } } + publishing.publications.configureEach { if (this is MavenPublication) { pom { @@ -46,6 +50,7 @@ publishing.publications.configureEach { } } + //publishing { // publications { // create("suspendTransformJvmDist") { diff --git a/buildSrc/src/main/kotlin/utils/PropertiesUtil.kt b/buildSrc/src/main/kotlin/utils/PropertiesUtil.kt index 20ff7ab..633a642 100644 --- a/buildSrc/src/main/kotlin/utils/PropertiesUtil.kt +++ b/buildSrc/src/main/kotlin/utils/PropertiesUtil.kt @@ -33,7 +33,10 @@ fun isRelease(): Boolean = systemProperty("RELEASE").toBoolean() * 是否在CI中 */ fun isCi(): Boolean = systemProperty("CI").toBoolean() + /** * 是否自动配置gradle的发布 */ fun isAutomatedGradlePluginPublishing(): Boolean = isCi() && systemProperty("PLUGIN_AUTO").toBoolean() + +val isLinux: Boolean = systemProperty("os.name")?.contains("linux", true) ?: false