|
386 | 386 | expect(the_bundle).to include_gems "rack 1.0.0" |
387 | 387 | end |
388 | 388 |
|
| 389 | + it "uses cached gems for secondary sources when cache_all_platforms configured" do |
| 390 | + build_repo4 do |
| 391 | + build_gem "foo", "1.0.0" do |s| |
| 392 | + s.platform = "x86_64-linux" |
| 393 | + end |
| 394 | + |
| 395 | + build_gem "foo", "1.0.0" do |s| |
| 396 | + s.platform = "arm64-darwin" |
| 397 | + end |
| 398 | + end |
| 399 | + |
| 400 | + gemfile <<~G |
| 401 | + source "https://gems.repo2" |
| 402 | +
|
| 403 | + source "https://gems.repo4" do |
| 404 | + gem "foo" |
| 405 | + end |
| 406 | + G |
| 407 | + |
| 408 | + lockfile <<~L |
| 409 | + GEM |
| 410 | + remote: https://gems.repo2/ |
| 411 | + specs: |
| 412 | +
|
| 413 | + GEM |
| 414 | + remote: https://gems.repo4/ |
| 415 | + specs: |
| 416 | + foo (1.0.0-x86_64-linux) |
| 417 | + foo (1.0.0-arm64-darwin) |
| 418 | +
|
| 419 | + PLATFORMS |
| 420 | + arm64-darwin |
| 421 | + ruby |
| 422 | + x86_64-linux |
| 423 | +
|
| 424 | + DEPENDENCIES |
| 425 | + foo |
| 426 | +
|
| 427 | + BUNDLED WITH |
| 428 | + #{Bundler::VERSION} |
| 429 | + L |
| 430 | + |
| 431 | + simulate_platform "x86_64-linux" do |
| 432 | + bundle "config set cache_all_platforms true" |
| 433 | + bundle "config set path vendor/bundle" |
| 434 | + bundle :cache, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } |
| 435 | + |
| 436 | + build_repo4 do |
| 437 | + # simulate removal of all remote gems |
| 438 | + end |
| 439 | + |
| 440 | + # delete compact index cache |
| 441 | + FileUtils.rm_rf home(".bundle/cache/compact_index") |
| 442 | + |
| 443 | + bundle "install", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } |
| 444 | + |
| 445 | + expect(the_bundle).to include_gems "foo 1.0.0 x86_64-linux" |
| 446 | + end |
| 447 | + end |
| 448 | + |
389 | 449 | it "does not reinstall already-installed gems" do |
390 | 450 | install_gemfile <<-G |
391 | 451 | source "#{file_uri_for(gem_repo1)}" |
|
0 commit comments