• Stars
    star
    268
  • Rank 153,144 (Top 4 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

n2 ("into"), a ninja compatible build system

n2, an alternative ninja implementation

CI status

n2 (pronounced "into") implements enough of Ninja to successfully build some projects that build with Ninja. Compared to Ninja, n2 missing some features but is faster to build and has a better UI; see a more detailed comparison.

Here's a small demo of n2 building some of Clang.

Install

$ cargo install --git https://github.com/evmar/n2
# (installs into ~/.cargo/bin/)

$ n2 -C some/build/dir some-target

Using with CMake

When CMake generates Ninja files it attempts run a program named ninja with some particular Ninja behaviors. In particular, it attempts to inform Ninja/n2 that its generated build files are up to date so that the build system doesn't attempt to rebuild them.

n2 can emulate the expected CMake behavior when invoked as ninja. To do this you create a symlink named ninja somewhere in your $PATH, such that CMake can discover it.

  • UNIX: ln -s path/to/n2 ninja
  • Windows(cmd): mklink ninja.exe path\to\n2
  • Windows(PowerShell): New-Item -Type Symlink ninja.exe -Target path\to\n2

Warning
If you don't have Ninja installed at all, you must install such a symlink because CMake attempts to invoke ninja itself!

The console output

While building, n2 displays build progress like this:

[=========================---------       ] 2772/4459 done, 8/930 running
2s Building foo/bar
0s Building foo/baz

The progress bar always covers all build steps needed for the targets, regardless of whether they need to be executed or not.

The bar shows three categories of state:

  • Done: The = signs show the build steps that are already up to date.
  • In progress: The - signs show steps that are in-progress; if you had enough CPUs they would all be executing. The 8/930 running after shows that n2 is currently executing 8 of the 930 available steps.
  • Unknown: The remaining empty space indicates steps whose status is yet to be known, as they depend on the in progress steps. For example, if an intermediate step doesn't write its outputs n2 may not need to execute the dependent steps.

The lines below the progress bar show some build steps that are currrently running, along with how long they've been running. Their text is controlled by the input build.ninja file.

More reading

I wrote n2 to explore some alternative ideas I had around how to structure a build system. In a very real sense the exploration is more important than the actual software itself, so you can view the design notes as one of the primary artifacts of this.

More Repositories

1

retrowin32

windows emulator
Rust
421
star
2

webtreemap

web-based treemap
TypeScript
347
star
3

c-repl

a C read-eval-print loop (abandoned)
Haskell
201
star
4

weave

wasm viewer
TypeScript
136
star
5

bloat

analyze code size via nm/objdump output
Python
78
star
6

go-imap

golang IMAP client library
Go
73
star
7

pocket-mini

Save to Pocket (mini), a Chrome extension for https://getpocket.com
JavaScript
44
star
8

jelly

jelly no puzzle in html5
JavaScript
39
star
9

smash

a new kind of terminal
TypeScript
38
star
10

gocairo

autogenerated full golang bindings for cairo
Go
37
star
11

js-min-bench

benchmarking js minifiers
HTML
30
star
12

git-cl

a git-command for integrating reviews on Rietveld
Python
26
star
13

cms

tiny content management system I use for my website, unlikely of interest to anyone else
Go
18
star
14

j8t

javascript minifier
Rust
14
star
15

hp

generate graphs from google-perftools heap profiles
Go
13
star
16

envelope

python script to generate envelopes
Python
13
star
17

webkit-who

webkit committers analysis
JavaScript
12
star
18

sfpng

straightforward minimal PNG decoder
C
12
star
19

config

dotfiles, not interesting to anyone but me
Emacs Lisp
11
star
20

lmnopuz

web-based crosswords (stagnant)
JavaScript
10
star
21

maddr

simple addr2line reimplementation
C++
10
star
22

lines-spent

datavis of commit changes
JavaScript
9
star
23

gat

git clone in haskell
Haskell
9
star
24

v8c

C bindings for V8 (abandoned)
C++
9
star
25

gen

golang basic lexer + lr parser generator
Go
9
star
26

sclang

header into s-expressions via clang
C++
8
star
27

fin

financial analysis
TypeScript
8
star
28

goblizzard

golang parsers for blizzard data formats
Go
6
star
29

goodbye-lj

scripts to archive and delete livejournal posts
Python
6
star
30

picasync

download picasa (google+) albums
Go
6
star
31

buildbot-error

Chrome extension to add a "next error" link to Chromium buildbot output
JavaScript
6
star
32

devhelp-index

command line (emacs) interface into devhelp
Python
6
star
33

proximo

Android app for public transit arrival times
Java
5
star
34

muni

SF muni arrival time server and Android app
Python
4
star
35

keyring-dump

quick script to dump gnome keyring
Python
4
star
36

edit-locally

quick hack to edit chrome codesearch results in local emacs
Python
4
star
37

snapz

simple screenshooting app
C
4
star
38

whisper

playing around with OpenAI Whisper
C
4
star
39

HarfBuzz-ng

Patches for the HarfBuzz rewrite
C
4
star
40

lytics

analytics without the ad network
TypeScript
3
star
41

route

simple golang url router
Go
3
star
42

h8

Haskell bindings for v8
Haskell
3
star
43

pony-express

chrome extension to prettify online mailing list archives
CoffeeScript
3
star
44

terminfo

terminfo parser for go
Go
3
star
45

python-sourcemap

python module for parsing javascript source maps
Python
3
star
46

pjs

paren js
JavaScript
3
star
47

focus

script to block time-wasting sites (news.yc, reddit, techmeme, etc.)
Shell
3
star
48

chrome-textfix-ext

A Chrome extension to add a context menu item to make body text readable.
JavaScript
3
star
49

onscreen

image cycler for wall displays
Python
2
star
50

flatzip

create mtime-equivalent directory mirror with files filled with zeros
Go
2
star
51

states

compare US states and EU countries
TypeScript
2
star
52

git-ffwd

script to forward-port old branches
Shell
2
star
53

cute-sideload

cute overload feed without the creepy babytalk
Ruby
2
star
54

diff

crostini diff tool
Go
1
star
55

hscairo

Cabalized version of gtk2hs's Cairo bindings
Haskell
1
star
56

evmar.github.io

github pages
HTML
1
star
57

tjs

Just screwing around with unification, nothing interesting to see.
JavaScript
1
star
58

tsparse

dump TypeScript lexical AST
JavaScript
1
star
59

evanhacks

random hacks on app engine
Go
1
star
60

peek

TypeScript
1
star
61

rietveld

Mirror of Rietveld, the App Engine code review site
1
star
62

rust-toys

toy apps to play with the rust language
Rust
1
star
63

HarfBuzz

Chrome-specific Harfbuzz patches
1
star
64

discord-clean

delete entries on discord
Go
1
star
65

martine.github.io

github web pages
HTML
1
star
66

chrome-readability

arc90's Readability bookmarklet as a Chrome extension
1
star