Skip to content

Commit 36d0481

Browse files
authored
Disable reckon plugin when used in Git worktree (#6331)
1 parent 70c0266 commit 36d0481

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

settings.gradle.kts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,33 @@ pluginManagement {
1818
}
1919
}
2020

21+
// Reckon plugin doesn't work in git worktrees (JGit doesn't handle worktree .git files).
22+
// Detect worktrees (.git is a file, not a directory) and skip reckon in that case.
23+
val isWorktree = settings.settingsDir.resolve(".git").isFile
24+
2125
plugins {
2226
// So we can't reach the libs.plugins.* aliases from here so we need to declare them the old way...
23-
id("org.ajoberstar.reckon.settings").version("1.0.1")
27+
id("org.ajoberstar.reckon.settings").version("1.0.1").apply(false)
2428
}
2529

26-
reckon {
27-
val isCiBuild = providers.environmentVariable("CI").isPresent
30+
if (!isWorktree) {
31+
apply(plugin = "org.ajoberstar.reckon.settings")
32+
33+
extensions.configure<org.ajoberstar.reckon.gradle.ReckonExtension>("reckon") {
34+
val isCiBuild = providers.environmentVariable("CI").isPresent
2835

29-
setDefaultInferredScope("patch")
30-
if (!isCiBuild) {
31-
// Use a snapshot version scheme with Reckon when not running in CI, which allows caching to
32-
// improve performance. Background: https://github.com/home-assistant/android/issues/5220.
33-
snapshots()
34-
} else {
35-
stages("beta", "final")
36+
setDefaultInferredScope("patch")
37+
if (!isCiBuild) {
38+
// Use a snapshot version scheme with Reckon when not running in CI, which allows caching to
39+
// improve performance. Background: https://github.com/home-assistant/android/issues/5220.
40+
snapshots()
41+
} else {
42+
stages("beta", "final")
43+
}
44+
setScopeCalc { java.util.Optional.of(org.ajoberstar.reckon.core.Scope.PATCH) }
45+
setStageCalc(calcStageFromProp())
46+
setTagWriter { it.toString() }
3647
}
37-
setScopeCalc { java.util.Optional.of(org.ajoberstar.reckon.core.Scope.PATCH) }
38-
setStageCalc(calcStageFromProp())
39-
setTagWriter { it.toString() }
4048
}
4149

4250
dependencyResolutionManagement {

0 commit comments

Comments
 (0)