Skip to content

Commit d368c8c

Browse files
committed
Bootstrap gem symbols from Rubydex graph
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
1 parent 2d3279f commit d368c8c

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

lib/tapioca/gem/pipeline.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ def initialize(
3131
@events = [] #: Array[Gem::Event]
3232

3333
@payload_symbols = Static::SymbolLoader.payload_symbols #: Set[String]
34-
@bootstrap_symbols = load_bootstrap_symbols(@gem) #: Set[String]
35-
gem_graph = Static::SymbolLoader.graph_from_paths(@gem.files) if include_doc
34+
gem_graph = Static::SymbolLoader.graph_from_paths(@gem.files) #: Rubydex::Graph
35+
gem_symbols = gem_graph.declarations.map(&:name).to_set
36+
engine_symbols = Static::SymbolLoader.engine_symbols(@gem)
37+
@bootstrap_symbols = gem_symbols.union(engine_symbols) #: Set[String]
3638

3739
@bootstrap_symbols.each { |symbol| push_symbol(symbol) }
3840

@@ -191,14 +193,6 @@ def name_of(constant)
191193

192194
private
193195

194-
#: (Gemfile::GemSpec gem) -> Set[String]
195-
def load_bootstrap_symbols(gem)
196-
engine_symbols = Static::SymbolLoader.engine_symbols(gem)
197-
gem_symbols = Static::SymbolLoader.gem_symbols(gem)
198-
199-
gem_symbols.union(engine_symbols)
200-
end
201-
202196
# Events handling
203197

204198
#: -> Gem::Event

lib/tapioca/static/symbol_loader.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ def graph_from_paths(paths)
2626
graph
2727
end
2828

29-
#: (Gemfile::GemSpec gem) -> Set[String]
30-
def gem_symbols(gem)
31-
symbols_from_paths(gem.files)
32-
end
33-
3429
#: (Gemfile::GemSpec gem) -> Set[String]
3530
def engine_symbols(gem)
3631
gem_engine = engines.find do |engine|
@@ -51,7 +46,8 @@ def engine_symbols(gem)
5146
Pathname.glob("#{load_path}/**/*.rb")
5247
end
5348

54-
symbols_from_paths(paths)
49+
engine_graph = graph_from_paths(paths)
50+
engine_graph.declarations.map(&:name).to_set
5551
rescue
5652
Set.new
5753
end

0 commit comments

Comments
 (0)