requirements: define cask on base class.
The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
This commit is contained in:
parent
55486383a9
commit
a4bada575a
@ -4,29 +4,10 @@ class JavaRequirement < Requirement
|
||||
env_oracle_jdk || env_apple
|
||||
end
|
||||
|
||||
# A strict Java 8 requirement (1.8) should prompt the user to install
|
||||
# the legacy java8 cask because versions newer than Java 8 are not
|
||||
# completely backwards compatible, and contain breaking changes such as
|
||||
# strong encapsulation of JDK-internal APIs and a modified version scheme
|
||||
# (*.0 not 1.*).
|
||||
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
|
||||
|
||||
undef possible_javas, oracle_java_os
|
||||
|
||||
JAVA_CASK_MAP = {
|
||||
"1.8" => "caskroom/versions/java8",
|
||||
"10.0" => "java",
|
||||
}.freeze
|
||||
|
||||
def possible_javas
|
||||
javas = []
|
||||
javas << Pathname.new(ENV["JAVA_HOME"])/"bin/java" if ENV["JAVA_HOME"]
|
||||
|
@ -1,7 +1,6 @@
|
||||
require "requirement"
|
||||
|
||||
class OsxfuseRequirement < Requirement
|
||||
cask "osxfuse"
|
||||
download "https://osxfuse.github.io/"
|
||||
|
||||
satisfy(build_env: false) { self.class.binary_osxfuse_installed? }
|
||||
|
@ -1,7 +1,6 @@
|
||||
require "requirement"
|
||||
|
||||
class X11Requirement < Requirement
|
||||
cask "xquartz"
|
||||
download "https://xquartz.macosforge.org"
|
||||
|
||||
satisfy build_env: false do
|
||||
|
@ -4,6 +4,20 @@ class JavaRequirement < Requirement
|
||||
fatal true
|
||||
download "https://www.oracle.com/technetwork/java/javase/downloads/index.html"
|
||||
|
||||
# A strict Java 8 requirement (1.8) should prompt the user to install
|
||||
# the legacy java8 cask because versions newer than Java 8 are not
|
||||
# completely backwards compatible, and contain breaking changes such as
|
||||
# strong encapsulation of JDK-internal APIs and a modified version scheme
|
||||
# (*.0 not 1.*).
|
||||
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
|
||||
|
||||
satisfy build_env: false do
|
||||
setup_java
|
||||
next false unless @java
|
||||
@ -42,6 +56,11 @@ class JavaRequirement < Requirement
|
||||
|
||||
private
|
||||
|
||||
JAVA_CASK_MAP = {
|
||||
"1.8" => "caskroom/versions/java8",
|
||||
"10.0" => "java",
|
||||
}.freeze
|
||||
|
||||
def version_without_plus
|
||||
if exact_version?
|
||||
@version
|
||||
|
@ -1,6 +1,7 @@
|
||||
require "requirement"
|
||||
|
||||
class OsxfuseRequirement < Requirement
|
||||
cask "osxfuse"
|
||||
fatal true
|
||||
end
|
||||
|
||||
|
@ -5,6 +5,7 @@ class X11Requirement < Requirement
|
||||
|
||||
fatal true
|
||||
|
||||
cask "xquartz"
|
||||
env { ENV.x11 }
|
||||
|
||||
def initialize(name = "x11", tags = [])
|
||||
|
Loading…
x
Reference in New Issue
Block a user