-
Notifications
You must be signed in to change notification settings - Fork 44
Make Mode Design
Ilya Sher edited this page May 14, 2022
·
5 revisions
This page describes the design of NGS make mode. In this mode, it will be possible to use NGS in a manner similar to make
.
- A way to describe build targets in NGS syntax
- A way to easily run a given target from the command line
- A way to easily run a given target from other NGS scripts (after they
require()
the file with the targets) - Allow inclusion of additional targets using
require()
- Easy way to pass positional and named parameters when running a target
- Targets will be NGS methods (functions). This will allow calling the targets from other NGS scripts and from other targets().
- Targets will live in namespaces and hence must be defined using
ns
keyword.- Namespaces will allow easy lookup of targets when invoked from command line (as opposed to
globals()
) - Namespaces allow restricting targets to a particular set of methods
- Namespaces allow listing of targets
- Namespaces will allow easy lookup of targets when invoked from command line (as opposed to
- For passing parameters from command line, factor out and re-use the parameters matching facility that is currently used to invoke
main()
.
- Design dependencies handling
- Simply call another method? No because of parallelism and dependency graph.
- Design Parallelism
- Design rules
-
file
target to make a file? Solves namespace issues and.PHONY
ofGNU Make
. - Running
- Run using a command such as
ngs-make
or directly using the NGS file such as./make.ngs TARGET
- Not requiring additional binary/script in path should be a plus
-
./make.ngs
style also makes it obvious how to run alternate "make" files (thinkmake.linux.ngs
andmake.macosx.ngs
)
- Run using a command such as
- A syntax to define additional constraints on the method arguments (such as
~ Sfx('.o')
) - Nested namespaces?
- Looks like too much boilerplate to support
require()
ing. - Lists of files similar to Rake::FileList ?
#!/usr/bin/env ngs
ns {
doc Builds .o files
F file(dst:Str) {
guard dst ~ Sfx('.o')
...
}
doc Removes all generated files
F clean() {
...
}
}
- https://github.com/ngs-lang/ngs/issues/37 - Make mode
NGS official website is at https://ngs-lang.org/