Skip to content

Commit

Permalink
additional test with multiple locked platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Nov 18, 2023
1 parent bbc676e commit 4b39e28
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 2 deletions.
1 change: 0 additions & 1 deletion bundler/lib/bundler/dsl.rb
Expand Up @@ -254,7 +254,6 @@ def platforms(*platforms)
def lock_platform(*platforms)
platforms.each do |p|
gem_platform = Gem::Platform.new(p)
# TODO: this is copied from lock
if gem_platform.to_s == "unknown"
raise GemfileError, "Unknown lock_platform #{platform_string.inspect} in Gemfile"
end
Expand Down
96 changes: 95 additions & 1 deletion bundler/spec/runtime/platform_spec.rb
Expand Up @@ -478,6 +478,25 @@
end
end

lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
nokogiri (1.13.8)
PLATFORMS
ruby
DEPENDENCIES
nokogiri
CHECKSUMS
BUNDLED WITH
#{Bundler::VERSION}
L


install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
Expand All @@ -503,7 +522,82 @@
PLATFORMS
aarch64-linux
x86-darwin-100
ruby
DEPENDENCIES
nokogiri
CHECKSUMS
#{checksums}
BUNDLED WITH
#{Bundler::VERSION}
L

# TODO: "nokogiri was expected to be of platform ruby but was ruby"
# expect(the_bundle).to include_gems "nokogiri 1.13.8 ruby"
expect(lockfile).to eq(expected_lockfile)
end

it "adds platforms specified by a gemfile" do
simulate_platform "x86-darwin-100"

build_repo4 do
build_gem "nokogiri", "1.13.8"
build_gem "nokogiri", "1.13.8" do |s|
s.platform = "aarch64-linux"
end
build_gem "nokogiri", "1.13.8" do |s|
s.platform = "x86_64-linux"
end
end

lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
nokogiri (1.13.8)
PLATFORMS
ruby
DEPENDENCIES
nokogiri
CHECKSUMS
BUNDLED WITH
#{Bundler::VERSION}
L

install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
lock_platform "aarch64-linux", "x86_64-linux"
gem "nokogiri"
G

checksums = checksum_section do |c|
c.repo_gem gem_repo4, "nokogiri", "1.13.8"
# TODO: This is wrong, the point is to get the checksum
# Figure out why it's not fetching them for other platforms
c.no_checksum "nokogiri", "1.13.8", "aarch64-linux"
c.no_checksum "nokogiri", "1.13.8", "x86_64-linux"
end

expected_lockfile = <<~L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
nokogiri (1.13.8)
nokogiri (1.13.8-aarch64-linux)
nokogiri (1.13.8-x86_64-linux)
PLATFORMS
aarch64-linux
ruby
x86_64-linux
DEPENDENCIES
nokogiri
Expand Down

0 comments on commit 4b39e28

Please sign in to comment.