Skip to content

Commit 637498b

Browse files
committed
Update gradle settings to use semver.kt plugin for versioning
Close #225
1 parent 5b07205 commit 637498b

File tree

4 files changed

+81
-51
lines changed

4 files changed

+81
-51
lines changed

Makefile

+41-41
Original file line numberDiff line numberDiff line change
@@ -35,131 +35,131 @@ deploy-docs: ## deploys documentation with orchid
3535

3636
.PHONY: snapshot-in-pre-release
3737
_snapshot-in-pre-release: ## (DEPRECATED) publishes next snapshot in current pre-release version
38-
./gradlew clean test integrationTest \
38+
./gradlew test integrationTest \
3939
printVersion \
4040
nativeCompile \
4141
publishToSonatype \
42-
-PpromoteToRelease \
42+
-PpromoteRelease \
4343
--info
4444

4545
.PHONY: snapshot-major
4646
_snapshot-major: ## (DEPRECATED) publishes next snapshot with a major version bump
47-
./gradlew clean test integrationTest \
47+
./gradlew test integrationTest \
4848
printVersion \
4949
nativeCompile \
5050
publishToSonatype \
51-
-PbumpComponent=major \
51+
-Pincrement=major \
5252
--info
5353

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

58-
./gradlew clean test integrationTest -Pversion='$(VERSION)-SNAPSHOT'
58+
./gradlew test integrationTest -Pversion='$(VERSION)-SNAPSHOT'
5959
./gradlew nativeCompile -Pversion='$(VERSION)-SNAPSHOT' --info
6060
./gradlew publishToSonatype -Pversion='$(VERSION)-SNAPSHOT' --info
6161

6262
.PHONY: snapshot-patch
6363
_snapshot-patch: ## (DEPRECATED) publishes next snapshot with a patch version bump
64-
./gradlew clean test integrationTest \
64+
./gradlew test integrationTest \
6565
printVersion \
6666
nativeCompile \
6767
publishToSonatype \
68-
-PbumpComponent=patch \
68+
-Pincrement=patch \
6969
--info
7070

7171
.PHONY: pre-release-major
72-
_pre-release-major: ## (DEPRECATED) publishes next pre-release version with a major version bump
73-
./gradlew clean test integrationTest \
74-
tag \
72+
pre-release-major: ## publishes next pre-release version with a major version bump
73+
./gradlew test integrationTest \
7574
nativeCompile \
7675
publishToSonatype \
7776
closeSonatypeStagingRepository \
78-
-Prelease -PnewPreRelease -PbumpComponent=major \
77+
tag \
78+
-Prelease -PpreRelease -Pincrement=major \
7979
--info
8080

8181
git push origin --tags
8282

8383
.PHONY: pre-release-minor
84-
_pre-release-minor: ## (DEPRECATED) publishes next pre-release with a minor version bump
85-
./gradlew clean test integrationTest \
86-
tag \
84+
pre-release-minor: ## publishes next pre-release with a minor version bump
85+
./gradlew test integrationTest \
8786
nativeCompile \
8887
publishToSonatype \
8988
closeSonatypeStagingRepository \
90-
-Prelease -PnewPreRelease -PbumpComponent=minor \
89+
tag \
90+
-Prelease -PpreRelease -Pincrement=minor \
9191
--info
9292

9393
git push origin --tags
9494

9595
.PHONY: pre-release-patch
96-
_pre-release-patch: ## (DEPRECATED) publishes next pre-release with a patch version bump
97-
./gradlew clean test integrationTest \
98-
tag \
96+
pre-release-patch: ## publishes next pre-release with a patch version bump
97+
./gradlew test integrationTest \
9998
nativeCompile \
10099
publishToSonatype \
101100
closeSonatypeStagingRepository \
102-
-Prelease -PnewPreRelease -PbumpComponent=patch \
101+
tag \
102+
-Prelease -PpreRelease -Pincrement=patch \
103103
--info
104104

105105
git push origin --tags
106106

107107
.PHONY: next-pre-release
108-
_next-pre-release: ## (DEPRECATED) publishes next pre-release version
109-
./gradlew clean test integrationTest \
110-
tag \
108+
next-pre-release: ## publishes next pre-release version
109+
./gradlew test integrationTest \
111110
nativeCompile \
112111
publishToSonatype \
113112
closeSonatypeStagingRepository \
114-
-Prelease -PpreRelease \
113+
tag \
114+
-Prelease -Pincrement=pre_release \
115115
--info
116116

117117
git push origin --tags
118118

119119
.PHONY: promote-to-release
120-
_promote-to-release: ## (DEPRECATED) publishes next release from the current pre-release version
121-
./gradlew clean test integrationTest \
122-
tag \
120+
promote-to-release: ## publishes next release from the current pre-release version
121+
./gradlew test integrationTest \
123122
nativeCompile \
124123
publishToSonatype \
125124
closeSonatypeStagingRepository \
126-
-Prelease -PpromoteToRelease \
125+
tag \
126+
-Prelease -PpromoteRelease \
127127
--info
128128

129129
git push origin --tags
130130

131131
.PHONY: release-major
132-
_release-major: ## (DEPRECATED) publishes next major release version
133-
./gradlew clean test integrationTest \
134-
tag \
132+
release-major: ## publishes next major release version
133+
./gradlew test integrationTest \
135134
nativeCompile \
136135
publishToSonatype \
137136
closeSonatypeStagingRepository \
138-
-Prelease -PbumpComponent=major \
137+
tag \
138+
-Prelease -Pincrement=major \
139139
--info
140140

141141
git push origin --tags
142142

143143
.PHONY: release-minor
144-
_release-minor: ## (DEPRECATED) publishes next minor release version
145-
./gradlew clean test integrationTest \
146-
tag \
144+
release-minor: ## publishes next minor release version
145+
./gradlew test integrationTest \
147146
nativeCompile \
148147
publishToSonatype \
149148
closeSonatypeStagingRepository \
150-
-Prelease -PbumpComponent=minor \
149+
tag \
150+
-Prelease -Pincrement=minor \
151151
--info
152152

153153
git push origin --tags
154154

155155
.PHONY: release-patch
156-
_release-patch: ## (DEPRECATED) publishes next patch release version
157-
./gradlew clean test integrationTest \
158-
tag \
156+
release-patch: ## publishes next patch release version
157+
./gradlew test integrationTest \
159158
nativeCompile \
160159
publishToSonatype \
161160
closeSonatypeStagingRepository \
162-
-Prelease -PbumpComponent=patch \
161+
tag \
162+
-Prelease -Pincrement=patch \
163163
--info
164164

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

171171
# run tests
172-
./gradlew clean test integrationTest -Pversion=$(VERSION)
172+
./gradlew test integrationTest -Pversion=$(VERSION)
173173
# build and test native image
174174
./gradlew nativeCompile -Pversion=$(VERSION) --info
175175
./cli-bot/build/native/nativeCompile/faker-bot_$(VERSION) list --verbose >/dev/null || false

build.gradle.kts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
2+
import io.github.serpro69.semverkt.gradle.plugin.tasks.TagTask
23
import io.qameta.allure.gradle.task.AllureReport
34
import io.qameta.allure.gradle.task.AllureServe
45
import org.gradle.api.tasks.testing.TestResult.ResultType
@@ -14,6 +15,7 @@ plugins {
1415
id("io.qameta.allure") version "2.8.1"
1516
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
1617
id("com.github.johnrengelman.shadow") apply false
18+
id("io.github.serpro69.semantic-versioning") apply false
1719
}
1820

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

2527
subprojects {
2628
group = rootProject.group.toString()
27-
version = rootProject.version.toString()
2829

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

@@ -234,3 +235,11 @@ internal enum class Color(ansiCode: Int) {
234235
return ansiString
235236
}
236237
}
238+
239+
// Run :tag only after we've published artifacts to sonatype
240+
tasks.withType<TagTask>().configureEach {
241+
// don't apply when "dryRun"
242+
findProperty("dryRun") ?: run {
243+
dependsOn("closeSonatypeStagingRepository")
244+
}
245+
}

cli-bot/src/main/kotlin/io/github/serpro69/kfaker/app/KFaker.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import kotlin.system.exitProcess
1212
"see https://github.com/serpro69/kotlin-faker/README.md for more installation and usage examples"
1313
],
1414
version = [
15-
"faker: {FAKER_VER}", // {FAKER_VER} is a placeholder that will be temporarily replaced during compilation
16-
"faker-bot: {FAKER_VER}",
15+
"faker: 2.0.0-rc.2", // 2.0.0-rc.2 is a placeholder that will be temporarily replaced during compilation
16+
"faker-bot: 2.0.0-rc.2",
1717
"Built with picocli ${CommandLine.VERSION}",
1818
"JVM: \${java.version} (\${java.vendor} \${java.vm.name} \${java.vm.version})",
1919
"OS: \${os.name} \${os.version} \${os.arch}"

settings.gradle.kts

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
plugins {
2-
id("com.gradle.enterprise") version "3.1"
3-
}
1+
import io.github.serpro69.semverkt.gradle.plugin.SemverPluginExtension
2+
import io.github.serpro69.semverkt.release.configuration.TagPrefix
43

5-
gradleEnterprise {
6-
buildScan {
7-
termsOfServiceUrl = "https://gradle.com/terms-of-service"
8-
termsOfServiceAgree = "yes"
4+
pluginManagement {
5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
98
}
109
}
1110

11+
plugins {
12+
id("io.github.serpro69.semantic-versioning") version "0.10.0"
13+
}
14+
1215
rootProject.name = "kotlin-faker"
1316

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

4144
// helpers for integration tests
4245
include("test")
46+
47+
settings.extensions.configure<SemverPluginExtension>("semantic-versioning") {
48+
git {
49+
message {
50+
preRelease = "[rc]"
51+
ignoreCase = true
52+
}
53+
}
54+
monorepo {
55+
fakers.forEach { f ->
56+
module(":faker:$f") {
57+
tag {
58+
prefix = TagPrefix("faker-$f-v")
59+
}
60+
}
61+
}
62+
}
63+
}

0 commit comments

Comments
 (0)