Commit 156e96d1

156e96d1885aMerged

NHH <[email protected]> · 6 months ago · 10 files · +7 added · ~3 modified

Description

feat(gem): add Spinelfile + path-gem loadpath resolution (Phase 0)

spinel-gem reads a Spinelfile (path: gems only) and writes a Spinelfile.loadpaths sidecar. spinel_parse learns --loadpaths=FILE and searches those dirs before <exe_dir>/lib. The driver walks up from the source file to discover the sidecar, so require "foo" in any nested .rb finds the gem.

Also fixes a latent bug where a top-of-file plain require was silently dropped after the first splice rebuilt the buffer -- the bootstrap clause only fired when result == source, then never again.

Tests: 11 unit + 6 E2E + 1 parser regression; new make test-gems.

Details

Commit
156e96d1885a
Parent
f78c5792301d

MakefilemodifiedView file

@@ -136,7 +136,7 @@
136136 COMPILER_HELPERS_STAMP := build/stamps/compiler_helpers.rb.stamp
137137 PARSE_STAMP := build/stamps/spinel_parse.c.stamp
138138
139-.PHONY: all parse bootstrap codegen rbs_extract test retest clean-test-results regen-expected bench optcarrot clean install uninstall deps
139+.PHONY: all parse bootstrap codegen rbs_extract test retest test-gems clean-test-results regen-expected bench optcarrot clean install uninstall deps
140140
141141 # `make all` includes spinel_rbs_extract when vendor/rbs has been
142142 # fetched (via `make deps`). Without vendor/rbs the extractor is
@@ -407,6 +407,13 @@
407407 retest: clean-test-results
408408 @$(MAKE) --no-print-directory test
409409
410+# spinel-gem POC tests: unit tests for the Spinelfile DSL + shell-driven
411+# end-to-end scenarios (basic resolution, walk-up discovery, negative,
412+# dedup, invalid config). Depends on the parser binary being current so
413+# the E2E flow exercises the loadpath sidecar plumbing for real.
414+test-gems: spinel_parse$(EXE)
415+ @sh test_gem/run_all.sh
416+
410417 # The .ok target is the test's stamp; mtime tracking gives per-test
411418 # caching for free. Order-only spinel_parse$(EXE) / spinel_analyze$(EXE)
412419 # / spinel_codegen$(EXE) stop a bootstrap relink from invalidating every test.