Skip to content

Conversation

@soutaro
Copy link
Member

@soutaro soutaro commented Feb 1, 2023

Assuming gems declared in Gemfile with require: false are apps -- not libraries, we can skip loading the RBS files of that gems in collection.

  1. The LockfileGenerator starts from the gems declared in Gemfile without require: false, and adds them and their dependencies recursively.
  2. It skips a gem if it's ignored in rbs_collection.yaml.

Because `rbs collection` assumes Bundler, loading *unbundled* gem fails.
@soutaro soutaro requested a review from pocke February 1, 2023 05:15
end
end

def test_generate_lock_from_collection_repository_specified
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot delete this test because a default gem may be required without declared in Gemfile...

Copy link
Member Author

@soutaro soutaro Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ok. The test doesn't make any sense and to be deleted.

If a non-default gem is not included in the Bundler context, it cannot be require-ed nor Gem::Specification.find_by_name cannot find the gem.

If a default gem is implicitly loaded, it should be included in the gems section of rbs_collection.yaml or dependencies: section of manifest.yaml of a gem.

@soutaro soutaro added this to the RBS 3.0 milestone Feb 6, 2023
@soutaro soutaro merged commit 277674e into master Feb 8, 2023
@soutaro soutaro deleted the gemfile-require branch February 8, 2023 06:03
@soutaro soutaro linked an issue Feb 11, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop loading non-library RBS files

2 participants