summaryrefslogtreecommitdiff
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-07-31 10:00:21 -0400
committerSamuel Giddins <segiddins@segiddins.me>2017-08-19 00:24:34 -0400
commitec4e3e74760ca14b4c50fc5b6e09820527015ba4 (patch)
tree7b1bdc9b0eff247cad521433ffbe3f6021bc5734 /lib/bundler/source
parent1d91876ec50215f30a1b48dec9e919f9a9bcebdd (diff)
downloadbundler-ec4e3e74760ca14b4c50fc5b6e09820527015ba4.tar.gz
Globally cache built extensions for RG & Git sources
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/git.rb5
-rw-r--r--lib/bundler/source/path.rb7
-rw-r--r--lib/bundler/source/path/installer.rb1
-rw-r--r--lib/bundler/source/rubygems.rb8
4 files changed, 19 insertions, 2 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index fd8f6debea..c21dc75e54 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -219,6 +219,11 @@ module Bundler
end
end
+ def extension_cache_path(spec)
+ return unless Bundler.feature_flag.global_gem_cache?
+ cache_path.join("extensions", Bundler.ruby_scope, spec.full_name)
+ end
+
def app_cache_dirname
"#{base_name}-#{shortref_for_path(cached_revision || revision)}"
end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 806ba81935..64d00e2ec6 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -227,7 +227,8 @@ module Bundler
spec,
:env_shebang => false,
:disable_extensions => options[:disable_extensions],
- :build_args => options[:build_args]
+ :build_args => options[:build_args],
+ :bundler_extension_cache_path => extension_cache_path(spec)
)
installer.post_install
rescue Gem::InvalidSpecificationException => e
@@ -243,6 +244,10 @@ module Bundler
Bundler.ui.warn "The validation message from RubyGems was:\n #{e.message}"
end
+
+ def extension_cache_path(spec)
+ nil
+ end
end
end
end
diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb
index 64e63766dd..a0357ffa39 100644
--- a/lib/bundler/source/path/installer.rb
+++ b/lib/bundler/source/path/installer.rb
@@ -7,6 +7,7 @@ module Bundler
attr_reader :spec
def initialize(spec, options = {})
+ @options = options
@spec = spec
@gem_dir = Bundler.rubygems.path(spec.full_gem_path)
@wrappers = true
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 70dc5ac038..7939e6db77 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -148,7 +148,8 @@ module Bundler
:wrappers => true,
:env_shebang => true,
:build_args => opts[:build_args],
- :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum
+ :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
+ :bundler_extension_cache_path => extension_cache_path(spec)
).install
end
spec.full_gem_path = installed_spec.full_gem_path
@@ -498,6 +499,11 @@ module Bundler
Bundler.user_cache.join("gems", cache_slug, spec.file_name)
end
+
+ def extension_cache_path(spec)
+ return unless download_path = download_cache_path(spec)
+ download_path.parent.join("extensions", Bundler.ruby_scope, spec.full_name)
+ end
end
end
end