-
Notifications
You must be signed in to change notification settings - Fork 558
Delete --package-rbi-generation
mode
#8662
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
Conversation
The `--package-rbi-generation` mode is proving difficult to maintain for a couple reasons: - It initializes the packager options differently from the rest of the pipeline. This is important, because we need the GlobalState to have the right packager options so that `namer` can decide whether it wants to treat `__package.rb` files as packages and enter them into the symbol table, or leave them as normal Ruby files. - It does weird things with `__package.rb` files. It tries to make it seem like you're running with `opts.stripePackages` being false, but then do package-related things (e.g., `findPackages`). - It's going to complicate our attempts to interleave resolve and typecheck. This feature never made it into use at Stripe, and never gained LSP support. Also, we generally don't think this approach is the approach we'd use if we were to revisit that: we think that we'd probably have a "one RBI per package" approach, instead of "one RBI per transitive package deps" approach, which would get rid a lot of the hacks around "this symbol doesn't resolve" that have infected resolver right now. This change deletes all but the code in `packager/rbi_gen.{h,cc}`. The RBI generation code itself is useful to keep around because it has a bunch of stuff which could be useful for simply generating RBIs from `GlobalState`.
The code in `packager/rbi_gen.*` will still be tested indirectly via the `//packager:packager` library. We could split it out, but then we'd have to make a whole job just to test it and there's not that much code in the library in the first place, so I'm not too worried about it being separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are removing the support, but we are leaving rbi_gen.cc
?
I don't need to remove it for any of the other packager/namer work, so I had left it so that it would at least keep building. Most of the code is pretty straightforward and could be a useful mechanism to effectively serialize a symbol table to an RBI. If we want it gone too, I'm happy to remove it in a follow up. |
Motivation
The
--package-rbi-generation
mode is proving difficult to maintain for acouple reasons:
It initializes the packager options differently from the rest of the
pipeline. This is important, because we need the GlobalState to have
the right packager options so that
namer
can decide whether it wantsto treat
__package.rb
files as packages and enter them into thesymbol table, or leave them as normal Ruby files.
It does weird things with
__package.rb
files. It tries to make itseem like you're running with
opts.stripePackages
being false, butthen do package-related things (e.g.,
findPackages
).It's going to complicate our attempts to interleave resolve and
typecheck.
This feature never made it into use at Stripe, and never gained LSP
support. Also, we generally don't think this approach is the approach we'd
use if we were to revisit that: we think that we'd probably have a
"one RBI per package" approach, instead of "one RBI per transitive package
deps" approach, which would get rid a lot of the hacks around
"this symbol doesn't resolve" that have infected resolver right now.
This change deletes all but the code in
packager/rbi_gen.{h,cc}
. The RBIgeneration code itself is useful to keep around because it has a bunch of
stuff which could be useful for simply generating RBIs from
GlobalState
.Test plan
not planning on touching
rbi_gen.cc
code is still being compiled via//main:sorbet
so thosebuild failures will show up in CI still