Skip to content

Commit

Permalink
Support Bundler 2.6.1
Browse files Browse the repository at this point in the history
Bundler 2.6 made a change where missing_specs are now kept in the
original resolve spec set, not in the spec set with materialized
specifications.

This change adapts tapioca to that.
  • Loading branch information
deivid-rodriguez committed Dec 18, 2024
1 parent c8c2a4e commit a41dc1c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: 3.5.23
rubygems: 3.6.1
- name: Run type check
run: bin/typecheck
- name: Lint Ruby files
Expand All @@ -36,6 +36,7 @@ jobs:
matrix:
ruby: ["3.1", "3.2", "3.3", "head"]
rails: ["7.0", "current", "main"]
rubygems: ["3.6.1"]
exclude:
- ruby: "3.1"
rails: "main"
Expand All @@ -44,6 +45,9 @@ jobs:
experimental: true
- ruby: "head"
experimental: true
- rails: "current"
ruby: "3.3"
rubygems: "3.5.23"
name: Ruby ${{ matrix.ruby }} - Rails ${{ matrix.rails }}
env:
RAILS_VERSION: ${{ matrix.rails }}
Expand All @@ -63,7 +67,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: 3.5.23
rubygems: ${{ matrix.rubygems }}
- name: Run tests
run: bin/test
continue-on-error: ${{ !!matrix.experimental }}
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,4 @@ DEPENDENCIES
xpath

BUNDLED WITH
2.5.23
2.6.1
23 changes: 16 additions & 7 deletions lib/tapioca/gemfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,23 @@ def load_dependencies
sig { returns([T::Enumerable[Spec], T::Array[String]]) }
def materialize_deps
deps = definition.locked_gems.dependencies.except(*@excluded_gems).values
materialized_dependencies = definition.resolve.materialize(deps)
missing_spec_names = materialized_dependencies.missing_specs.map(&:name).to_set
missing_specs = materialized_dependencies.missing_specs.map do |spec|
"#{spec.name} (#{spec.version})"
end
materialized_dependencies = materialized_dependencies.to_a.reject do |spec|
missing_spec_names.include?(spec.name)
resolve = definition.resolve
materialized_dependencies = resolve.materialize(deps)

if Bundler::VERSION >= "2.6.0"
missing_specs = resolve.missing_specs.map do |spec|
"#{spec.name} (#{spec.version})"
end
else
missing_spec_names = materialized_dependencies.missing_specs.map(&:name).to_set
missing_specs = materialized_dependencies.missing_specs.map do |spec|
"#{spec.name} (#{spec.version})"
end
materialized_dependencies = materialized_dependencies.to_a.reject do |spec|
missing_spec_names.include?(spec.name)
end
end

[materialized_dependencies, missing_specs]
end

Expand Down

0 comments on commit a41dc1c

Please sign in to comment.