Simplify the build: one-file modules, a module graph read off the imports #67
Reference in New Issue
Block a user
Delete Branch "project-infrastructure-improvements"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An example of modules.mk, with the empty rule for each source cut short:
Also regarding the build process:
6f7b28cfa5to67749c8db0Built and ran this on CHICKEN 6.0.0 at
67749c8. A cleanmake -jproduced sexc, andmake checkpassed: the unit tests, all 25 programs intests/sex-programs,check-modules, andcheck-exit-code.With the graph in place, the rebuilds do what the commits say. Touching
tests/basic.scmrecompiledtests/run.scmand relinkedsex-tests, and left the modules alone. A newbrand.scmimported from that test was compiled with-module brandand linked intosex-tests. A secondmakewas a no-op. A source dated tomorrow rebuilt once and stopped. A scratchtest.scmstayed out of the graph, which is what listingtestindependencies.txtis for.Three holes sit outside that.
A
scheme.scmin the root becomes theschemeunit, and the build accepts it. Every unit importsscheme, andschemeis not an egg independencies.txt, so the scan treats a file of that name as the module. I dropped one in that importsschemeand exports a singlex.make sexcprintedCircular scheme.o <- scheme.o dependency dropped, compiled it with-module scheme -unit scheme, rebuilt every module against it, linked, and exited 0. The rule it wrote wasscheme.o: scheme.o, and every other object listedscheme.otoo.Deleting
modules.mkand editing a unit test leavesmakeat "up to date". The file is written frommodules.stamp's recipe, andmodules.mk's own rule is empty. Afterrm modules.mkthe stamp was still newer than the root sources, so the recipe did not run.touch tests/basic.scmthenmake sex-testsprintedmake: 'sex-tests' is up to date.andmodules.mkwas still absent. Those test sources are prerequisites only throughSOURCES, which arrives in the missing file, andsex-tests's prerequisites arrive the same way.make cleanremoves the stamp too, so that path comes back; deleting the generated makefile on its own does not.Two files that
include-relativeeach other hang the scan.a.scmandb.scm, each including the other:csi -s tools/module-deps.scm prog=a.scmprinted nothing and was still running when I killed it at five seconds.makewould sit on the stamp recipe the same way. The walk has no record of a file it has already entered.Review 117, all three fixed:
49b463a: a root file named after a module CHICKEN has, likescheme.scm, is no longer taken for that module.tools/module-deps.scmasksmodule-environment, from/, so a localNAME.import.scmcannot answer for CHICKEN.8488a58:modules.stampdepends onFORCEwhilemodules.mkis missing, sorm modules.mkalone is scanned again.0628d1c: the scan carries the files it has read, and an include cycle reads each one once.Beyond the review, nothing is exported for the tests any more. The
;; for the testsgroups are gone, and each module exports what another module imports. The tests go through the public entries: Sex source through the whole pipeline (tests/pipeline.scm), or a sexc process (tests/command-line/check.scm,make check-command-line, replacingtests/args.scm).4758802,6198c51,ab881e4,600b480,bf8ba2f: tests rewritten.13d20a1: rewriting the writer's tests as C found(const * struct X)losing itsconst,(* * struct X)losing a star, and(* enum X)crashing. Fixed in the vendored fmt-c.6737878,16a1c3b,9a3c01e,1c6d0aa: infer's generics scaffolding, which only the tests called, is gone, along with the unused exports and dead definitions in every module.The description is updated to match.
Built and ran this on CHICKEN 6.0.0 at
1c6d0aa.make checkpassed, including the command-line check and the pointer-to-struct and pointer-to-enum cases.The three holes from last time are closed.
A
scheme.scmin the root stayed out of the graph.make sexcdid not compile it.rm modules.mk, then touchingtests/codegen.scmandmake sex-tests, rewrotemodules.mk, recompiledtests/run.scm, and relinkedsex-tests. The nextmake sex-testswas up to date.Two files in one directory that
include-relativeeach other were read once. The scan printed both and exited.A cycle spelled with
../is still a different string on each step (sub/../sub/../...), and the scan follows it until the name is too long. The includes this tree has are names in the same directory, which the seen list catches.LGTM
@@ -65,0 +58,4 @@modules.mk: modules.stamp ;modules.stamp: $(SOURCES) $(filter-out %.import.scm,$(wildcard *.scm)) \tools/module-deps.scm dependencies.txt Makefile \That is another list of files, that is easy to forget about. I don't know how to fix it, whether to make a variable somewhere on top of the makefile, or make it computable somehow. The fact is - we will forget about it someday.
That we will, but probably CI will save us. Or manual testing.
@@ -6,0 +3,4 @@;;; semen solves the wildcards of a declared type with it -- `(var n _;;; (strlen s))', `(var p (* _) (& x))' -- and asks it what an operand;;; decays or promotes to. It is the ground floor of the pass described;;; in Type-inference.org.Where hmmm
Please reword that without mentioning things that don't matter.
Yep sorry.
1c6d0aae62to635cc48aa3