Skip to content

Commit

Permalink
Update dependency com.javiersc.hubdle to v0.7.8
Browse files Browse the repository at this point in the history
| datasource | package                                               | from  | to    |
| ---------- | ----------------------------------------------------- | ----- | ----- |
| maven      | com.javiersc.hubdle:com.javiersc.hubdle.gradle.plugin | 0.7.7 | 0.7.8 |
  • Loading branch information
renovate[bot] committed Aug 29, 2024
1 parent 1346c15 commit f64596a
Show file tree
Hide file tree
Showing 24 changed files with 187 additions and 245 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Updated

- `com.javiersc.hubdle:com.javiersc.hubdle.gradle.plugin -> 0.7.7`
- `com.javiersc.hubdle:com.javiersc.hubdle.gradle.plugin -> 0.7.8`

## [0.7.0] - 2024-08-16

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import kotlin.contracts.contract
import kotlin.text.RegexOption.IGNORE_CASE

public class GradleVersion
private constructor(
private val value: String,
checkMode: CheckMode = Insignificant,
) : Comparable<GradleVersion> {
private constructor(private val value: String, checkMode: CheckMode = Insignificant) :
Comparable<GradleVersion> {

init {
if (checkMode == Significant) checkSignificantVersion(value)
Expand Down Expand Up @@ -91,7 +89,8 @@ private constructor(
stageNum = null,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number == null && stageName.isBlank() -> {
invoke(
Expand All @@ -102,7 +101,8 @@ private constructor(
stageNum = null,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number == null && stageName.isNotBlank() && stage?.name.isNullOrBlank() -> {
invoke(
Expand All @@ -113,7 +113,8 @@ private constructor(
stageNum = incNum,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number == null && stageName.isNotBlank() && stageName == stage?.name -> {
invoke(
Expand All @@ -124,7 +125,8 @@ private constructor(
stageNum = stage.num?.inc(),
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number == null && stageName.isNotBlank() && stageName != stage?.name -> {
invoke(
Expand All @@ -135,7 +137,8 @@ private constructor(
stageNum = incNum,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number is Increase.Major && stageName.isBlank() -> {
invoke(
Expand All @@ -146,7 +149,8 @@ private constructor(
stageNum = null,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number is Increase.Minor && stageName.isBlank() -> {
invoke(
Expand All @@ -157,7 +161,8 @@ private constructor(
stageNum = null,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number is Increase.Patch && stageName.isBlank() -> {
invoke(
Expand All @@ -168,7 +173,8 @@ private constructor(
stageNum = null,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number is Increase.Major && stageName.isNotBlank() -> {
invoke(
Expand All @@ -179,7 +185,8 @@ private constructor(
stageNum = incNum,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number is Increase.Minor && stageName.isNotBlank() -> {
invoke(
Expand All @@ -190,7 +197,8 @@ private constructor(
stageNum = incNum,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
number is Increase.Patch && stageName.isNotBlank() -> {
invoke(
Expand All @@ -201,14 +209,16 @@ private constructor(
stageNum = incNum,
commits = commits,
hash = hash,
metadata = metadata)
metadata = metadata,
)
}
else -> null
} ?: gradleVersionError("There were an error configuring the version")

if (nextVersion < this) {
gradleVersionError(
"Next version ($nextVersion) should be higher than the current one ($this)")
"Next version ($nextVersion) should be higher than the current one ($this)"
)
}
return nextVersion
}
Expand Down Expand Up @@ -366,7 +376,16 @@ private constructor(
checkMode: CheckMode = Insignificant,
): Result<GradleVersion> = runCatching {
GradleVersion(
major, minor, patch, stageName, stageNum, commits, hash, metadata, checkMode)
major,
minor,
patch,
stageName,
stageNum,
commits,
hash,
metadata,
checkMode,
)
}

public fun getOrNull(
Expand Down Expand Up @@ -459,10 +478,8 @@ private constructor(
}
}

internal class SpecialStage
private constructor(
private val stage: Stage,
) : Comparable<SpecialStage> {
internal class SpecialStage private constructor(private val stage: Stage) :
Comparable<SpecialStage> {

override fun compareTo(other: SpecialStage): Int {
val name = stage.name.lowercase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,11 @@ internal class GradleVersionTest {
Arb.constant("rc"),
Arb.constant("SNAPSHOT"),
Arb.constant("zasca"),
Arb.constant(null))
private val num =
Arb.choice(
Arb.positiveInt(11),
Arb.constant(null),
)
private val num = Arb.choice(Arb.positiveInt(11), Arb.constant(null))

private val commits =
Arb.choice(
Arb.positiveInt(11),
Arb.constant(null),
)
private val commits = Arb.choice(Arb.positiveInt(11), Arb.constant(null))

private val hash =
Arb.choice(
Expand All @@ -61,7 +54,8 @@ internal class GradleVersionTest {
Arb.constant("4Hash3h"),
Arb.constant("0h2az2U"),
Arb.constant("102aY20"),
Arb.constant(null))
Arb.constant(null),
)

private val metadata =
Arb.choice(
Expand All @@ -75,7 +69,8 @@ internal class GradleVersionTest {
Arb.constant("777777777"),
Arb.constant("AAAA"),
Arb.constant("BBBBBBBBB"),
Arb.constant(null))
Arb.constant(null),
)

private val versionArbitrary: Arb<Version> = arbitrary {
val major: Int = major.bind()
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
hubdle = "0.7.7"
hubdle = "0.7.8"

[plugins]
javiersc-hubdle = { id = "com.javiersc.hubdle", version.ref = "hubdle" }
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public data class Commit(
* @param name The name of the tag, example: `v1.0.0`
* @param refName The name of the ref, example: `refs/tags/v1.0.0`
*/
public data class Tag(
val name: String,
val refName: String,
) {
public data class Tag(val name: String, val refName: String) {
override fun toString(): String = name
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ import org.gradle.kotlin.dsl.property

public abstract class SemverExtension
@Inject
constructor(
objects: ObjectFactory,
providers: ProviderFactory,
) {
constructor(objects: ObjectFactory, providers: ProviderFactory) {

public val isEnabled: Property<Boolean> = objects.property<Boolean>().convention(true)

public abstract val gitDir: RegularFileProperty

public val commits: Provider<List<Commit>> =
providers.provider {
GitCache(
gitDir = gitDir.get().asFile,
maxCount = commitsMaxCount,
)
GitCache(gitDir = gitDir.get().asFile, maxCount = commitsMaxCount)
.commitsInTheCurrentBranchPublicApi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package com.javiersc.semver.project.gradle.plugin

import org.gradle.api.provider.Provider

public class VersionProperty(
private val version: Provider<String>,
) : Provider<String> by version {
public class VersionProperty(private val version: Provider<String>) : Provider<String> by version {

override fun toString(): String = "${version.orNull}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ internal enum class SemverProperty(val key: String) {

internal enum class Stage(private val value: String) {
Auto("auto"),
Final("final"),
;
Final("final");

operator fun invoke(): String = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ private val checkedNotNullCache: GitCache
private var gitCache: GitCache? = null

internal class GitCache
private constructor(
private val gitDir: File,
maxCount: Provider<Int>? = null,
) {
private constructor(private val gitDir: File, maxCount: Provider<Int>? = null) {

internal val git: Git by lazy {
Git(FileRepositoryBuilder().setGitDir(gitDir).readEnvironment().findGitDir().build()).also {
Expand All @@ -54,7 +51,7 @@ private constructor(
message = headRevCommit.shortMessage,
fullMessage = headRevCommit.fullMessage,
hash = headRevCommit.toObjectId().name,
),
)
)
}

Expand All @@ -73,12 +70,7 @@ private constructor(
val tags: List<Tag> =
tagsInCurrentBranchRef
.filter { ref -> commitHash(ref) == hash }
.map { ref ->
Tag(
name = ref.tagName,
refName = ref.name,
)
}
.map { ref -> Tag(name = ref.tagName, refName = ref.name) }
Commit(
message = revCommit.shortMessage,
fullMessage = revCommit.fullMessage,
Expand Down Expand Up @@ -131,7 +123,8 @@ private constructor(
message = commit.shortMessage,
fullMessage = commit.fullMessage,
hash = commit.toObjectId().name,
))
),
)
}

internal fun tagsInCurrentCommit(hash: String): List<GitRef.Tag> =
Expand Down Expand Up @@ -185,9 +178,9 @@ private constructor(
val higherVersion: GradleVersion? =
versionsInCurrentBranch(tagPrefix).firstOrNull()

if (lastVersion != null &&
higherVersion != null &&
higherVersion > lastVersion) {
if (
lastVersion != null && higherVersion != null && higherVersion > lastVersion
) {
isWarningLastVersionIsNotHigherVersion(true)
warningLastVersionIsNotHigherVersion(lastVersion, higherVersion)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ internal val Git.headCommit: GitRef.Head
message = headRevCommit.shortMessage,
fullMessage = headRevCommit.fullMessage,
hash = headRevCommit.toObjectId().name,
))
)
)

internal val Git.headRevCommit: RevCommit
get() = RevWalk(repository).parseCommit(repository.resolve(Constants.HEAD))
Expand Down Expand Up @@ -97,7 +98,8 @@ internal val Git.tagsInRepo: List<GitRef.Tag>
message = commit.shortMessage,
fullMessage = commit.fullMessage,
hash = commit.toObjectId().name,
))
),
)
}

internal val Git.tagsInRepoRef: List<Ref>
Expand Down
Loading

0 comments on commit f64596a

Please sign in to comment.