Commit Graph

2780 Commits

Author SHA1 Message Date
Jan Niklas Hasse
d68f107f7a
Merge pull request #1979 from bradking/simplify-CanonicalizePath
util: Remove unnecessary CanonicalizePath error handling
2021-06-10 22:19:07 +02:00
Jan Niklas Hasse
cd967ab21e Make output_test.py executable again (mistake thanks to WSL) 2021-06-10 21:30:10 +02:00
Jan Niklas Hasse
0843ae8746 Put Info output back on stdout instead of stderr
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.
2021-06-10 21:25:45 +02:00
Brad King
91706b323f 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.
2021-06-04 11:17:52 -04:00
Brad King
f2f62e295a Add explicit "empty path" errors before calling CanonicalizePath
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.
2021-06-04 11:17:46 -04:00
Jan Niklas Hasse
8fa4d05fea
Merge pull request #1977 from mathstuf/cross-compilation-browse
cmake: use `check_symbol_exists` for browse support
2021-06-04 15:48:58 +02:00
Ben Boeckel
54c5759471 cmake: use check_symbol_exists for browse support
Just because `unistd.h` exists does not mean it has the APIs that are
needed. This occurs when cross-compiling using Fedora's packaged MinGW
toolchain.
2021-06-02 11:08:10 -04:00
Jan Niklas Hasse
c573f6b8b2
Merge pull request #1970 from lurch/patch-2
Attempt to fix Linux CI build
2021-05-18 21:19:52 +02:00
Andrew Scheller
8a3af294fd
Attempt to fix Linux CI build 2021-05-16 21:09:38 +01:00
Jan Niklas Hasse
0a632d11eb
Merge pull request #1968 from EliRibble/pull-1818
Add --quiet option that suppresses status updates. (rework pull 1818)
2021-05-08 19:40:03 +02:00
Eli Ribble
f926cd4503 Add test for status suppression under '--quiet'.
This just tests that the flag works.
2021-05-06 09:31:11 -07:00
Eli Ribble
770459d26f Add jhasse's suggestion to suppress output on '--quiet'.
This just ensures that we also don't get the "Entering directory..." message
when the new '--quiet' flag is added.
2021-05-06 09:26:40 -07:00
Henner Zeller
21a0834e89 Update help description for --quiet
Signed-off-by: Henner Zeller <h.zeller@acm.org>
2021-05-06 09:22:29 -07:00
Henner Zeller
a567ebb6ef Add --quiet option that suppresses status updates.
Refined pull request after discussion in #1816

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2021-05-06 09:22:26 -07:00
Jan Niklas Hasse
ce700488e0 Avoid implicit cast LoadStatus -> bool 2021-04-09 17:08:39 +02:00
Jan Niklas Hasse
721f5e9342 Fix misleading usage of return type of Open*Log
In an earlier version of 791c887e22 those
functions returned LoadStatus, too, but it was changed back to bool.
2021-04-09 13:45:25 +02:00
Jan Niklas Hasse
3d33ca89d2
Merge pull request #1944 from EwoutH/patch-1
CI: macOS: Unfix Xcode version to use the latest stable one
2021-03-29 08:48:55 +02:00
Ewout ter Hoeven
5780728a60
CI: macOS: Unfix Xcode version to use the latest stable one
Removes the selection of a fixed Xcode version added in 242b7dd which assured Xcode version 12.2 was used when the default was still 12.1. The GitHub default is now 12.4 and newer versions will be made the default a few weeks after the stable release. This commit ensures an up to date Xcode version is used in the CI.
2021-03-29 01:30:25 +02:00
Jan Niklas Hasse
9a40ec2f1f
Merge pull request #1937 from bradking/dyndep-out-depfile-in
dyndep: reconcile dyndep-specified outputs with depfile-specified inputs
2021-03-28 12:20:42 +02:00
Brad King
fa577b6d53 dyndep: reconcile dyndep-specified outputs with depfile-specified inputs
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.
2021-03-24 17:13:32 -04:00
Brad King
a5b1780487 dyndep: add dedicated test for dyndep-discovered implicit dependencies
Previously this was covered only as part of more complex tests.
2021-03-24 15:38:30 -04:00
Jan Niklas Hasse
8cd25aa78c
Merge pull request #1935 from jdrouhard/revert_input_mtime
Revert #1753 and add additional tests to expose previously untested behavior
2021-03-24 16:22:08 +01:00
John Drouhard
ef2ae300a8 Add some regression tests for additional test cases
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.
2021-03-24 08:50:00 -05:00
John Drouhard
b51a3e83ff Revert "Change build log to always log the most recent input mtime"
This reverts commit 67fbbeeec9.

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
2021-03-24 08:49:58 -05:00
Jan Niklas Hasse
db6c4ac476 Remove -w dupbuild from error message and help output
This is step 4 on #931.
2021-03-20 15:18:53 +01:00
Jan Niklas Hasse
2b97efa4a9
Merge pull request #1753 from jdrouhard/log_input_mtime
Change build log to always log the most recent input mtime
2021-03-20 15:07:25 +01:00
John Drouhard
67fbbeeec9 Change build log to always log the most recent input mtime
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.
2021-03-16 18:39:31 -05:00
Jan Niklas Hasse
ac0fe07d9e
Merge pull request #1907 from aDotInTheVoid/patch-1
Clarify purpose for implicit dependencies
2021-03-05 22:51:32 +01:00
Jan Niklas Hasse
0c11d6e4dc
Merge pull request #1921 from bradking/windows-code-page-utf8
wincodepage: minimize to indicate UTF-8 or not
2021-03-04 18:19:13 +01:00
Brad King
a510f532f6 wincodepage: minimize to indicate UTF-8 or not
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.
2021-03-01 13:05:46 -05:00
Jan Niklas Hasse
1a8015038d
Merge pull request #1918 from bradking/windows-code-page
Add tool to print code page information on Windows
2021-02-26 17:08:19 +01:00
Brad King
706e16bee5 Add tool to print code page information on Windows
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
2021-02-26 10:31:27 -05:00
Brad King
212cd97679 doc: fix format of 'missingdeps' documentation
Group all the paragraphs together in the definition list entry.
2021-02-26 10:31:27 -05:00
Jan Niklas Hasse
100efbaf55
Merge pull request #1916 from scivision/check_msg
cmake: add browse check status
2021-02-23 23:01:06 +01:00
Michael Hirsch
aa9317e42f
cmake: add browse check status 2021-02-23 14:36:15 -05:00
Jan Niklas Hasse
5c93343406
Merge pull request #1331 from ilor/missingdeps3
missingdeps tool, take 2
2021-02-23 10:08:48 +01:00
Jan Niklas Hasse
ec8de9c247
Merge pull request #1915 from jhasse/windows-utf8
Use UTF-8 on Windows 10 Version 1903, fix #1195
2021-02-23 10:00:23 +01:00
Tomasz Śniatowski
6c89e596ee missingdeps: use nested maps for edge adjacency cache
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.
2021-02-22 23:48:58 +01:00
Tomasz Śniatowski
b94a891ac9 missingdeps: add exception for targets that dep on build.ninja
A "missing dep path" to build.ninja is a false positive, skip reporting it.
2021-02-22 23:48:58 +01:00
Tomasz Śniatowski
bc69a640de Add manual entry about the missingdeps tool 2021-02-22 23:48:58 +01:00
Tomasz Śniatowski
3030254733 Add a -t missingdeps tool to detect some classes of build flakes
The tool looks for targets that depend on a generated file, but do not
properly specify a dependency on the generator. It needs to be run after
a successful build, and will list all potential flakes that may have
broken the build, but didn't due to accidental build step ordering.

The search relies on the correctness of depfile and generator output
information, but these are usually easier to get right than dependencies.

The errors found can usually be verified as actual build flakes by trying
to build the listed problematic files alone in a clean build directory.
Such builds usually fail with a compile job lacking a generated file.

There is some overlap between this tool and 'gn check', but not everyone
uses gn, not everyone using gn uses gn check, and most importantly, gn
check is more about modularity, and less about actual build-time deps
without flakes.

The tool needs to be run after a build completes and depfile data is
collected. It may take several seconds to process, up to a dozen or
two on a large, chromium-sized build.
2021-02-22 23:48:58 +01:00
Tomasz Śniatowski
d0489c3863 Refactor depfile loading in preparation for the missingdeps tool
Extract an usable helper to load depfile dependencies without adding them
to the graph.
2021-02-22 23:48:58 +01:00
Jan Niklas Hasse
c83f00c8a6
Merge pull request #1911 from eszlari/cmake-cleanup
cmake: add_compile_options / PROJECT_SOURCE_DIR
2021-02-22 23:31:17 +01:00
Jan Niklas Hasse
e77c5615b9
Merge pull request #1899 from colincross/status_for_serialize
Status changes to support frontends
2021-02-22 23:06:28 +01:00
Jan Niklas Hasse
00459e2b44 Use UTF-8 on Windows 10 Version 1903, fix #1195
Allows Ninja to use descriptions, filenames and environment variables
with characters outside of the ANSI codepage on Windows. Build manifests
are now UTF-8 by default (this change needs to be emphasized in the
release notes).

WriteConsoleOutput doesn't support UTF-8, but it's deprecated on newer
Windows 10 versions anyway (or as Microsoft likes to put it: "no longer
a part of our ecosystem roadmap"). We'll use the VT100 sequence just as
we do on Linux and macOS.

https://docs.microsoft.com/en-us/windows/uwp/design/globalizing/use-utf8-code-page
https://docs.microsoft.com/en-us/windows/console/writeconsoleoutput
https://docs.microsoft.com/de-de/windows/console/console-virtual-terminal-sequences
2021-02-17 21:59:20 +01:00
Jan Niklas Hasse
9c66e69846
Merge pull request #1913 from bradking/windows-remove
Restore toleration of missing to-be-deleted files on Windows
2021-02-12 20:28:56 +01:00
Brad King
5392e0e7bf disk_interface: Restore toleration of missing files in RemoveFile on Windows
Revise the logic from commit 2d7f7e55 (Delete read-only files on
Windows, too, 2020-12-07) to check if `GetFileAttributes` or
`DeleteFile` failed due either variant of the file/path-not-found error.

Issue: #1886
2021-02-12 11:47:12 -05:00
Brad King
c7e3e5ef45 disk_interface: Do not query bits of INVALID_FILE_ATTRIBUTES 2021-02-12 11:44:45 -05:00
Brad King
a33b813058 disk_interface: Improve wrapping of comment in RemoveFile 2021-02-12 11:44:38 -05:00
Jan Niklas Hasse
b0662970ba GitHub Actions: Test both Debug and Release with MSVC 2021-02-12 11:08:55 +01:00