-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Move Sorbet gems into an optional group #11374
Conversation
Review period will end on 2021-05-13 at 15:25:19 UTC. |
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.
Makes sense to me! My only worry is that we end up uninstalling these in some circumstances due to BUNDLE_CLEAN
.
In which scenarios would that happen? If it's on The groups passed into |
Sounds like: no scenarios 🤞🏻. ✅ 🚢 |
2eee80e
to
f0fb873
Compare
Using
Challenges are:
Basically |
I'd pass on using it given the above. I'm wondering if a much simpler solution would be better e.g. making the |
Review period ended. |
Ok so I played around with this just to experiment with what approach might be best. I learned that there were parts of
It seems like a bit of moving around just to get something not too important to work, but since doing this revealed a couple bugs then I'm leaning towards this being the better approach to make. However, if you disagree I'm happy to just do this:
|
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.
However, if you disagree I'm happy to just do this:
making the Gemfile conditional on the OS version/arch?
I'm not sure I feel super strongly in one direction or another but it might be worth playing around with that (time boxed, please don't let me waste too much more of your time) in another PR so we can compare the two. The amount of changes required here just to not install Sorbet are starting to feel a little heavy (but perhaps for the best, hard to tell without comparing to another approach)?
Feel free to push back on this or any other requests, too.
@@ -12,9 +12,6 @@ class MissingEnvironmentVariables < RuntimeError; end | |||
# | |||
# @api private | |||
module EnvVar | |||
extend T::Sig | |||
|
|||
sig { params(env: String).returns(String) } |
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.
What happens if you add this back? Does it error-out in a sufficiently easy to understand version? I wonder if it's worth having a comment here noting the .rbi
file?
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.
It errors because require "sorbet-runtime"
or require "sorbet-runtime-stub"
hasn't been run yet so T
doesn't exist.
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.
Yeh, I figured that's why it errored but I was wondering how it errored i.e. if the messaging is obvious enough that people will understand what they've done wrong here.
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.
Traceback (most recent call last):
5: from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `<main>'
4: from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `require_relative'
3: from /usr/local/Homebrew/Library/Homebrew/global.rb:75:in `<top (required)>'
2: from /usr/local/Homebrew/Library/Homebrew/global.rb:75:in `require'
1: from /usr/local/Homebrew/Library/Homebrew/config.rb:14:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/config.rb:15:in `<module:EnvVar>': uninitialized constant EnvVar::T (NameError)
Everything works fine for me locally.
Not sure why not in the CI. |
@Bo98 perhaps try to unset |
Still can't reproduce. I suspect it is some parallelism or spec ordering issue. Manually trawling through the code, this line could be problematic: brew/Library/Homebrew/style.rb Line 88 in 33e71c9
since it will trigger the load path and Sorbet to be reinitialised ( |
Apart from macOS coverage being stuck as "queued for processing" and thus showing an overall -5.61% (which is probably a serverside issue and not to do with my changes), this seems to work now. |
Lastly, this doesn't do anything anymore: because this is now run before default prefix in global.rb is established and thus won't be overriding anything. Do we need it? Only difference I noticed is a different execution path in dev-cmd/bottle, which doesn't break existing tests because we only cover relocatable stuff. |
Did this to be safe and to limit behavioural changes in this PR. |
Looks good, thanks @Bo98! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Whenever a new macOS version is released, all operations which invoke
Homebrew.install_bundler_gems!
are non-functional until Sorbet releases a gem compatible with the new macOS version.This PR limits this impact by only installing Sorbet gems when
brew typecheck
orbrew tests
is run. This means that other commands likebrew audit
,brew style
,brew test
etc can still be run - enabling formula development to happen.This also covers unsupported archs. While not officially supported by us, this PR will allow most developer commands to work again on those systems.
The list of groups installed is remembered. So if you run
brew typecheck
once, then it'll keep Sorbet installed and updated when you runbrew audit
, for example.