Repository navigation
Ask Gradle for VERSION_NAME in CI, and take the newest released Xcode - #391
Open
smelfungus wants to merge 2 commits into
Open
smelfungus wants to merge 2 commits into
smelfungus wants to merge 2 commits into
Conversation
CI read VERSION_NAME from gradle.properties with sed, which matches only VERSION_NAME= at the start of a line. VERSION_NAME = 2.0.1 and VERSION_NAME: 2.0.1 are the same property to Gradle, but sed reads nothing from them: the tag check would fail with an empty version, a hand-run snapshot would publish -SNAPSHOT, and the API removal check would lose the major-bump exemption. A -PVERSION_NAME override was invisible to it too. A root printVersionName task prints the property as Gradle resolves it, which is what every library module publishes, and the workflows and scripts/check-api-removals.sh read it from there. The macOS job runs the removal check after Java and Gradle are set up, since the check now runs Gradle. Both macOS jobs took the last Xcode_*.app by name. The runner images give a beta or a release candidate release-looking symlinks (Xcode_26.1.app pointing at Xcode_26.1_beta_3.app), so while one is installed CI builds and publishes with it. scripts/newest-xcode.sh skips symlinks, betas and release candidates, and compares the CFBundleShortVersionString in each app's Info.plist.
macOS runs it with bash 3.2, which misparses a case pattern's closing parenthesis inside $(...) and stopped the build-ios job with a syntax error. The loop is a function now, and the substitution only calls it.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI read
VERSION_NAMEwithsed -n 's/^VERSION_NAME=//p' gradle.propertiesin five places, and the two macOS jobs picked Xcode withls -d /Applications/Xcode_*.app | sort -V | tail -1. This PR reads both through the tool that owns the value.VERSION_NAME from Gradle
VERSION_NAME = 2.0.1andVERSION_NAME: 2.0.1are the same property to Gradle (Java properties allow spaces and:), but the sed reads nothing from them. With either spelling the tag check would fail with an empty version, a hand-run snapshot would publish-SNAPSHOT, andcheck-api-removals.shwould lose the major-bump exemption. A-PVERSION_NAMEoverride was invisible to sed too.printVersionNametask printsproviders.gradleProperty("VERSION_NAME"), the providerLibraryConventionPluginsets every module's version from. It keeps no state, so it works with the configuration cache.build.yml(the POM check and the consumer link),publish.yml(the tag check and the publish step) andscripts/check-api-removals.shread./gradlew -q printVersionName. A Gradle failure now stops the step, where an empty sed result went on. The publish step's call passes--no-configuration-cachelike the step's other Gradle calls.-qcomes first in each call: the wrapper only sees-qbefore the first word that isn't an option, and without it the wrapper writes its download progress to stdout (seen on the box, below). The build file's comment says so.build-ios, the removal check moves aftersetup-javaandsetup-gradle, since it now runs Gradle. It still runs on macOS before anything is built.check-api-removals.shtakes the major as the digits the version starts with, as its sed did, and exits 2 with an::error::when Gradle can't print the version, like its other can't-compare failures.The newest released Xcode
The runner images give a beta or a release candidate release-looking symlinks: while 26.1 beta 3 was installed,
/Applications/Xcode_26.1.appandXcode_26.1.0.apppointed atXcode_26.1_beta_3.app(actions/runner-images history ofmacos-15-arm64-Readme.md). Sorting the names takes the beta, orXcode_26.3_Release_Candidate_2.appwhile that was installed (replayed below).scripts/newest-xcode.shdoes whatmaxim-lobanov/setup-xcode'slatest-stabledoes, in a script so the publish job gains no third-party action: it lists/Applications/Xcode*.app, skips symlinks, skips an app whose name says beta or Release_Candidate or whoseContents/Resources/LicenseInfo.plistlicenseType says Beta, readsCFBundleShortVersionStringfrom eachContents/Info.plistwith PlistBuddy, and prints the highest, compared number by number with POSIXsort -nkeys. With none it exits 1 with an::error::, where the old line went on toxcode-select -s /Contents/Developer. Both workflows call it; the step'secho "Using $XCODE",xcode-selectandxcodebuild -versionare unchanged.Rollout
CI only; nothing published changes. No file format changes:
gradle.propertiesstays as it is.Tested
Run on the agent box (Linux); the macOS steps run on this PR's own CI.
Xcode picker, old line vs new script, on fake
/Applicationsfolders built from the runner images' listings (real directories with XMLInfo.plistandLicenseInfo.plist, the images' symlinks; PlistBuddy stood in for by a plistlib script answering-c 'Print :Key'):::error::No released Xcode ...Every difference is a beta or release candidate left out; with none installed (1, 4) the same Xcode is picked.
Workflows: actionlint 1.7.12 with shellcheck 0.9.0 on both files: clean (master: two SC2012 infos, on the
lslines this removes). Everyrun:block extracted with yq passesbash -n(14 in build.yml, 8 in publish.yml). shellcheck onnewest-xcode.sh: clean; oncheck-api-removals.sh: the same two SC2317 infos as on master.The wrapper and -q: with a fresh Gradle home,
./gradlew --no-daemon -I <init script> -q printVersionNamewrote the wrapper's 274-byteDownloading https://services.gradle.org/...progress to stdout;./gradlew -q --no-daemon -I <init script> printVersionNamedownloaded and unpacked the same distribution and wrote nothing.This PR's CI (run 44865691490, image macos-15-arm64 20261118.0550): build-android and build-ios pass. build-ios picked
/Applications/Xcode_26.3.app(Xcode 26.3, 17C529); master's last run took/Applications/Xcode_26.3.0.app, the symlink to the same Xcode 26.3 17C529.check-api-removals.shread the version through Gradle on both runners and compared against v2.0.0 as before ("No declaration published in v2.0.0 is missing."). The POM check found all 24 POMs at the versionprintVersionNameprinted, and the consumer linked against it, so its stdout was exactly the version on macOS. The first push failed build-ios: macOS's bash 3.2 misparsed the script's case patterns inside$(...); the second commit moves the loop into a function.How the property is read: Gradle loads gradle.properties with
java.util.Properties. On copies of the real file,java.util.Propertiesand the old sed read:VERSION_NAME=2.0.0(as committed)VERSION_NAME = 2.0.1VERSION_NAME: 2.0.2VERSION_NAME=2.0.3printVersionName on the box for those spellings, a
-PVERSION_NAME=9.9.9override, a missing VERSION_NAME, and the configuration cache stored and reused: not run. The job waited hours for the box's one build slot and was stopped. On this PR's CI,printVersionNameread the real file on both runners (removal check, POM check, consumer link).Not run: the publish workflow (it uploads to Maven Central); anything on macOS by hand. Gradle's daemon-JVM provisioning on a runner (JetBrains 21 from foojay) can't happen on the box, which has the JDK and no downloads; this PR's macOS job is the first run of
printVersionNamein that state.