Add additional requires support to tapioca

This commit is contained in:
Douglas Eichelberger 2024-02-01 09:40:31 -08:00
parent 7942f9dacf
commit 15db90effd

View File

@ -1,11 +1,15 @@
# typed: strict
# frozen_string_literal: true
# This should not be made a constant or Tapioca will think it is part of a gem.
# These should not be made constants or Tapioca will think they are part of a gem.
dependency_require_map = {
"ruby-macho" => "macho",
}.freeze
additional_requires_map = {
"rubocop" => ["rubocop/rspec/support"],
}.freeze
# Freeze lockfile
Bundler.settings.set_command_option(:frozen, "1")
@ -19,8 +23,8 @@ definition.resolve.for(definition.current_dependencies).each do |spec|
next if name == "sorbet-static-and-runtime"
name = dependency_require_map[name] if dependency_require_map.key?(name)
require name
additional_requires_map[name]&.each { require(_1) }
rescue LoadError
raise unless name.include?("-")