Skip to content

Commit b358854

Browse files
committed
fix: anchor build/ in .gitignore so buildSrc package is tracked
The unanchored `build/` pattern matched the `build/` directory inside `buildSrc/src/main/kotlin/io/flamingock/build/`, silently dropping VersionManager.kt and PrintVersionTask.kt from the previous commit and breaking the CI release build with "Unresolved reference" errors. Anchoring to `/build/` (matches root only) makes the package visible to git, and adds the two Kotlin sources that were missing.
1 parent 2a43e65 commit b358854

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gradle
22
.gradle/
3-
build/
3+
/build/
44
!gradle/wrapper/gradle-wrapper.jar
55

66
# IDE
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.flamingock.build
2+
3+
import org.gradle.api.DefaultTask
4+
import org.gradle.api.tasks.TaskAction
5+
6+
abstract class PrintVersionTask : DefaultTask() {
7+
8+
@TaskAction
9+
fun print() {
10+
println(project.version)
11+
}
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.flamingock.build
2+
3+
object VersionManager {
4+
5+
private const val SNAPSHOT_SUFFIX = "-SNAPSHOT"
6+
7+
fun resolveVersion(declaredVersion: String, isRelease: Boolean): String {
8+
if (!isRelease) return declaredVersion
9+
require(declaredVersion.endsWith(SNAPSHOT_SUFFIX)) {
10+
"Cannot release: version '$declaredVersion' does not end with $SNAPSHOT_SUFFIX. " +
11+
"This prevents accidental double-releases."
12+
}
13+
return declaredVersion.removeSuffix(SNAPSHOT_SUFFIX)
14+
}
15+
16+
fun isSnapshot(version: String): Boolean = version.endsWith(SNAPSHOT_SUFFIX)
17+
}

0 commit comments

Comments
 (0)