News for hackers. Stuff that matters.
Re:Ninja: A simple way to do builds by chovyfu on Tuesday October 27, 2020 @01:29AM (#24904698)
That's just BASH with extra steps.
Re:Ninja: A simple way to do builds by flohofwoe on Tuesday October 27, 2020 @12:22PM (#24908920)
Ninja hasn't been created for small one-liners like in this blog post, but for massive C++ builds with tens- or hundreds-of-thousands of source files arranged in a complex dependency tree.

Figuring out quickly what needs to be rebuilt for massive builds like this isn't trivial, but that's essentially the one important thing that ninja does.

Also see:

https://ninja-build.org/manual.html#_design_goals

Re:Ninja: A simple way to do builds by AtlasBarfed on Tuesday October 27, 2020 @12:33PM (#24909045)
... What mechanism is used to perform incremental builds? It is referenced in the article and unexplained from what I can tell. What enables "quickly" for you to determine what needs to be built? Make simply compares timestamps I believe.

... What mechanisms/tricks speed up builds? Or is it just the "simplicity" that is the BFD?

Edit: It sure would have been helpful if somewhere was stated: "the build system of Chrome":-)

That statement indicates a huge difference between some rando build system on someone's personal project, and a build system on operating-system-size codebase that is over a decade old.

Re:Ninja: A simple way to do builds by bla3 on Tuesday October 27, 2020 @12:59PM (#24909349)
http://www.aosabook.org/en/posa/ninja.html is a book chapter in why ninja is fast.
Re:Ninja: A simple way to do builds by DerDangDerDang on Tuesday October 27, 2020 @02:09PM (#24910133)
I'm not sure it's the responsibility of others to ensure you have enough information not to look silly in a hasty post ;)
Re:Ninja: A simple way to do builds by busrf on Tuesday October 27, 2020 @12:37PM (#24909087)
Ninja uses time stamps. See the “Comparison to Make” section in the linked manual.
Re:Ninja: A simple way to do builds by sbierwagen on Tuesday October 27, 2020 @06:30PM (#24912784)
Isn't using mtime a bad idea? https://news.ycombinator.com/item?id=18473744
Re:Ninja: A simple way to do builds by slavik81 on Tuesday October 27, 2020 @10:10PM (#24914278)
No? The top comment in that thread is the author of Ninja discussing how he addressed the problems described in the article. And, despite its title, the article itself goes on to discuss why and how to use mtime in a build system.
Re:Ninja: A simple way to do builds by bla3 on Tuesday October 27, 2020 @12:15PM (#24908862)
The advantage are the incremental builds they mention. If just one input file changes and you run ninja again, it'll only re-run one step instead of converting all files again.
Re:Ninja: A simple way to do builds by m000 on Tuesday October 27, 2020 @01:47PM (#24909900)
I'm pretty sure make does that too. The problem is that most people don't know how to write a proper Makefile, even for a simple project, so make ends up doing more work than it should. For small projects, I've tried ninja a while ago, and frankly the effort seemed unjustified, since (a) I already could do the same things with make, and (b) make is already available on most unix-likes.

Ninja seems to be better suited for big projects, where make's slowness in dependency resolution shows. Ninja files also look easier to generate automatically.

Re:Ninja: A simple way to do builds by iainmerrick on Tuesday October 27, 2020 @09:13PM (#24913917)
Yes, Ninja files are very easy to generate, that’s it’s big selling point for me.

I have a project with dozens of C/C++/asm/precompiled libraries, a few thousand source files in all.

I would have trouble writing Makefile(s) for everything that would even be correct, let alone performant, either by hand or generated. But I have a set of Python scripts to generate a big Ninja build file and it all works very nicely.

Re:Ninja: A simple way to do builds by datashaman on Tuesday October 27, 2020 @04:56AM (#24905576)
Correct, simple.