Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOT WORKING SOFTWARE - YET

This is the blueprint for Nake: a next-generation build tool that combines the high-level safety of Nickel with the low-level speed of Ninja and the surgical precision of execline.


Project: Nake

"The Brain of Nickel, the Brawn of Ninja."

1. The Core Philosophy

Traditional build tools fail because they mix Logic, Dependency Tracking, and Command Execution into one messy pot. Nake separates them:

  • Logic (Nickel): Programmable, typed, and validated via Contracts.
  • Dependency Graph (Ninja): A flat, fast machine-code equivalent for builds.
  • Execution (Pluggable): Choice of Bash (compatibility), YSH (data), or execline (performance).

2. The Architecture

Nake operates as a "Build Compiler." It takes high-level Nickel intent and "lowers" it into an optimized Ninja manifest.

  1. Contract Layer: Users define tasks using Nickel records. Every task is validated against a schema (e.g., ensuring inputs and outputs are defined).
  2. Modular Backends: The execution engine (the shell) is a merged module. You can switch from Bash to execline by changing one line of code.
  3. The Lowering Phase: Nake evaluates the Nickel logic and generates a build.ninja file.
  4. The Execution Phase: Ninja runs the generated commands in parallel with zero overhead.

3. The "Killer Feature": The Typed Feedback Loop

Unlike Make, which only checks exit codes, Nake can use structured shells (like YSH or Nushell) to create a feedback loop:

  • Command: Compile app.c.
  • Response: Shell returns a JSON object: { "size": "45kb", "dynamic_libs": ["libc.so"] }.
  • Validation: Nickel checks this against a contract (e.g., "Binary must be < 50kb"). If it fails, the build stops.

4. Comparative Advantage

Feature Make / CMake Nake
Logic Language Brittle String-matching Nickel (Functional & Typed)
Orchestrator Slow Serial/Parallel Ninja (Blazing Fast)
Execution Raw Shell (unsafe) execline (Atomic / No-shell)
Validation Post-build scripts In-engine Contracts

5. Usage Example (nake.ncl)

let nake = import "nake_std.ncl" in
let engine = import "nake/engines/execline.ncl" in

{
  # Merge the high-performance execline engine into the project
  project = {
    name = "Chromium-Scale-Project",
  } & engine.PerformanceSettings,

  tasks = {
    compile = {
      cmd = ["clang", "-O3", "main.c", "-o", "main.o"],
      inputs = ["main.c"],
      outputs = ["main.o"],
    } | nake.Task,
  }
}

6. The Performance "Win" (The Chromium Case)

For massive projects like Chromium (40,000+ files):

  • Standard Shell: Spawning 40,000 shells adds minutes of idle overhead.
  • execline Backend: Zero shell overhead. Each process "chains" into the next via execve, saving significant CPU time and eliminating shell-parsing bugs.

Next Steps for a Prototype

  1. Nake-Std: A Nickel library defining the Task and Backend contracts.
  2. Nake-CLI: A Rust-based wrapper that executes nickel export and templates the results into a build.ninja file.
  3. Backend Modules: Initial modules for bash.ncl and execline.ncl.

Nake represents the transition from "Build Scripts" to "Build Engineering." It provides the safety of a modern programming language with the performance of a handwritten Ninja file.

About

Nickel Make

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages