summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-01-05 07:23:05 +0900
committerSutou Kouhei <kou@clear-code.com>2020-01-15 06:27:03 +0900
commit2a374012d4d977905b01fb0d789375e274d1be13 (patch)
treea24c3a923c3e3d6851ef2bfee4b105f72c67ac97
parent13f5a8a72090727e55ec789f44a1820ad61069d3 (diff)
downloadbundler-2a374012d4d977905b01fb0d789375e274d1be13.tar.gz
Don't set platforms to dependency registered by gemspec
Platform related dependencies are resolved in Resolver now. So we don't need to register all available platforms explicitly. This reverts commit 0a8ca4879e0b79aa4109a0dc424940b079ef38d0. See also: #4150 and #4102
-rw-r--r--lib/bundler/definition.rb3
-rw-r--r--lib/bundler/dependency.rb9
-rw-r--r--lib/bundler/dsl.rb3
-rw-r--r--spec/bundler/dsl_spec.rb35
4 files changed, 1 insertions, 49 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index d6fbb0b5b7..a5780d3b2a 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -706,9 +706,6 @@ module Bundler
elsif dep.source
dep.source = sources.get(dep.source)
end
- if dep.source.is_a?(Source::Gemspec)
- dep.platforms.concat(@platforms.map {|p| Dependency::REVERSE_PLATFORM_MAP[p] }.flatten(1)).uniq!
- end
end
changes = false
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 6c2642163e..26e5f3d1a5 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -74,15 +74,6 @@ module Bundler
:x64_mingw_26 => Gem::Platform::X64_MINGW,
}.freeze
- REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
- PLATFORM_MAP.each do |key, value|
- reverse_platform_map[value] ||= []
- reverse_platform_map[value] << key
- end
-
- reverse_platform_map.each {|_, platforms| platforms.freeze }
- end.freeze
-
def initialize(name, version, options = {}, &blk)
type = options["type"] || :runtime
super(name, version, type)
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 99a369281a..bb92a28381 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -75,8 +75,7 @@ module Bundler
@gemspecs << spec
- gem_platforms = Bundler::Dependency::REVERSE_PLATFORM_MAP[Bundler::GemHelpers.generic_local_platform]
- gem spec.name, :name => spec.name, :path => path, :glob => glob, :platforms => gem_platforms
+ gem spec.name, :name => spec.name, :path => path, :glob => glob
group(development_group) do
spec.development_dependencies.each do |dep|
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index 319472d4b0..9299c014af 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -174,41 +174,6 @@ RSpec.describe Bundler::Dsl do
end
end
- describe "#gemspec" do
- let(:spec) do
- Gem::Specification.new do |gem|
- gem.name = "example"
- gem.platform = platform
- end
- end
-
- before do
- allow(Dir).to receive(:[]).and_return(["spec_path"])
- allow(Bundler).to receive(:load_gemspec).with("spec_path").and_return(spec)
- allow(Bundler).to receive(:default_gemfile).and_return(Pathname.new("./Gemfile"))
- end
-
- context "with a ruby platform" do
- let(:platform) { "ruby" }
-
- it "keeps track of the ruby platforms in the dependency" do
- allow(Gem::Platform).to receive(:local).and_return(rb)
- subject.gemspec
- expect(subject.dependencies.last.platforms).to eq(Bundler::Dependency::REVERSE_PLATFORM_MAP[Gem::Platform::RUBY])
- end
- end
-
- context "with a jruby platform" do
- let(:platform) { "java" }
-
- it "keeps track of the jruby platforms in the dependency" do
- allow(Gem::Platform).to receive(:local).and_return(java)
- subject.gemspec
- expect(subject.dependencies.last.platforms).to eq(Bundler::Dependency::REVERSE_PLATFORM_MAP[Gem::Platform::JAVA])
- end
- end
- end
-
context "can bundle groups of gems with" do
# git "https://github.com/rails/rails.git" do
# gem "railties"