| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Fix ReadFile() handle leak on read error on Windows.
|
| |
| |
| |
| |
| |
| | |
Small change to fix a file handle leak in case of error.
Also return -EIO instead of -1 to signal read errors, since it
is more consistent with what is happening here.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Long ago ninja disabled stdout buffering. Since then much has changed
and this appears to no longer be needed, while also being actively
harmful. Disabling of stdout buffering is not needed because printing
is done (in LinePrinter::Print) either with WriteConsoleOutput (which
is unaffected by stdout buffering) or by printf followed by fflush.
Meanwhile, the unbuffered printing in the printf case causes dramatic
slowdowns which are most visible in dry-run builds, as documented in
issue #2084.
This fixes issue #2084, finishing off the incomplete buffering fix done
in pull request #2031.
|
|\
| |
| | |
Add 'inputs' tool to print out all inputs for a set of targets
|
| | |
|
|\ \
| | |
| | | |
Filter lines ending with ".c++" in clparser
|
| | |
| | |
| | |
| | |
| | | |
Projects like cap n proto uses c++ extensions and generates a lot of
status noise when running ninja.
|
|\ \ \
| |/ /
|/| | |
Suggest possible cause for hitting cycle limit
|
| | | |
|
|\ \ \
| | | |
| | | | |
disk_interface: Improve the stat cache handling for case sensitive folders on Windows
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
on Windows
The path used as argument to FindFirstFileExA is no longer being converted to lowercase.
By not converting the path to lower case, case sensitive folders will now be handled correctly.
Case insensitive folders still works as expected because casing doesn't matter on those.
All entries in the stat cache remains lowercase to avoid potential cache misses.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The checked in sources (depfile_parser.cc and lexer.cc) have the re2c version
embedded in it. The output didn't change since re2c 1.3, except for the
different version number.
A reproducible build would use a pinned version of re2c anyway, so there
is no need to hardcode its value in the checked in generated files.
|
| | | |
| | | |
| | | |
| | | | |
One in ninja_test usage text, the other in a unit test comment.
|
|\ \ \ \
| |_|/ /
|/| | | |
Add validation nodes to ninja
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
A common problem in the Android build is inserting rules that perform
some sort of error checking that doesn't produce any artifacts needed
by the build, for example static analysis tools. There are a few
patterns currently used, both of which have downsides.
The first is to have a rule that depends on all of the static analysis
results. This ensures they run, but requires running static analysis
over everything, and not just the active parts of the build graph.
The second is to insert the static analysis rule into the build graph
between the artifact producing rule and anything that depends on it,
often copying the artifact as the output of the static analysis rule.
This increases the critical path of the build, often reducing
parallelism. In the case of copying the artifact, it also wastes
disk space.
This patch adds "validation nodes" to edges in Ninja. A build
statement can specify validation nodes using "|@" in the edge
inputs. The validation nodes are not used as an input to the edge
(the edge can run before the validation node is ready), but are
added to the initial nodes of the build graph whenever the edge
is part of the build graph. The edge that outputs the validation
node can depend on the output of the edge that is being validated
if desired.
Test: ninja_test
Change-Id: Ife27086c50c1b257a26509373199664680b2b247
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Refactor Builder::AddTarget to remove an early return in a non-error
case. The next CL will add code that needs to be executed even if the
node is clean.
Change-Id: I953dc54b60b635dd75d75f8f3931970faefc5ecf
|
| | | | |
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
% [`codespell --count --ignore-words-list=fo .`](https://pypi.org/project/codespell/)
```
./ninja/src/missing_deps.cc:119: dependecy ==> dependency
./ninja/src/includes_normalize-win32.cc:51: funcation ==> function
./ninja/src/eval_env.h:58: invokable ==> invocable
./ninja/src/missing_deps_test.cc:155: beacuse ==> because
./ninja/src/deps_log_test.cc:393: unparseable ==> unparsable
```
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously stdout buffering was disabled in the LinePrinter constructor.
This worked for a long time but ultimately this side-effect caused a
performance bug (issue #2018) in tools such as -t deps. Moving the
disabling of buffering into real_main and only disabling buffering
when a tool is not used makes the desired semantics clearer and restores
the lost performance.
This fixes issue #2018. It has been tested and a 10x speedup was seen
relative to the tip-of-tree version.
|
|\ \ \
| | | |
| | | | |
Set output mtime of phony edges to the latest inputs
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This commit fixes issue #478.
Observed:
Real edges depending on a phony edge will not be marked as dirty or
rebuilt if the phony's (real) inputs are updated.
Expected:
An edge should always be rebuilt if its inputs or transitive inputs are
newer than the output's mtime.
Change:
Node::mtime_ was overloaded, 0 represented "does not exist". This change
disambiguates it by adding Node::exists_. Then to fix the observed
behaviour, Node::UpdatePhonyMtime was added to update the mtime if the
node does not exist.
Add tests BuildTest.PhonyUseCase# GraphTest.PhonyDepsMtimes.
Unit tests will also test for always-dirty behaviour if a phony rule has
no inputs.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
remove() deletes both files and directories. On Windows we have to
select the correct function (DeleteFile will yield Permission Denied
when used on a directory)
This fixes the behavior of ninja -t clean in some cases
https://github.com/ninja-build/ninja/issues/828
|
|\ \ \ \
| | | | |
| | | | | |
Optimize ninja -d stats
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
-d stats enables instrumented profiling of key functions in ninja.
However, some of those functions are invoked 6+ million times in a NOP
build of Chromium and the cost of measuring those functions dwarfs the
cost of the functions. Here is typical -d stats output for a Chromium
build:
metric count avg (us) total (ms)
.ninja parse 6580 4197.5 27619.5
canonicalize str 6240450 0.0 47.3
canonicalize path 6251390 0.0 33.5
lookup node 6339402 0.0 37.2
.ninja_log load 1 176226.0 176.2
.ninja_deps load 1 465407.0 465.4
node stat 168997 8.8 1482.9
depfile load 327 352.7 115.3
99% of the measurements are in three functions. The total measurement
cost (per ETW sampled profiling) is 700-1200 ms, which is many times
greater than the costs of the functions.
With this change typical output looks like this:
metric count avg (us) total (ms)
.ninja parse 6580 3526.3 23203.2
.ninja_log load 1 227305.0 227.3
.ninja_deps load 1 485693.0 485.7
node stat 168997 9.6 1615.0
depfile load 327 383.1 125.3
This resolves issue #1998.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Look up header dependencies on the first-output build
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Ninja has special syntax to specify the first output of the given node.
E.g. it builds foo.o for foo.cc^. However, it doesn't work for
headers, as headers usually doesn't appear in the regular dependency
tree.
After this change, Ninja looks up header dependencies from .ninja_deps
to pick up a build target, so that it builds foo.o for foo.h^.
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
cleandead: Fix the logic to preserve inputs.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
In the rare case when the build log contains an entry for
a file path that used to be an output in a previous build,
but was moved as an input in the new one, the cleandead tool
would incorrectly consider the input file stale and remove it.
This patch fixes the logic used in Cleaner::CleanDead to not
remove any path that is an input in the build graph.
|
|/ / / / / |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The /showIncludes output always comes after cl.exe echos the filename,
so there is no need to filter out filename lines afterwards.
This makes it less likely that CLParser will "over filter" the compiler
output. For example, using the -H flag with clang-cl may lead to output
lines ending in .cc, which are not supposed to be filtered out.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
util: Remove unnecessary CanonicalizePath error handling
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Since commit 86f606fe (Remove path component limit from input of
CanonicalizePath in windows, 2017-08-30, v1.8.0^2~2^2), the only failure
case in the `CanonicalizePath` implementation is the "empty path" error.
All call sites have been updated to ensure `CanonicalizePath` is never
called with an empty path. Remove error handling from the signature to
simplify call sites.
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | | |
Update call sites that might have empty paths to explicitly check for
them before calling CanonicalizePath. Note that the depfile parser
ensures all parsed outs and deps are non-empty.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | | |
See comment in #1899. Also adds two tests to output_test.py which check
this behaviour by relying on Python's suprocess.check_output not piping
stderr.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
This just ensures that we also don't get the "Entering directory..." message
when the new '--quiet' flag is added.
|
| | | |
| | | |
| | | |
| | | | |
Signed-off-by: Henner Zeller <h.zeller@acm.org>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Refined pull request after discussion in #1816
Signed-off-by: Henner Zeller <h.zeller@acm.org>
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
In an earlier version of 791c887e22046e5e7a2d05ecb5ff27701d56895d those
functions returned LoadStatus, too, but it was changed back to bool.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When a path loaded from a depfile does not have a node, we create a new
node with a phony edge producing it. If we later load a dyndep file
that specifies the same node as an output of a known edge, we previously
failed with a "multiple rules generate ..." error. Instead, since the
conflicting edge was internally generated, replace the node's input edge
with the now-known real edge that produces it.
|
| | | |
| | | |
| | | |
| | | | |
Previously this was covered only as part of more complex tests.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
These expose some behavior related to implicit deps unknown to ninja and
timestamps with generating them as part of a rule.
See discussions in #1932 and #1933.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This reverts commit 67fbbeeec91ec171da7d4e297b8f9b319f3424c8.
There were a few missing test cases exposed by CMake's test suite that
need slight adjustments. Better to revert the original attempt, add the
test cases, and then re-land the change with the fixes.
Fixes #1932
|
| | | |
| | | |
| | | |
| | | | |
This is step 4 on #931.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
If an edge's output files' mtimes are compared to the most recent
input's mtime, edges might be calculated as clean even if they are
actually dirty. While an edge's command is running its rule to produce
its outputs and an input to the edge is updated before the outputs are
written to disk, then subsequent runs will think that the outputs are
newer than the inputs, even though the inputs have actually been updated
and may be different than what were used to produce those outputs.
Ninja will now restat all inputs just prior to running an edge's command
and remember the most recent input mtime. When the command completes,
it will stat any discovered dependencies from dep files (if necessary),
recalculate the most recent input mtime, and log it to the build log
file. On subsequent runs, ninja will use this value to compare to the
edge's most recent input's mtime to determine whether the outputs are
dirty.
This extends the methodology used by restat rules to work in all cases.
Restat rules are still unique in that they will clean the edge's output
nodes recursively if the edge's command did not change the output, but
in all cases, the mtime recorded in the log file is now the most recent
input mtime. See the new tests for more clarification.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The ANSI code page identifier is more information than generator
programs actually need. The encoding of `build.ninja` is always
either UTF-8 or the system-wide ANSI code page. Reduce the output
to provide no more information than the generator programs need.
The Console code page can be obtained in other ways, so drop it.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Since commit 00459e2b (Use UTF-8 on Windows 10 Version 1903, fix #1195,
2021-02-17), `ninja` does not always expect `build.ninja` to be encoded
in the system's ANSI code page. The expected encoding now depends on
how `ninja` is built and the version of Windows on which it is running.
Add a `-t wincodepage` tool that generators can use to ask `ninja`
what encoding it expects.
Issue: #1195
|
|\ \ \ \
| | | | |
| | | | | |
missingdeps tool, take 2
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In my tests, nested maps outperform a large map of pairs by 10-20% on a
sample Chromium missingdeps run, and are arguably simpler due to fewer
ifdefs needed.
|
| | | | |
| | | | |
| | | | |
| | | | | |
A "missing dep path" to build.ninja is a false positive, skip reporting it.
|