You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bundler/lib/bundler/dsl.rb
+31-15Lines changed: 31 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -110,9 +110,23 @@ def gem(name, *args)
110
110
ifgemspec_dep
111
111
gemfile_dep=[dep,current].find(&:runtime?)
112
112
113
-
unlesscurrent_requirement_open
113
+
ifgemfile_dep && !current_requirement_open
114
114
Bundler.ui.warn"A gemspec development dependency (#{gemspec_dep.name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{gemfile_dep.name}, #{gemfile_dep.requirement}).\n" \
115
115
"This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n"
it"errors out if two gemspecs add it with incompatible requirements"do
518
+
gem1=tmp("my-gem-1")
519
+
gem2=tmp("my-gem-2")
520
+
521
+
build_lib"my-gem",path: gem1do |s|
522
+
s.add_development_dependency"rubocop","~> 2.0"
523
+
end
524
+
525
+
build_lib"my-gem-2",path: gem2do |s|
526
+
s.add_development_dependency"rubocop","~> 1.36.0"
527
+
end
528
+
529
+
build_repo4do
530
+
build_gem"rubocop","1.36.0"
531
+
end
532
+
533
+
gemfile<<~G
534
+
source "https://gem.repo4"
535
+
536
+
gemspec path: "#{gem1}"
537
+
gemspec path: "#{gem2}"
538
+
G
539
+
540
+
bundle:install,raise_on_error: false
541
+
542
+
expect(err).toinclude("Two gemspecs have conflicting requirements on the same gem: rubocop (~> 1.36.0, development) and rubocop (~> 2.0, development). Bundler cannot continue.")
543
+
end
544
+
488
545
it"warns when a Gemfile dependency is overriding a gemspec development dependency, with different requirements"do
0 commit comments