-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve suggestions for depends_on_java #11290
Improve suggestions for depends_on_java #11290
Conversation
Java 11 is no longer the current stable build, so a dependency on “11” should not be treated as a dependency on the latest Java.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @joewiz ❤️ ! I agree this behaviour could be improved but just to warn you there's likely to be a bit of back-and-forth to get there.
@@ -114,15 +114,16 @@ def eval_caveats(&block) | |||
#{@cask} requires Java. You can install the latest version with: | |||
brew install --cask adoptopenjdk | |||
EOS | |||
elsif java_version.include?("11") || java_version.include?("+") | |||
elsif java_version.include?("+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why 11
was specified here already and if there's another value/values that should be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the inception of the file, this value always tracked the current stable release of Java - advancing to 9, 10, and finally 11. While Java continued to release major versions since then, Homebrew didn't track these changes. One option would be to resume tracking it - but in my opinion, any value with a +
quantifier implies "current stable release", so there's really no benefit to tracking the current version. The real purpose of +
is to establish a minimum compatible version and to encourage users to install the current version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth parsing this from the Java cask if it's available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that would be a nice approach (although implementing such parsing of the Java cask is beyond my abilities, I'm afraid).
Library/Homebrew/cask/dsl/caveats.rb
Outdated
<<~EOS | ||
#{@cask} requires Java #{java_version}. You can install the latest version with: | ||
brew install --cask adoptopenjdk | ||
EOS | ||
else | ||
<<~EOS | ||
#{@cask} requires Java #{java_version}. You can install it with: | ||
brew install --cask homebrew/cask-versions/adoptopenjdk#{java_version} | ||
brew tap adoptopenjdk/openjdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to recommend third-party taps not part of the Homebrew organisation for security reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Homebrew/homebrew-cask#54074, @claui, @vitorgalvao, and @commitay discussed this in some detail and approved this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Homebrew/homebrew-cask#54074, @claui, @vitorgalvao, and @commitay discussed this in some detail and approved this approach.
There is a huge difference between saying “we don’t support other versions of this software; if you want them you can get check this external tap” (what Homebrew/homebrew-cask#54074 does) and “to install this piece of software you have to install software from a third-party tap” (what this does).
The former gives you a choice on the tool itself—you have to understand what it is. The latter is a requirement of a dependency—you may not understand the implication, only that it’s stopping you from getting something else.
I agree with @MikeMcQuaid, with one clarification:
We don't want to
recommendrequire third-party taps not part of the Homebrew organisation for security reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. That said: I don't think we should recommend or require them (outside of https://docs.brew.sh/Interesting-Taps-and-Forks) because your typical user will just do what the instructions say to fix their problem which puts an onus on us to ensure that their security meets our standards (which we cannot do).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m fine with removing the recommendation from the other cask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vitorgalvao I understand the concern. From the perspective of a maintainer of a cask that currently is not yet confirmed to work with the version of Java that the Homebrew organization offers, I would be in favor of a solution that allows cask maintainers to advise users how to safely use the cask. We are actively working on ensuring compatibility with the current version of Java (16), but in the meantime, a "caveat" seems like the right medicine (and certainly better than nothing). Perhaps rather than endorsing a third-party tap, this language could be used:
We don't support other versions of this dependency. Consult the project's documentation to locate a third-party tap or source for the dependency.
Would that satisfy the concern about not endorsing third-party taps for security reasons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the perspective of a maintainer of a cask that currently is not yet confirmed to work with the version of Java that the Homebrew organization offers
Is it known to be broken or just not confirmed to work?
We don't support other versions of this dependency.
So: we don't support any of the "official" Homebrew tap versions at all? In that case I'd say this cask should probably be removed from homebrew-cask entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see the official homebrew/cask-versions
contains adoptopenjdk8
, which the exist-db
cask is certainly compatible with.
Given the direction that this discussion has taken—i.e. toward removing mentions of third party casks—I will submit a PR updating the exist-db
cask's caveat to remove mention of "11"
, to read: depends_on_java: "8"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paging @Homebrew/cask to discuss recommendation of other taps.
05fe138
to
658352a
Compare
@MikeMcQuaid @vitorgalvao I've now updated the PR to remove the commit that introduced the mention of the 3rd party tap. All that remains is the commit removing the hardcoded reference to java But it falls short of @MikeMcQuaid's good suggestion:
In light of this, I'd understand if you decide to close this PR in favor of a more complete solution. Whatever you all think is the best route is fine with me. Thank you! |
Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @joewiz! |
@MikeMcQuaid Thank you for reviewing and merging it—and thanks to you, @vitorgalvao, and all of the Homebrew maintainers for all of your work building this amazing tool and community! |
The current behavior of the
depends_on_java
stanza has 3 shortcomings:11
as a dependency on the latest Java. That is no longer a correct assumption, as Java 16 is the latest version.+
quantifier), Homebrew advises users to install that version ofadoptopenjdk
fromcask-versions
. However,cask-versions
only hasadoptopenjdk8
, not the full array of versions (8-16, etc.). Only theadoptopenjdk/openjdk
tap has the full array.depends_on_java ["8", "11"]
) particularly gracefully. The URL it constructs outputs the array instead of per-version URLs (i.e.,adoptopenjdk["8", "11"]
instead ofadoptopenjdk8
andadoptopenjdk11
).This PR fixes issues the first two issues above:
Rather than having to track Java stable releases, this PR removes the hardcoded reference to Java 11. Any cask with the stanza using
11+
(or12+
, for example), will be told how to install the latest version:However, a stanza without the
+
will be told to install a specific version - which now conforms to https://github.com/Homebrew/homebrew-cask/pull/54074/files:Unfortunately, my Ruby skills are too limited to fix the 3rd issue above - the presentation of arrays. Ideally, we could take the array described by @vitorgalvao in
depends_on :java
homebrew-cask#16383 and output sample installation commands for each version, instead of what would appear for the exist-db cask:A better output would be:
I would welcome anyone with Ruby skills to contribute a fix to this issue, either in this PR or in a follow-on PR.
Note: My apologies. I lack the Ruby skills to write tests for this PR.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Note: regarding
brew tests
, running it on my branch failed (seebrew config
output below), but the log does not appear to fail due to anything changed in my PR. See the console log: brew-tests-log.txt.zipMy
brew config
: