File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed
spec/bundler/install/gemfile Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -621,11 +621,13 @@ def materialize(dependencies)
621
621
end
622
622
623
623
def start_resolution
624
+ @platforms |= [ local_platform ]
625
+
624
626
result = SpecSet . new ( resolver . start )
625
627
626
628
@resolved_bundler_version = result . find { |spec | spec . name == "bundler" } &.version
627
629
628
- if @current_ruby_locked_platform && @current_ruby_locked_platform != local_platform
630
+ if most_specific_ruby_locked_platform_is_not_local_platform?
629
631
@platforms . delete ( result . incomplete_for_platform? ( dependencies , @current_ruby_locked_platform ) ? @current_ruby_locked_platform : local_platform )
630
632
end
631
633
@@ -667,10 +669,15 @@ def current_platform_locked?
667
669
668
670
def add_current_platform
669
671
@current_ruby_locked_platform = most_specific_locked_platform if current_ruby_platform_locked?
672
+ return if most_specific_ruby_locked_platform_is_not_local_platform?
670
673
671
674
add_platform ( local_platform )
672
675
end
673
676
677
+ def most_specific_ruby_locked_platform_is_not_local_platform?
678
+ @current_ruby_locked_platform && @current_ruby_locked_platform != local_platform
679
+ end
680
+
674
681
def change_reason
675
682
if unlocking?
676
683
unlock_targets = if @gems_to_unlock . any?
Original file line number Diff line number Diff line change 1434
1434
end
1435
1435
end
1436
1436
1437
+ it "does not re-resolve when a specific platform, but less specific than the current platform, is locked" do
1438
+ build_repo4 do
1439
+ build_gem "nokogiri"
1440
+ end
1441
+
1442
+ gemfile <<~G
1443
+ source "#{ file_uri_for ( gem_repo4 ) } "
1444
+
1445
+ gem "nokogiri"
1446
+ G
1447
+
1448
+ lockfile <<~L
1449
+ GEM
1450
+ remote: #{ file_uri_for ( gem_repo4 ) } /
1451
+ specs:
1452
+ nokogiri (1.0)
1453
+
1454
+ PLATFORMS
1455
+ arm64-darwin
1456
+
1457
+ DEPENDENCIES
1458
+ nokogiri!
1459
+
1460
+ BUNDLED WITH
1461
+ #{ Bundler ::VERSION }
1462
+ L
1463
+
1464
+ simulate_platform "arm64-darwin-23" do
1465
+ bundle "install --verbose"
1466
+
1467
+ expect ( out ) . to include ( "Found no changes, using resolution from the lockfile" )
1468
+ end
1469
+ end
1470
+
1437
1471
private
1438
1472
1439
1473
def setup_multiplatform_gem
You can’t perform that action at this time.
0 commit comments