Skip to content
Snippets Groups Projects
Commit badbb00b authored by JCount's avatar JCount Committed by GitHub
Browse files

Merge pull request #3352 from JCount/legacy-java-cask-requirement-support

java_requirement: support prompting users to install legacy Java casks
parents 40b21232 224864b1
No related branches found
No related tags found
No related merge requests found
class JavaRequirement < Requirement
cask "java"
env do
env_java_common
env_oracle_jdk || env_apple
end
# A strict Java 8 requirement (1.8) should prompt the user to install
# the legacy java8 cask because the current version, Java 9, is not
# completely backwards compatible, and contains breaking changes such as
# strong encapsulation of JDK-internal APIs and a modified version scheme
# (9.0 not 1.9).
def cask
if @version.nil? || @version.to_s.end_with?("+") ||
@version.to_f >= JAVA_CASK_MAP.keys.max.to_f
JAVA_CASK_MAP.fetch(JAVA_CASK_MAP.keys.max)
else
JAVA_CASK_MAP.fetch("1.8")
end
end
private
JAVA_CASK_MAP = {
"1.8" => "caskroom/versions/java8",
"9.0" => "java",
}.freeze
def possible_javas
javas = []
javas << Pathname.new(ENV["JAVA_HOME"])/"bin/java" if ENV["JAVA_HOME"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment