| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |\ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
added missing include guards in order to support easy amalgamation
|
| |/ / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
These changes make it easy to build an amalgamated `ninja.cc` that
can be used to bootstrap ninja with just a working C++ compiler, without
the need for any third-party tools like `cmake` or `python`.
*nix
c++ -O2 src/ninja_amalgamated.cc -o ninja
osx-cross
x86_64-apple-darwin19-c++ -O2 src/one.cc -o ninja
mingw
x86_64-w64-mingw32-c++ -O2 src/ninja_amalgamated.cc -o ninja.exe
msvc
cl.exe /nologo /Ox /GR- src\ninja_amalgamated.cc /out:ninja.exe
|
| | | | | | | | |
|
| | | | | | | | |
|
| |\ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
README.md: document Manual and Doxygen generation
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Fixes #2362
|
| |\ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
Add a dark mode to the docs
|
| | | | | | | | | | |
|
| |\ \ \ \ \ \ \ \ \
| | |_|/ / / / / / /
| |/| | | | | | | | |
correction to #2360
|
| |/ / / / / / / /
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
in general, flags check have to be to the non-no option.
Updates use of deprecated CMake command.
|
| |\ \ \ \ \ \ \ \
| | |/ / / / / / /
| |/| | | | | | | |
[FIX] compile: gcc version > 11.3, treat -Wmaybe-uninitialized as error
|
| | | | | | | | | |
|
| |\ \ \ \ \ \ \ \
| | |/ / / / / / /
| |/| | | | | | | |
CanonicalizePath: Remove kMaxComponents limit
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
This patch refactors the CanonicalizePath() to fix
two issues and improve performance. This is achieved
through the following:
- Remove the kMaxPathComponents limit entirely,
which fixes ninja-build#1732, by dropping the
`components` array entirely, in favor of
back-tracking the destination pointer.
- Properly handle '/' and '\' which were incorrectly
converted into an empty string. This fixes
ninja-build#2008.
- Skip initial '../' components in relative paths,
as these are common when referencing source files
in build plans, and doing so make the loop after
this step run faster in practice since most
source files do not need adjustments.
- Simplify the inner loop logic by handling the
last component (which is not followed by a
trailing directory separator) separately.
This noticeably improves performance because
the inner loop becomes smaller with less branch
mis-predictions in the general case.
- Never access or copy the caharacter after the
end of the input string.
- Use memchr() to find the next '/' on Posix, which
allows the use of SIMD implementations provided by
the C runtime (e.g. through IFUNC functions on Linux),
resulting in very noticeable speedup. This is also
why a statically Ninja executable will be slower
than one that links to the C library dynamically :-/
- Avoid performing any writes when the input path
doesn't need any adjustment, which is also quite
common.
Note that this patch does _not_ remove the 64-bit
limit for the `slash_bits` value, which is only
used on Win32.
Benchmarking was done in several ways:
- On Linux, running `hyperfine canon-perftest` to run the
canonicalization benchmark program and measure its total
running time. Three compilers were used to generate
dynamically-linked executables.
```
BEFORE (ms) AFTER (ms)
GCC 13.2.0 651 369
Clang 14.0 591 402
Clang 18,0 653 400
```
- On Windows, running `canon-perftest` 5 times and keeping
the best reported average result. The number are slower
since they only measure the benched function.
```
BEFORE (ms) AFTER (ms)
Mingw64 GCC 12 246 195
```
- On Linux, run `hyperfine ninja -C out/default -n --quiet`
on a large Fuchsia build plan, once with 70000+ pending
commands, and once after the build (i.e. `ninja: no work to do`).
````
BEFORE (s) AFTER (s)
pre_build 8.789 8.647
post_build 6.703 6.590
```
|
| |\ \ \ \ \ \ \ \
| | |/ / / / / / /
| |/| | | | | | | |
Remove `-w dupbuild` completely, always error on duplicate edges
|
| | | | | | | | | |
|
| | | |_|_|/ / /
| | |/| | | | |
| | | | | | | |
| | | | | | | | |
Step 5, fixes #931.
|
| |\ \ \ \ \ \ \
| | |/ / / / / /
| |/| | | | | | |
metrics: use chrono to convert ticks to micros
|
| | | |_|_|_|/
| | |/| | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This was previously causing undefined behavior, as multiplying dt by 1000000
overflowed on some systems. Fixes #2301.
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Fix stats report
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
This is already done in RealDiskInterface::Stat() itself,
and removes a confusing duplicate line in `-d stats` output,
e.g.:
BEFORE:
metric count avg (us) total (ms)
...
node stat 119145 3.0 355.2
node stat 270673 3.1 834.9
AFTER:
metric count avg (us) total (ms)
...
node stat 270673 2.9 774.0
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Because Parser::Load() is called recursively during Ninja
manifest parsing, the call to METRIC_RECORD() in this function
used to over-count the total parsing time (for example, by a
factor of 2 for the Fuchsia build).
This fixes the problem by introducing a new RECORD_METRIC_IF()
macro, which only records anything if a given condition is true.
This ensures that metric collection only starts and stops with
the outer Parser::Load() call, and none of its recursive
sub-calls.
The effect on the output of `-d stats`is, for a Fuchsia build
plan where `ninja -d stats nothing` takes a bit more than 5s:
BEFORE:
metric count avg (us) total (ms)
.ninja parse 27304 372.6 10172.2
AFTER:
metric count avg (us) total (ms)
.ninja parse 1 4165297.0 4165.3
Note that |count| went to 1, since there is only one top-level
Parser::Load() operation in this build. It would be more if
dyndeps files were loaded, which does not happen in this
build plan.
|
| |\ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
fix garbled error message, like Chinese in Windows
|
| | | | | | | | | |
|
| |\ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
Use GoogleTest instead of our own framework
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This fixes the case where GTEST_ROOT is set to point to a local
GoogleTest installation (see example below).
Note that this needs a work-around for a subtle GTest 1.10.0:
- When downloading, building then installing googletest-1.10.0,
the installation directory contains CMake files that are
picked later by Ninja's find_package() function properly,
and which define the GTest::gtest target.
This is the target name that should be used by projects
that depend on GoogleTest, per the official documentation.
- When instead 1.10.0, i.e. the same version, is downloaded
and used locally with FetchContent_Declare() +
FetchContent_MakeAvailable(), then only the `gtest` target
will be defined.
This was fixed in 1.11.0, where this use case properly
defines GTest::gtest instead.
The work-around checks for the definition of GTest::gtest
after the FetchContent_MakeAvailable(googletest) call. If
not defined, an alias to `gtest` is created instead.
This ensures the code works with more recent GoogleTest
releases as well.
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | |\ \ \ \ \ \ \ \ |
|
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | | |
src/missing_deps_test.cc:36:5: error: returning a value from a constructor
36 | ASSERT_EQ("", err);
| ^~~~~~~~~
|
| | |\ \ \ \ \ \ \ \ \ |
|
| | | | | | | | | | | | |
|
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | | |
Fixes #1248.
|
| |\ \ \ \ \ \ \ \ \ \ \
| | | | | | | | | | | | |
| | | | | | | | | | | | | |
Fix typo
|
| |/ / / / / / / / / / /
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | | |
Amends a744eea2b6c9b37024b12e749e61170e5c87d171.
|
| |\ \ \ \ \ \ \ \ \ \ \
| | | | | | | | | | | | |
| | | | | | | | | | | | | |
Remove phony edges for nodes created by a dependency loader.
|
| |/ / / / / / / / / / /
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | | |
This patch simplifies Ninja internals without modifying
its behavior. It removes the creation (and removal) of phony
edges as producers for nodes loaded by dependency loaders, i.e.
coming from depfiles, dyndep files or the deps log.
These edges were only used to ensure the build did not
abort when these files are missing, unlike regular source
inputs. This can be easily checked by adding a new flag to
the Node class instead. This makes it easier to reason about
how Ninja works internally.
More specifically:
- Move the generated_by_dep_loader_ flag from the Edge class
to the Node class. The flag is true by default to minimize
changes to the source code, since node instances can be
first created by reading the deps or build logs before
the manifest itself.
- Modify Plan::AddSubTarget() to avoid aborting the build
when a generated-by-deploader node is missing. Instead
the function exits immediately, which corresponds to
what happened before.
- State::AddOut(), State::AddIn(), State::AddValidation():
Ensure that nodes added by these methods, which are
only called from the manifest parser and unit-tests
set the |generated_by_dep_loader_| flag to false, to
indicate that these are regular input / output nodes.
- ManifestParser::ParseEdge(): Add an assertion verifying
that the dyndep file is marked as a regular input.
- DyndepLoader::UpdateEdge(): Remove code path that
looked for phony in-edges and ignored them.
- DepLoader::CreatePhonyInEdge() is removed as no
longer necessary.
+ Update a few places in unit-tests that were checking
for the creation of the phony edges.
Fuchsia-Topic: persistent-mode
Change-Id: I98998238002351ef9c7a103040eb8a26d4183969
|
| |\ \ \ \ \ \ \ \ \ \ \
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | | |
taminob/bugfix/2342/remove-no-work-to-do-output-with-quiet
Do not print 'no work to do' with --quiet
|
| | | | | | | | | | | | | |
|
| | | | | | | | | | | | | |
|
| |\ \ \ \ \ \ \ \ \ \ \ \
| | |/ / / / / / / / / / /
| |/| | | | | | | | | | | |
Add a check for re2c version
|
| | | | | | | | | | | | | |
|
| |/ / / / / / / / / / / |
|
| |\ \ \ \ \ \ \ \ \ \ \
| | |_|_|/ / / / / / / /
| |/| | | | | | | | | | |
Replace pipes.quote with shlex.quote in configure.py
|
| | | | | | | | | | | | |
|
| | | |_|_|_|_|_|_|_|/
| | |/| | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | | |
Python 3.12 deprecated the pipes module and it will be removed
in Python 3.13. In configure.py, I have replaced the usage of pipes.quote
with shlex.quote, which is the exactly same function as pipes.quote.
For more details, refer to PEP 0594: https://peps.python.org/pep-0594
|
| |\ \ \ \ \ \ \ \ \ \
| | |/ / / / / / / / /
| |/| | | | | | | | | |
Ensure tests do not leave stale files in current directory.
|