Skip to content

Commit

Permalink
Merge pull request #4815 from commitay/cargo-cache
Browse files Browse the repository at this point in the history
rust/cargo: enable caching
  • Loading branch information
commitay authored Sep 5, 2018
2 parents 67152b8 + 11a6413 commit 88bf60d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Library/Homebrew/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def incomplete?
end

def nested_cache?
directory? && %w[go_cache glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
directory? && %w[cargo_cache go_cache glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
end

def go_cache_directory?
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ def run_test
HOMEBREW_PATH: nil,
_JAVA_OPTIONS: "#{ENV["_JAVA_OPTIONS"]} -Duser.home=#{HOMEBREW_CACHE}/java_cache",
GOCACHE: "#{HOMEBREW_CACHE}/go_cache",
CARGO_HOME: "#{HOMEBREW_CACHE}/cargo_cache",
}

ENV.clear_sensitive_environment!
Expand Down Expand Up @@ -2034,6 +2035,7 @@ def stage
stage_env[:_JAVA_OPTIONS] =
"#{ENV["_JAVA_OPTIONS"]} -Duser.home=#{HOMEBREW_CACHE}/java_cache"
stage_env[:GOCACHE] = "#{HOMEBREW_CACHE}/go_cache"
stage_env[:CARGO_HOME] = "#{HOMEBREW_CACHE}/cargo_cache"
stage_env[:CURL_HOME] = ENV["CURL_HOME"] || ENV["HOME"]
end

Expand Down
9 changes: 9 additions & 0 deletions Library/Homebrew/test/cleanup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@
expect(incomplete).not_to exist
end

it "cleans up 'cargo_cache'" do
cargo_cache = (HOMEBREW_CACHE/"cargo_cache")
cargo_cache.mkpath

subject.cleanup_cache

expect(cargo_cache).not_to exist
end

it "cleans up 'go_cache'" do
go_cache = (HOMEBREW_CACHE/"go_cache")
go_cache.mkpath
Expand Down

0 comments on commit 88bf60d

Please sign in to comment.