File tree Expand file tree Collapse file tree
open-java-format-eclipse-plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,13 @@ apply plugin: 'open-java-format.release-conventions'
3737
3838// GitHub Actions sets GITHUB_REF_TYPE=tag on a tag build; otherwise derive the
3939// version from git history (needs a full clone: actions/checkout fetch-depth: 0).
40- version System . env. GITHUB_REF_TYPE == ' tag' ? System . env. GITHUB_REF_NAME : gitVersion()
40+ //
41+ // Read through providers rather than System.env: the configuration cache tracks a provider as an input
42+ // and invalidates when it changes, while a plain System.env read is invisible to it — a cached
43+ // configuration then keeps handing out the version of whichever environment happened to fill it.
44+ def refType = providers. environmentVariable(' GITHUB_REF_TYPE' )
45+ def refName = providers. environmentVariable(' GITHUB_REF_NAME' )
46+ version refType. getOrElse(' ' ) == ' tag' ? refName. get() : gitVersion()
4147
4248// The GraalVM image is built by its own per-platform CI job, never as a side effect of
4349// `./gradlew build`: an aggregate build must not require a GraalVM toolchain on a machine that
Original file line number Diff line number Diff line change @@ -17,3 +17,11 @@ palantir.native.formatter=true
1717# unpacking a downloaded JDK does not preserve the symlink GraalVM ships at bin/native-image.
1818org.gradle.java.installations.auto-download =false
1919org.gradle.java.installations.fromEnv =JDK21_HOME,GRAALVM_HOME
20+
21+ # Configuration cache off for now: parts of this build are not cache-safe yet — the GraalVM plugin
22+ # cannot serialise its NativeConfigurations bean (see README, phase 1) — and chasing a stale entry
23+ # costs more than the cache saves. Turn it on for a single run with --configuration-cache.
24+ #
25+ # A gradle.properties in GRADLE_USER_HOME outranks this file, so anyone who turns the cache on
26+ # globally keeps it on here too.
27+ org.gradle.configuration-cache =false
Original file line number Diff line number Diff line change @@ -39,14 +39,21 @@ def embeddedLibs = configurations.runtimeClasspath.filter { file ->
3939
4040// Generated, not written in MANIFEST.MF, where it sat at 2.38.0 and never followed the build. OSGi
4141// takes three numbers and an optional [A-Za-z0-9_-] qualifier, so a `git describe` version such as
42- // 2.97.0-41-gf6667a2.dirty has to be reshaped into 2.97.0.41-gf6667a2-dirty.
42+ // 2.97.0-41-gf6667a2.dirty is reshaped into 2.97.0.41-gf6667a2-dirty.
43+ //
44+ // Every checkout has to yield something valid, never an exception: a branch build has no tag to
45+ // describe from — on CI's shallow clone the version is a bare commit hash — and throwing here failed
46+ // the evaluation of this project, taking every task in the build down with it. A version that does not
47+ // start with three numbers becomes the qualifier of 0.0.0 instead.
4348def osgiVersion = {
44- def matcher = (project. version. toString() =~ / ^(\d +)\. (\d +)\. (\d +)[.-]?(.*)$/ )
49+ def raw = project. version. toString()
50+ def sanitize = { String text -> text. replaceAll(/ [^A-Za-z0-9_-]/ , ' -' ) }
51+ def matcher = (raw =~ / ^(\d +)\. (\d +)\. (\d +)[.-]?(.*)$/ )
4552 if (! matcher. find()) {
46- throw new GradleException ( " Cannot derive an OSGi Bundle-Version from ' ${ project.version } ' " )
53+ return " 0.0.0. ${ sanitize(raw) } "
4754 }
4855 def release = " ${ matcher.group(1)} .${ matcher.group(2)} .${ matcher.group(3)} "
49- def qualifier = matcher. group(4 ). replaceAll( / [^A-Za-z0-9_-] / , ' - ' )
56+ def qualifier = sanitize( matcher. group(4 ))
5057 qualifier. isEmpty() ? release : " ${ release} .${ qualifier} "
5158}()
5259
You can’t perform that action at this time.
0 commit comments