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 DSL compilers from gems #1075

Merged
merged 3 commits into from
Jul 25, 2022
Merged

Load DSL compilers from gems #1075

merged 3 commits into from
Jul 25, 2022

Conversation

paracycle
Copy link
Member

@paracycle paracycle commented Jul 22, 2022

Motivation

Instead of bundling all the DSL compilers inside Tapioca, we've been asking teams to write their own DSL compilers inside their gems and applications. However, until now there wasn't a good way to load those DSL compilers apart from hacky methods like requiring them from a Ruby file inside sorbet/tapioca/compilers.

Implementation

The implementation is pretty much based on how Minitest loads its plugins from other gems. Gem.find_files is a method that is designed to discover features from other gems, and by using that we can load all compilers defined by Ruby files inside lib/tapioca/dsl/compilers folders. This also includes loading all of the DSL compilers that are bundled into Tapioca as well, btw, so it neatly unifies all these code paths.

Tests

Add a test for loading a DSL compiler from the expected folder in a gem.

@paracycle paracycle requested a review from a team as a code owner July 22, 2022 18:38
@paracycle paracycle self-assigned this Jul 22, 2022
@paracycle paracycle force-pushed the uk-load-compilers-from-gems branch from 3dd038f to fe92fc1 Compare July 22, 2022 21:09
@paracycle paracycle merged commit 7c81467 into main Jul 25, 2022
@paracycle paracycle deleted the uk-load-compilers-from-gems branch July 25, 2022 17:17
@shopify-shipit shopify-shipit bot temporarily deployed to production August 31, 2022 14:40 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants