Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load dependencies on -r option also #1013

Merged
merged 4 commits into from
Jul 28, 2022

Conversation

pocke
Copy link
Member

@pocke pocke commented Jun 2, 2022

This PR allows you to load dependency for standard libraries loaded with -r out of the box.

Problem

rbs collection is the manager of third-party gems' RBSs. It resolves dependencies of gems/stdlibs.
But it requires defining the application dependency with rbs_collection.yaml. It means it doesn't resolve the dependencies on -r.

So, we needed to resolve the dependencies manually on -r.

Solution

With this change, the dependencies are loaded automatically even if we use -r. It uses the same way as rbs collection but for -r.

RBS-related tools do not need to care about this PR. The dependency will be resolved without any changes for the related tools such as typeprof.

@pocke pocke force-pushed the load-dependencies-from--r-option branch 2 times, most recently from 94300f8 to 8123d46 Compare July 14, 2022 10:52
@pocke pocke force-pushed the load-dependencies-from--r-option branch from 31fd0b5 to 0e3f4d6 Compare July 26, 2022 05:34
@pocke pocke changed the title [WIP] Load dependencies on -r option also Load dependencies on -r option also Jul 28, 2022
@pocke pocke marked this pull request as ready for review July 28, 2022 05:54
@@ -34,16 +34,32 @@ def initialize(core_root: DEFAULT_CORE_ROOT, repository: Repository.new)
@core_root = core_root
@repository = repository

@libs = []
@libs = Set.new
Copy link
Member Author

Choose a reason for hiding this comment

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

It is necessary to avoid an infinite loop.

I know EnvironmentLoader also checks duplication in each_decl, but this change is also necessary to avoid an infinite loop during add phase.

@pocke pocke merged commit 0f5fdaa into ruby:master Jul 28, 2022
@pocke pocke deleted the load-dependencies-from--r-option branch July 28, 2022 07:51
@soutaro soutaro added this to the RBS 2.7.0 milestone Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants