Skip to content
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

Java: deprecate ENV.java_cache in favour of setting it by default. #3109

Merged
merged 3 commits into from
Sep 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Library/Homebrew/compat/ENV/shared.rb
Expand Up @@ -3,4 +3,8 @@ def j1
odeprecated "ENV.j1", "ENV.deparallelize"
deparallelize
end

def java_cache
# odeprecated "ENV.java_cache"
end
end
4 changes: 4 additions & 0 deletions Library/Homebrew/dev-cmd/audit.rb
Expand Up @@ -869,6 +869,10 @@ def line_problems(line, _lineno)
problem "Use \"depends_on :x11\" instead of \"ENV.x11\""
end

if line.include?("ENV.java_cache")
problem "In-formula ENV.java_cache usage has been deprecated & should be removed."
end

# Avoid hard-coding compilers
if line =~ %r{(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]}
problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{Regexp.last_match(3)}\""
Expand Down
4 changes: 0 additions & 4 deletions Library/Homebrew/extend/ENV/shared.rb
Expand Up @@ -260,10 +260,6 @@ def fortran
set_cpu_flags(flags)
end

def java_cache
append "_JAVA_OPTIONS", "-Duser.home=#{HOMEBREW_CACHE}/java_cache"
end

# ld64 is a newer linker provided for Xcode 2.5
# @private
def ld64
Expand Down
6 changes: 6 additions & 0 deletions Library/Homebrew/formula.rb
Expand Up @@ -1613,6 +1613,7 @@ def verify_download_integrity(fn)
def run_test
@prefix_returns_versioned_prefix = true
old_home = ENV["HOME"]
old_java_opts = ENV["_JAVA_OPTIONS"]
old_curl_home = ENV["CURL_HOME"]
old_tmpdir = ENV["TMPDIR"]
old_temp = ENV["TEMP"]
Expand All @@ -1626,6 +1627,7 @@ def run_test
ENV["TERM"] = "dumb"
ENV["PATH"] = PATH.new(old_path).append(HOMEBREW_PREFIX/"bin")
ENV["HOMEBREW_PATH"] = nil
ENV["_JAVA_OPTIONS"] = "#{old_java_opts} -Duser.home=#{HOMEBREW_CACHE}/java_cache"

ENV.clear_sensitive_environment!

Expand All @@ -1646,6 +1648,7 @@ def run_test
ensure
@testpath = nil
ENV["HOME"] = old_home
ENV["_JAVA_OPTIONS"] = old_java_opts
ENV["CURL_HOME"] = old_curl_home
ENV["TMPDIR"] = old_tmpdir
ENV["TEMP"] = old_temp
Expand Down Expand Up @@ -1888,11 +1891,13 @@ def stage
mkdir_p env_home

old_home = ENV["HOME"]
old_java_opts = ENV["_JAVA_OPTIONS"]
old_curl_home = ENV["CURL_HOME"]
old_path = ENV["HOMEBREW_PATH"]

unless ARGV.interactive?
ENV["HOME"] = env_home
ENV["_JAVA_OPTIONS"] = "#{old_java_opts} -Duser.home=#{HOMEBREW_CACHE}/java_cache"
ENV["CURL_HOME"] = old_curl_home || old_home
end
ENV["HOMEBREW_PATH"] = nil
Expand All @@ -1907,6 +1912,7 @@ def stage
@buildpath = nil
unless ARGV.interactive?
ENV["HOME"] = old_home
ENV["_JAVA_OPTIONS"] = old_java_opts
ENV["CURL_HOME"] = old_curl_home
end
ENV["HOMEBREW_PATH"] = old_path
Expand Down