Skip to content

Commit

Permalink
Update gradle settings to use semver.kt plugin for versioning
Browse files Browse the repository at this point in the history
Close #225
  • Loading branch information
serpro69 committed Mar 23, 2024
1 parent 5b07205 commit 637498b
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 51 deletions.
82 changes: 41 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,131 +35,131 @@ deploy-docs: ## deploys documentation with orchid

.PHONY: snapshot-in-pre-release
_snapshot-in-pre-release: ## (DEPRECATED) publishes next snapshot in current pre-release version
./gradlew clean test integrationTest \
./gradlew test integrationTest \
printVersion \
nativeCompile \
publishToSonatype \
-PpromoteToRelease \
-PpromoteRelease \
--info

.PHONY: snapshot-major
_snapshot-major: ## (DEPRECATED) publishes next snapshot with a major version bump
./gradlew clean test integrationTest \
./gradlew test integrationTest \
printVersion \
nativeCompile \
publishToSonatype \
-PbumpComponent=major \
-Pincrement=major \
--info

.PHONY: snapshot-minor
snapshot-minor: check_java ## publishes next snapshot with a minor version bump
_snapshot-minor: check_java ## (DEPRECATED) publishes next snapshot with a minor version bump
@:$(call check_defined, VERSION, semantic version string - 'X.Y.Z(-rc.\d+)?')

./gradlew clean test integrationTest -Pversion='$(VERSION)-SNAPSHOT'
./gradlew test integrationTest -Pversion='$(VERSION)-SNAPSHOT'
./gradlew nativeCompile -Pversion='$(VERSION)-SNAPSHOT' --info
./gradlew publishToSonatype -Pversion='$(VERSION)-SNAPSHOT' --info

.PHONY: snapshot-patch
_snapshot-patch: ## (DEPRECATED) publishes next snapshot with a patch version bump
./gradlew clean test integrationTest \
./gradlew test integrationTest \
printVersion \
nativeCompile \
publishToSonatype \
-PbumpComponent=patch \
-Pincrement=patch \
--info

.PHONY: pre-release-major
_pre-release-major: ## (DEPRECATED) publishes next pre-release version with a major version bump
./gradlew clean test integrationTest \
tag \
pre-release-major: ## publishes next pre-release version with a major version bump
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PnewPreRelease -PbumpComponent=major \
tag \
-Prelease -PpreRelease -Pincrement=major \
--info

git push origin --tags

.PHONY: pre-release-minor
_pre-release-minor: ## (DEPRECATED) publishes next pre-release with a minor version bump
./gradlew clean test integrationTest \
tag \
pre-release-minor: ## publishes next pre-release with a minor version bump
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PnewPreRelease -PbumpComponent=minor \
tag \
-Prelease -PpreRelease -Pincrement=minor \
--info

git push origin --tags

.PHONY: pre-release-patch
_pre-release-patch: ## (DEPRECATED) publishes next pre-release with a patch version bump
./gradlew clean test integrationTest \
tag \
pre-release-patch: ## publishes next pre-release with a patch version bump
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PnewPreRelease -PbumpComponent=patch \
tag \
-Prelease -PpreRelease -Pincrement=patch \
--info

git push origin --tags

.PHONY: next-pre-release
_next-pre-release: ## (DEPRECATED) publishes next pre-release version
./gradlew clean test integrationTest \
tag \
next-pre-release: ## publishes next pre-release version
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PpreRelease \
tag \
-Prelease -Pincrement=pre_release \
--info

git push origin --tags

.PHONY: promote-to-release
_promote-to-release: ## (DEPRECATED) publishes next release from the current pre-release version
./gradlew clean test integrationTest \
tag \
promote-to-release: ## publishes next release from the current pre-release version
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PpromoteToRelease \
tag \
-Prelease -PpromoteRelease \
--info

git push origin --tags

.PHONY: release-major
_release-major: ## (DEPRECATED) publishes next major release version
./gradlew clean test integrationTest \
tag \
release-major: ## publishes next major release version
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PbumpComponent=major \
tag \
-Prelease -Pincrement=major \
--info

git push origin --tags

.PHONY: release-minor
_release-minor: ## (DEPRECATED) publishes next minor release version
./gradlew clean test integrationTest \
tag \
release-minor: ## publishes next minor release version
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PbumpComponent=minor \
tag \
-Prelease -Pincrement=minor \
--info

git push origin --tags

.PHONY: release-patch
_release-patch: ## (DEPRECATED) publishes next patch release version
./gradlew clean test integrationTest \
tag \
release-patch: ## publishes next patch release version
./gradlew test integrationTest \
nativeCompile \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PbumpComponent=patch \
tag \
-Prelease -Pincrement=patch \
--info

git push origin --tags
Expand All @@ -169,7 +169,7 @@ release: check_java ## publishes the next release with a specified VERSION
@:$(call check_defined, VERSION, semantic version string - 'X.Y.Z(-rc.\d+)?')

# run tests
./gradlew clean test integrationTest -Pversion=$(VERSION)
./gradlew test integrationTest -Pversion=$(VERSION)
# build and test native image
./gradlew nativeCompile -Pversion=$(VERSION) --info
./cli-bot/build/native/nativeCompile/faker-bot_$(VERSION) list --verbose >/dev/null || false
Expand Down
11 changes: 10 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.github.serpro69.semverkt.gradle.plugin.tasks.TagTask
import io.qameta.allure.gradle.task.AllureReport
import io.qameta.allure.gradle.task.AllureServe
import org.gradle.api.tasks.testing.TestResult.ResultType
Expand All @@ -14,6 +15,7 @@ plugins {
id("io.qameta.allure") version "2.8.1"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("com.github.johnrengelman.shadow") apply false
id("io.github.serpro69.semantic-versioning") apply false
}

repositories {
Expand All @@ -24,7 +26,6 @@ group = "io.github.serpro69"

subprojects {
group = rootProject.group.toString()
version = rootProject.version.toString()

val isTestHelper = this@subprojects.name == "test"

Expand Down Expand Up @@ -234,3 +235,11 @@ internal enum class Color(ansiCode: Int) {
return ansiString
}
}

// Run :tag only after we've published artifacts to sonatype
tasks.withType<TagTask>().configureEach {
// don't apply when "dryRun"
findProperty("dryRun") ?: run {
dependsOn("closeSonatypeStagingRepository")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import kotlin.system.exitProcess
"see https://github.com/serpro69/kotlin-faker/README.md for more installation and usage examples"
],
version = [
"faker: {FAKER_VER}", // {FAKER_VER} is a placeholder that will be temporarily replaced during compilation
"faker-bot: {FAKER_VER}",
"faker: 2.0.0-rc.2", // 2.0.0-rc.2 is a placeholder that will be temporarily replaced during compilation
"faker-bot: 2.0.0-rc.2",
"Built with picocli ${CommandLine.VERSION}",
"JVM: \${java.version} (\${java.vendor} \${java.vm.name} \${java.vm.version})",
"OS: \${os.name} \${os.version} \${os.arch}"
Expand Down
35 changes: 28 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
plugins {
id("com.gradle.enterprise") version "3.1"
}
import io.github.serpro69.semverkt.gradle.plugin.SemverPluginExtension
import io.github.serpro69.semverkt.release.configuration.TagPrefix

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("io.github.serpro69.semantic-versioning") version "0.10.0"
}

rootProject.name = "kotlin-faker"

include(
Expand Down Expand Up @@ -40,3 +43,21 @@ fakers.forEach { include("faker:$it") }

// helpers for integration tests
include("test")

settings.extensions.configure<SemverPluginExtension>("semantic-versioning") {
git {
message {
preRelease = "[rc]"
ignoreCase = true
}
}
monorepo {
fakers.forEach { f ->
module(":faker:$f") {
tag {
prefix = TagPrefix("faker-$f-v")
}
}
}
}
}

0 comments on commit 637498b

Please sign in to comment.