Releases: michaelforney/samurai
samurai 1.2
New features
- Subtools
list
,query
, andcommands
are now implemented. - Dry-run execution is now supported (
-n
flag). - The
%o
specifier is now supported inNINJA_STATUS
, used to display the average rate of finished jobs.
Bug fixes
- Fix version comparison when checking
ninja_required_version
with a version that has multiple digits in some component.
Other changes
- Work around POSIX.1-2008 conformance issue on SunOS-based operating systems.
Acknowledgements
This release consists primarily of new features implemented by outside contributors. Thanks to Duncan Overbruck, @periish, Paolo Bonzini, and Ethan Sommer for your contributions!
samurai 1.1
New features
- The
targets
subtool is now implemented. This subtool prints targets built by the project, either by rule name or depth from the final outputs. - The
compdb
subtool is now implement. This subtool dumps a JSON compilation database, as specified in https://clang.llvm.org/docs/JSONCompilationDatabase.html, and allows integration with some IDEs and build tools. - The
NINJA_STATUS
environment variable is now honored, allowing control over what information is included in the status line. - The
-l
flag (scheduling based on load average) is now ignored for compatibility with ninja.
Bug fixes
- When a job specified
depfile
anddeps
, but did not actually write thedepfile
(for example, D compilers with meson), we now write an empty dependency record to.ninja_deps
. This matches ninja's behavior and prevents unwanted rebuilds. - When the manifest is dirty, but a
restat = 1
action causes the manifest rebuild to be pruned, we now continue with the build. This prevents a manifest rebuild loop in these cases (for example with cmake using glob patterns), since the manifest is always dirty after reloading.
Cleanups
- When no
default
line is present inbuild.ninja
, we previously scheduled all targets for building rather than just the root targets (those with no dependents). This makes no difference is practice since we need to build all dependencies before a target anyway, but this was changed in order to implement thetargets
subtool. - We now do a better job at freeing memory when the manifest is rebuilt.
- Some code style inconsistencies were fixed.
Acknowledgements
This release involved the help of a number of people who reported bugs and implemented features. Thanks to Brian Callahan, Daan De Meyer, Ethan Sommer, Rasmus Thomsen, Simon Zeni, and @angularorbit for your contributions!
samurai 1.0
This is primarily a bug-fix release, but since samurai is feature complete and I'm happy with it's current state, I decided to call it 1.0.
New features
- The
-d keepdepfile
and-d keeprsp
debugging options are now supported to allow inspection of the generated dependency file and RSP file respectively.
Bug fixes
- Failed jobs weren't releasing their pool slot. This could cause the build to terminate early when pool depth was 1, and the failure limit (
-k
flag) had not yet been reached. - Dependency files containing more than one
output: input
line would have the first character of the output path skipped on subsequent lines. This would result an error since all lines in the dependency file must refer to the same output path. - Empty paths in build edges (e.g. expanded from an undefined variable) were not getting rejected, causing a NUL byte to be written past the end of the allocation for the path string when it was canonicalized as
.
. - Recursive rule variable definitions were not detected and rejected, causing infinite recursion when attempting to expand them.
Cleanups
- Better error message for dependency log read failure, differentiating unexpected EOF from read error.
- Standard output is now line buffered, even when redirected to a pipe or regular file. This allows incremental progress updates in cases where the output is being saved or piped to another command.
- The Makefile now declares dependencies on header files, so that during development, objects get rebuilt when the headers change.
Acknowledgements
Thanks to rehaby and Frederic Cambus for reporting bugs.
samurai 0.7
New features
- The environment variable
SAMUFLAGS
can now be used to specify default-j
or-v
options. $depfile
and$rspfile
are now removed by theclean
subtool.
Bug fixes
- Console was not getting released when a job using the console pool failed.
- Handle
argv = { NULL }
by settingargv0
to "samu" instead of crashing. $depfile
and$rspfile
paths requiring shell quoting are now handled correctly.- The edge
in
andout
arrays were incorrectly allocating space to store the entire node (72 bytes on 64-bit systems) instead of just the pointer (8 bytes), resulting in excess memory usage.
Memory usage
- Fixing the allocation bug of
in
andout
arrays described above resulted in huge memory savings, roughly 35% in a no-op chromium build. - When evaluating
$in
or$out
with path lists of length 1, re-use the existing string instead of making a copy. - Remove edge variable "cache", which didn't seem to help at all in practice.
Acknowledgements
Thanks to Andreas Baumann for implementing the SAMUFLAGS
feature, Paolo Bonzini and orbea for reporting issues, and Earnestly and Eli Schwartz for testing development builds.
samurai 0.6
New features
- Now compatible with ninja 1.9.0 features.
dupbuild=err
is now the default.- Nanosecond resolution timestamps in
.ninja_deps
(version 4) and.ninja_log
. --verbose
is now a synonym for-v
.-j 0
is now handled by allowing unlimited jobs.
Performance
- Use
getc_unlocked
in scanner, improving parse time considerably for huge inputs such as chromium.
Bug fixes
- Paths in
default
lines weren't getting canonicalized, resulting in an error if the target was not in canonical form (for example,default $builddir/foo
, wherebuilddir = .
). - Escaped newlines weren't getting handled correctly when they appeared in between non-path tokens.
- Lookup variables in rule before parent environment, as documented in the ninja manual (ninja's actual behavior depends on whether an edge has any bindings).
Cleanups
- Rewrote
arg.h
to be simpler. - Updated
tree.c
implementation to new musl version (faster and smaller code). - Rewrote
htab.c
to be simpler and better tailored to our needs. - Simplified error handling a bit.
samurai 0.5
New features
- Windows-style line endings (
\r\n
) are now supported. - Output files with multiple generating actions is now only a warning by default, and
-w dupbuild=err
was added to change it to an error. Although this indicates a bug with the build system, there are a number of projects that don't build without this. - Escapes in dependency Makefile fragments are now supported. The escapes emitted by gcc/clang are not completely invertible, so we just do the best we can here.
- Dependency file parser is now more lenient, accepting rules where the output does not match the output of the ninja action (required by the pnacl-clang wrapper script in chromium), and extra whitespace (required by newer versions of nasm).
- Token scanner was rewritten, resulting in a cleaner API, simpler code, and better error messages.
Bug fixes
- Actions with
restat=1
,generator=1
, no build entry log, and an outdated output were incorrectly treated as not dirty. This only occurs in practice if the build log is manually removed. - Hash table could potentially drop entries with a 0 hash when it was resized (regression in 0.3).
in
member of phony edges was uninitialized, but freed if the manifest needed to be rebuilt.
Cleanups
treefind
was made iterative instead of recursive.- The deps log parser now uses just stdio instead of a weird combination of stdio and POSIX IO.
- The deps log record buffer is now allocated as needed, and is limited to
depsinit
. - POSIX APIs are now used more conservatively (favoring standard C) to make porting easier.
samurai 0.4
New features
- Add support for
--version
option for compatibility with existing higher-level build tools like cmake and meson. - Now builds on macOS, which does not support the POSIX
O_DIRECTORY
orst_mtim
member ofstruct stat
. - Better messages from
-d explain
for missing/invalid dependencies or build log entry.
Bug fixes
- Generator action with no entry in build log was incorrectly considered dirty, causing a re-run of the ninja generation (cmake, meson, etc) on the first build.
- Avoid large stack allocations during
.ninja_deps
processing and when user specified a large maximum number of jobs. - Fix
-k maxfail
handling when multiple jobs fail at the same time (regression in 0.3).
Cleanups
- Prefer C99 functions/types over POSIX in some cases.
- Store modification time internally as
int64_t
for compatibility with future ninja release and to avoidstruct timespec
requirement. - Remove redundant call to
stat
when recording dependencies. - Mark lexing keyword table as
const
to move to read-only section of executable.
Acknowledgements
Thanks to Bernhard Weichel, Jonathan Neuschäfer, Iru Cai, and Emil Velikov for bug reports and/or pull requests!
samurai 0.3
New features
- Add
-d explain
option to explain why outputs get rebuilt.
Bug fixes
- Fix escaping of paths containing
'
. - Fix some incompatibilities with ninja related to newline and comment parsing.
- Write output of failed jobs, even if console is currently in use.
Cleanups
- Use custom binary search tree implementation instead of search.h, simplifying code and removing dependency on XSI.
- Specialize hashtable for string keys, simplifying implementation.
samurai 0.2
New features
- Honor
ninja_required_version
in build files. - Match behavior of newly released ninja 1.8.x.
- Re-run commands which started to write their output, but didn't succeed.
- Close extra copy of write-end of command output pipe in subprocesses.
Bug fixes
- Makefile is now POSIX compliant.
.ninja_log
parsing counted entries incorrectly, preventing recompaction.- Console output was mistakenly suppressed when console job was queued but not running.
- If phony inputs are missing for an edge with
restat = 1
, a garbage mtime was used when calculating mtime.ninja_log
entry.
samurai 0.1
This is the initial release of samurai, supporting most features of ninja 1.7.x.