Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/dependencies-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nulls committed Mar 6, 2024
2 parents 70efcc6 + 1827a58 commit 94c06ec
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 66 deletions.
3 changes: 0 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.saveourtool.buildutils.*


plugins {
kotlin("multiplatform") apply false
id("com.saveourtool.buildutils.publishing-configuration")
Expand All @@ -9,8 +8,6 @@ plugins {

group = "com.saveourtool.okio-extras"

configureVersioning()

allprojects {
repositories {
mavenCentral()
Expand Down
2 changes: 0 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:4.3.0")
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.5")
implementation("org.ajoberstar.reckon:reckon-gradle:0.18.3")
implementation("org.ajoberstar.grgit:grgit-core:5.2.2")
}

This file was deleted.

48 changes: 48 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
import org.ajoberstar.reckon.core.Reckoner
import org.ajoberstar.reckon.core.ScopeCalculator
import org.ajoberstar.reckon.core.VersionTagParser
import org.ajoberstar.reckon.gradle.ReckonExtension

rootProject.name = "okio-extras"

plugins {
id("org.ajoberstar.reckon.settings") version "0.18.3"
}

includeBuild("gradle/plugins")
include("okio-extras")

extensions.configure<ReckonExtension> {
setDefaultInferredScope("patch")
// to activate release, provide `-Prelease` or `-Prelease=true`. To deactivate, either omit the property, or set `-Prelease=false`.
val isRelease = extra.has("release") && extra["release"] != "false"
if (isRelease) {
val scopeCalculator = ScopeCalculator { inventory ->
if (inventory.isClean) {
calcScopeFromProp().calculate(inventory)
} else {
throw GradleException(
"Release build will be performed with not clean git tree; aborting."
)
}
}
setScopeCalc(scopeCalculator)
} else {
setScopeCalc(calcScopeFromProp())
}
val isSnapshot = extra.has("reckon.stage") && extra["reckon.stage"] == "snapshot"
if (isSnapshot) {
// we should build snapshots only for snapshot publishing, so it requires explicit parameter
snapshots()
} else {
stages("beta", "rc", Reckoner.FINAL_STAGE)
}
setStageCalc(calcStageFromProp())

// A terrible hack to remove all pre-release tags. Because in semver `0.1.0-SNAPSHOT` < `0.1.0-alpha`, in snapshot mode
// we remove tags like `0.1.0-alpha`, and then reckoned version will still be `0.1.0-SNAPSHOT` and it will be compliant.
val tagParser = VersionTagParser { tag: String ->
if (tag.matches(Regex("""^v\d+\.\d+\.\d+$"""))) {
VersionTagParser.getDefault().parse(tag)
} else {
java.util.Optional.empty()
}
}
setTagParser(tagParser)
}

0 comments on commit 94c06ec

Please sign in to comment.