This guide walks through creating and running a Netsuke build in under five minutes.
Before beginning, ensure the following are available:
- Netsuke installed (build from source with
cargo build --releaseor install viacargo install netsuke) - Ninja build tool in the system PATH (install via the package manager,
e.g.,
apt install ninja-buildorbrew install ninja)
In a terminal, create a new directory for the project:
mkdir hello-netsuke
cd hello-netsukeA file named Netsukefile should be created with the following content:
netsuke_version: "1.0.0"
targets:
- name: hello.txt
command: "echo 'Hello from Netsuke!' > hello.txt"
defaults:
- hello.txtThis manifest defines:
- A target called
hello.txtthat creates a file with a greeting. - A default target, so running
netsukewithout arguments buildshello.txt.
To build the project, run Netsuke:
netsukeThe output should be similar to:
[1/1] echo 'Hello from Netsuke!' > hello.txt
The result can be verified:
cat hello.txtOutput:
Hello from Netsuke!
This completes the first Netsuke build.
Netsuke supports Jinja templating for dynamic manifests. The Netsukefile can
be updated as follows:
netsuke_version: "1.0.0"
vars:
greeting: "Hello"
name: "World"
targets:
- name: greeting.txt
command: "echo '{{ greeting }}, {{ name }}!' > greeting.txt"
defaults:
- greeting.txtRunning netsuke again:
netsukeThe output can be checked:
cat greeting.txtOutput:
Hello, World!
For more complex builds, Netsuke can process multiple files. Some input files can be created as follows:
echo "Content A" > input_a.txt
echo "Content B" > input_b.txtThe Netsukefile can be updated to process all .txt files:
netsuke_version: "1.0.0"
targets:
- foreach: glob('input_*.txt')
name: "output_{{ item | basename | with_suffix('.out') }}"
command: "cat {{ item }} | tr 'a-z' 'A-Z' > {{ outs }}"
sources: "{{ item }}"
defaults:
- output_input_a.out
- output_input_b.outRunning netsuke:
netsukeThe outputs can be checked:
cat output_input_a.out
cat output_input_b.outThe input files have been transformed to uppercase.
- Read the full User Guide for comprehensive documentation
- Explore the
examples/directory for real-world manifest examples:basic_c.yml— C compilation with rules and variableswebsite.yml— Static site generation from Markdownphoto_edit.yml— Photo processing with glob patterns
- Run
netsuke --helpto see all available options - Try
netsuke graphto visualize the build dependency graph
Ensure the current directory is correct and that a file named Netsukefile
exists. A different manifest path can be specified with -f:
netsuke -f path/to/manifest.ymlInstall Ninja using the system's package manager:
- Ubuntu/Debian:
sudo apt install ninja-build - macOS (Homebrew):
brew install ninja - Windows (Chocolatey):
choco install ninja