|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +RSpec.describe "bundle install with wheel platform gems" do |
| 4 | + before do |
| 5 | + build_repo4 do |
| 6 | + # Build wheel platform specific gems |
| 7 | + build_gem "wheel_native", "1.0.0" do |s| |
| 8 | + s.platform = "whl-rb33-x86_64_linux" |
| 9 | + s.write "lib/wheel_native.rb", "WHEEL_NATIVE_VERSION = '1.0.0-whl-rb33-x86_64_linux'" |
| 10 | + end |
| 11 | + |
| 12 | + build_gem "wheel_native", "1.0.0" do |s| |
| 13 | + s.platform = "whl-rb32-x86_64_linux" |
| 14 | + s.write "lib/wheel_native.rb", "WHEEL_NATIVE_VERSION = '1.0.0-whl-rb32-x86_64_linux'" |
| 15 | + end |
| 16 | + |
| 17 | + build_gem "wheel_native", "1.0.0" do |s| |
| 18 | + s.platform = "whl-rb33-x86_64_darwin" |
| 19 | + s.write "lib/wheel_native.rb", "WHEEL_NATIVE_VERSION = '1.0.0-whl-rb33-x86_64_darwin'" |
| 20 | + end |
| 21 | + |
| 22 | + # Fallback ruby gem |
| 23 | + build_gem "wheel_native", "1.0.0" do |s| |
| 24 | + s.platform = "ruby" |
| 25 | + s.write "lib/wheel_native.rb", "WHEEL_NATIVE_VERSION = '1.0.0-ruby'" |
| 26 | + end |
| 27 | + |
| 28 | + # Multi-tag wheel gem |
| 29 | + build_gem "multi_wheel", "2.0.0" do |s| |
| 30 | + s.platform = "whl-rb33.rb32-x86_64_linux" |
| 31 | + s.write "lib/multi_wheel.rb", "MULTI_WHEEL_VERSION = '2.0.0-whl-rb33.rb32-x86_64_linux'" |
| 32 | + end |
| 33 | + |
| 34 | + build_gem "multi_wheel", "2.0.0" do |s| |
| 35 | + s.platform = "ruby" |
| 36 | + s.write "lib/multi_wheel.rb", "MULTI_WHEEL_VERSION = '2.0.0-ruby'" |
| 37 | + end |
| 38 | + end |
| 39 | + end |
| 40 | + |
| 41 | + context "when wheel platform gem is available for current platform" do |
| 42 | + it "installs the wheel platform specific gem" do |
| 43 | + skip "Wheel platform detection not fully implemented in resolver yet" |
| 44 | + |
| 45 | + install_gemfile <<-G |
| 46 | + source "https://gem.repo4" |
| 47 | + gem "wheel_native" |
| 48 | + G |
| 49 | + |
| 50 | + expect(the_bundle).to include_gems "wheel_native 1.0.0" |
| 51 | + # Would need to check that the correct platform version was installed |
| 52 | + end |
| 53 | + end |
| 54 | + |
| 55 | + context "when no wheel platform gem matches" do |
| 56 | + it "falls back to ruby platform gem" do |
| 57 | + install_gemfile <<-G |
| 58 | + source "https://gem.repo4" |
| 59 | + gem "wheel_native" |
| 60 | + G |
| 61 | + |
| 62 | + expect(the_bundle).to include_gems "wheel_native 1.0.0" |
| 63 | + |
| 64 | + ruby <<-R |
| 65 | + require 'wheel_native' |
| 66 | + puts WHEEL_NATIVE_VERSION |
| 67 | + R |
| 68 | + |
| 69 | + expect(out).to include("1.0.0-ruby") |
| 70 | + end |
| 71 | + end |
| 72 | + |
| 73 | + context "with multi-tag wheel gems" do |
| 74 | + it "matches compatible multi-tag wheel gems" do |
| 75 | + skip "Multi-tag wheel matching not fully implemented yet" |
| 76 | + |
| 77 | + install_gemfile <<-G |
| 78 | + source "https://gem.repo4" |
| 79 | + gem "multi_wheel" |
| 80 | + G |
| 81 | + |
| 82 | + expect(the_bundle).to include_gems "multi_wheel 2.0.0" |
| 83 | + end |
| 84 | + end |
| 85 | + |
| 86 | + context "platform resolution priority" do |
| 87 | + it "prefers wheel platform over traditional platform" do |
| 88 | + skip "Platform priority not fully implemented in bundler yet" |
| 89 | + |
| 90 | + build_repo4 do |
| 91 | + # Traditional platform gem |
| 92 | + build_gem "priority_test", "1.0.0" do |s| |
| 93 | + s.platform = "x86_64-linux" |
| 94 | + s.write "lib/priority_test.rb", "PRIORITY_VERSION = '1.0.0-x86_64-linux'" |
| 95 | + end |
| 96 | + |
| 97 | + # Wheel platform gem (should have higher priority) |
| 98 | + build_gem "priority_test", "1.0.0" do |s| |
| 99 | + s.platform = "whl-rb33-x86_64_linux" |
| 100 | + s.write "lib/priority_test.rb", "PRIORITY_VERSION = '1.0.0-whl-rb33-x86_64_linux'" |
| 101 | + end |
| 102 | + end |
| 103 | + |
| 104 | + install_gemfile <<-G |
| 105 | + source "https://gem.repo4" |
| 106 | + gem "priority_test" |
| 107 | + G |
| 108 | + |
| 109 | + ruby <<-R |
| 110 | + require 'priority_test' |
| 111 | + puts PRIORITY_VERSION |
| 112 | + R |
| 113 | + |
| 114 | + # Should prefer wheel platform over traditional platform |
| 115 | + expect(out).to include("whl-rb33-x86_64_linux") |
| 116 | + end |
| 117 | + end |
| 118 | + |
| 119 | + context "lockfile generation with wheel platforms" do |
| 120 | + it "records wheel platforms in the lockfile" do |
| 121 | + skip "Lockfile wheel platform recording not implemented yet" |
| 122 | + |
| 123 | + install_gemfile <<-G |
| 124 | + source "https://gem.repo4" |
| 125 | + gem "wheel_native" |
| 126 | + G |
| 127 | + |
| 128 | + lockfile_should_be <<-L |
| 129 | + GEM |
| 130 | + remote: https://gem.repo4/ |
| 131 | + specs: |
| 132 | + wheel_native (1.0.0-whl-rb33-x86_64_linux) |
| 133 | +
|
| 134 | + PLATFORMS |
| 135 | + whl-rb33-x86_64_linux |
| 136 | +
|
| 137 | + DEPENDENCIES |
| 138 | + wheel_native |
| 139 | +
|
| 140 | + BUNDLED WITH |
| 141 | + #{Bundler::VERSION} |
| 142 | + L |
| 143 | + end |
| 144 | + end |
| 145 | +end |
0 commit comments