nimbus-gradle-plugin: Support absolute and relative paths. #6224
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.
Hi @jeddai! 👋🏼
When I was fixing the Fenix auto-publishing workflow last week, I noticed that it didn't like absolute paths to the Application Services repo. I added a low-effort check that threw an exception for (Unix-style) absolute paths, but wanted to fix the issue for real.
I tracked down the bellyaching to how the Nimbus Gradle Plugin was resolving paths—and fixed it up in this PR so that it can handle both kinds of paths☺️ I've tested this logic locally, and it works with both absolute and relative paths in
autoPublish.application-services.dir
now!I think this is an O(n) change.
Here's an explanation of what I did, copied from the commit message:
project.file(...)
to resolve paths relative to theproject directory, instead of the
File
constructor. The.file()
method understands absolute paths.project.layout.buildDirectory.dir(...)
to resolvepaths relative to the build directory, instead of manually
building the path from the deprecated
project.buildDir
property.
/
instead ofFile.separator
for paths. This is the stylethat Gradle recommends, and it simplifies how we build path strings.
The Java File APIs canonicalize
/
to\
on Windows, so it'snot necessary to use
File.separator
explicitly.And, in a follow-up commit, I noticed a couple of places where we could use the Groovy
withReader
method.Pull Request checklist
[ci full]
to the PR title.Branch builds: add
[firefox-android: branch-name]
to the PR title.