-
Notifications
You must be signed in to change notification settings - Fork 2
Controller Design Documentation
The controller has three main tasks:
- Read input from the user -- namely, a Makefile and a Docker image name.
- Extract a list of targets from the Makefile, along with the dependency information for each target.
- Intelligently design a job queue using the list of targets. Convey this queue to the client.
Part 1 is trivial.
Part 2 is conceptually simple, but there are a lot of edge cases to cover. Makefiles are difficult to parse, use non-explicit syntax to build certain fles, and are often called recursively.
We can avoid these issues by appending a special target to the end of the the Makefile.
When called, this target will recursively call make on the other targets in the file, effectively performing a dry-run of the final build process. By using make itself to handle dependencies + recursion, we sidestep a lot of the complexity associated with Makefile parsing.
This method requires that the host operating system supports GNU make (ie. non-windows targets). We can either stop supporting Windows platforms or run step 2 inside a Docker container. It's ugly, but it should work.