Open tusharr opened 2 years ago
I am not able to reproduce this locally using Ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) on an m1 machine. Since it's a Ruby crash it may also be architecture specific. Can you also try using a newer Ruby version?
@KaanOzkan We are facing the same problem with a private gem. We tried excluding it from the config file as well, but it is always included. tapioca works fine when we remove the gem from the Gemfile
and Gemfile.lock
This is the ruby version I have: ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [arm64-darwin23]
This is a hack but I wonder if you can add a file like sorbet/tapioca/prerequire.rb
that's removing the gem using remove_const
. --prerequire
is a flag that runs before the gems are loaded. That flag will need to be passed into the gem
command. I'm not sure if it'll work but it's worth a shot.
# sorbet/tapioca/prerequire.rb
self.class.send(:remove_const, :Foo)
# You might need to remove all constants defined in the gem
# sorbet/tapioca/config.yml
---
gem:
prerequire: "prerequire.rb"
FWIW, I recently faced the same issue with the noticed
gem in ruby 3.3.0 on a Mac M1. The exclude option did not exclude the gem and only removing it from the Gemfile worked.
I'm also having trouble with noticed
(and active_storage-postgresql
) @wesharper
It looks like Tapioca intentionally disregards requires: false
in the Gemfile
(#818). The aim was to pickup more RBIs for more gems, which are conditionally/lazily require
-ed in the application (rather than from the Gemfile
itself).
The assumption there is that merely requiring a gem would be harmless, and shouldn't be an issue (q: why does requiring these gems cause a crash?), but that appears not to be the case. Ideally we should fix these crashers, but also, Tapioca should have an "escape hatch" to help you circumvent them in the meanwhile.
IMO it's reasonable to change this AutoRequireHook
so that it respects require: false
for gems that are in the --exclude=
list. Would one of you be interested in opening a PR for this?
Edit: Looks like that's already the case:
This will need some deeper debugging/investigation. Contributions are very much welcomed
I installed a new gem
image_processing
in my project. The app runs fine with this new gem but when I runtapioca gem
to create the RBI definitions, the process seg faults. I passed the--exclude
option, and/or added exclude thesorbet/tapioca/config.yml
file, but the command seg faults.The command I'm running is
./bin/tapioca gems --exclude=image_processing
but this gem always gets required by the command.The output is huge, but the first few 100 lines look like this: