Skip to content
Snippets Groups Projects
Commit a4bada57 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

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.
parent 55486383
No related branches found
No related tags found
No related merge requests found
......@@ -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"]
......
require "requirement"
class OsxfuseRequirement < Requirement
cask "osxfuse"
download "https://osxfuse.github.io/"
satisfy(build_env: false) { self.class.binary_osxfuse_installed? }
......
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
......
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 = [])
......
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