Commit Graph

2641 Commits

Author SHA1 Message Date
Refael Ackermann
251e476309 escape usage examples 2017-10-19 16:49:39 -04:00
Logan Chien
7c80007b55 Fix potential buffer overrun
This commit rearranges record size comparison and fread() to make sure
fread() only reads the data that can fit into the buffer.
2017-10-16 14:04:34 +08:00
Nico Weber
887eccf1fd Merge pull request #1337 from Kulak/patch-1
correction of location of binary
2017-10-10 12:46:07 -04:00
Kulak
aa44a55f67 correction of location of binary
original said "source root", but actual location is project root.  Perhaps it is mean to be "src" parent, but that's a bit confusing.
2017-09-28 15:02:14 -07:00
Nico Weber
b26168be15 Merge pull request #1327 from atetubou/update_release
update RELEASING
2017-09-19 18:25:30 -04:00
Takuto Ikuta
4244022f16 update RELEASING 2017-09-19 10:30:35 +09:00
Elliott Sales de Andrade
0c42653da8 Fix minor typo. 2017-09-16 05:34:29 -04:00
Elliott Sales de Andrade
df19c5a597 Use strtoll when reading mtime from build log.
This prevents overflow on Windows where 'long' is not 64-bit.
2017-09-16 05:02:57 -04:00
Elliott Sales de Andrade
f117cc16f6 Fix some Windows troubles.
Add parentheses so that constant does not overflow; include inttypes.h
when using MinGW to get the proper macros.
2017-09-16 03:54:11 -04:00
Elliott Sales de Andrade
d2bf82fef0 Update checks for new stat fields.
This uses the macros as defined by the man page, which, as noted in the
comments, are defined correctly on as many libc's that I could check.
2017-09-16 03:54:11 -04:00
Elliott Sales de Andrade
bf4fb03e4b Use 64-bit-alignment-safe timestamp reading.
Read and write the timestamp as two separate 32-bit integers in a fixed
order to prevent any issues with alignment or byte order.
2017-09-16 03:54:11 -04:00
Elliott Sales de Andrade
eb6cea27f2 Add #define to get printf-format specifiers.
This is needed on older compilers/stdlibs such as on Ubuntu Precise
which is used on Travis.
2017-09-16 03:54:11 -04:00
Elliott Sales de Andrade
9fa250d794 Move #include for type definition to correct place.
Not sure why the old way works in newer compilers; maybe they just
pre-define these types by defaulting to a newer standard.
2017-09-16 03:54:11 -04:00
Elliott Sales de Andrade
f50a5250e4 Read file timestamps in higher resolution.
This uses nanoseconds on POSIX (±~292 years) and 100-ns increments on
Windows (±~29247 years).

The fallbacks to different structure fields is the only thing grabbed
from #337, with a slight modification in implementation.
2017-09-16 03:54:11 -04:00
Elliott Sales de Andrade
5fcdcf95cb Make TimeStamp 64-bit.
This prepares it for higher-resolution timestamps.
2017-09-16 03:54:10 -04:00
Brad King
f87e865e5b Track in Plan whether wanted edges have been scheduled
Refactor the `want_` map to track for wanted edges whether they have
been scheduled or not.  This gives `ScheduleWork` a direct place to keep
this information, making the logic more robust and easier to follow.  It
also future-proofs `ScheduleWork` to avoid repeat scheduling if it is
called after an edge has been removed from `ready_` by `FindWork`.
2017-09-14 11:43:31 -04:00
Nico Weber
87111bff38 mark this 1.8.2.git 2017-09-10 21:19:22 -04:00
Nico Weber
17ae02ac35 Merge pull request #1323 from bradking/tolerate-phony-self-reference
Restore tolerance of self-referencing phony build statements
2017-09-10 21:18:06 -04:00
Thomas Klausner
2950bb1af9 Add NetBSD in another clause. 2017-09-10 23:26:27 +02:00
Thomas Klausner
d933127a69 Include missing header for pselect(). 2017-09-10 23:25:42 +02:00
Brad King
c0dde0ff79 Restore tolerance of self-referencing phony build statements
Since commit v1.8.0^2~3^2~1 (Teach RecomputeDirty to detect cycles in
the build graph, 2015-11-13) we correctly reject self-referencing phony
build statements like

    build a: phony a

as cycles.  Unfortunately this breaks support for CMake 2.8.12.x and
3.0.x because those versions incorrectly produce edges of this form
(that we used to tolerate).  In order to preserve compatibility with
those CMake versions we need to restore tolerance of these edges.

Add a special case to the manifest parser to filter out self-referencing
inputs of phony edges of the form produced by those CMake versions.
Warn by default, but add a `-w phonycycle={err,warn}` option to make it
an error.

Fixes: #1322
2017-09-08 09:07:52 -04:00
Brad King
e679202a14 Factor ManifestParser options into a structure
This will allow more options to be added without updating everywhere
that constructs a ManifestParser.  Also extend the AssertParse function
to take the options so tests can control them.
2017-09-07 14:52:56 -04:00
Nico Weber
7738c19dc4 mark this 1.8.1.git 2017-09-06 15:00:43 -04:00
Nico Weber
6081e81373 Merge pull request #1318 from atetubou/fix_for_maxpath_test
fix normalizer test for _MAX_PATH
2017-09-05 17:14:22 -04:00
Takuto Ikuta
480f899845 fix normalizer test for _MAX_PATH 2017-09-05 10:35:03 +09:00
Nico Weber
b98941a605 mark this 1.8.0.git 2017-09-03 22:13:50 -04:00
Nico Weber
bfa7da5118 Merge pull request #1313 from adzenith/patch-3
Add `deps` and `recompact` tools to manual
2017-09-03 19:11:09 -07:00
Nikolaus Wittenstein
324a117281 Add _Available since Ninja 1.4._ to deps and recompact 2017-08-30 08:59:40 -04:00
Nico Weber
327d6cee67 Merge pull request #1314 from atetubou/fix_windows_path
Remove path component limit from input of CanonicalizePath in windows
2017-08-30 00:44:49 -04:00
Takuto Ikuta
86f606fe3b Remove path component limit from input of CanonicalizePath in windows 2017-08-30 13:03:06 +09:00
Nikolaus Wittenstein
e6e498494f Add deps and recompact tools to manual
The `deps` tool in particular is very useful to know about.
2017-08-29 13:39:11 -04:00
Fredrik Medley
5a3a06afd2 Describe how to make a phony rule always up to date
A phony rule with no input is always out of date. Describe how to make a
rule always up to date.

Signed-off-by: Fredrik Medley <fredrik.medley@gmail.com>
2017-08-16 07:09:47 +02:00
Peter Collingbourne
e237f1b5a1 Flush stdout after printing "Cleaning..." message 2017-07-05 16:57:11 -07:00
Nico Weber
7bbc708ff0 Merge pull request #1111 from bradking/detect-cycles-early
Detect build graph cycles as early as possible
2017-06-22 15:59:00 -04:00
Nico Weber
61e347ed4e Merge pull request #1292 from gtristan/work-around-zero-mtime
Work around mtime being set to 0 sometimes
2017-06-19 15:42:34 -04:00
Brad King
721d2a26b6 Drop unnecessary cycle detection in Plan::AddTarget
We now detect and reject cycles in DependencyScan::RecomputeDirty before
Plan::AddTarget is called so we can assume DAG input to the Plan.
2017-06-19 11:08:26 -04:00
Brad King
b6f020d364 Teach RecomputeDirty to detect cycles in the build graph
RecomputeDirty is the earliest traversal of the build graph complete
with depfile-loaded dependencies.  Teach it to detect cycles and fail
immediately.  This avoids the need to tolerate cycles in RecomputeDirty
only to diagnose them later.  It also enables future simplification of
Plan and Builder logic because they will be able to assume DAG input.

When RecomputeDirty detects a cycle, reject it with an error message
like that previously produced by Plan::CheckDependencyCycle.

Previously we used the stat state of each node to determine whether
we reached it earlier in the walk.  Retain this approach for leaf
nodes, but add an explicit walk state mark for each Edge so that
we can have a temporary mark to aid cycle detection.
2017-06-19 11:08:26 -04:00
Brad King
a8b5cdc4e9 Add infrastructure for efficient walks through the Edge graph
Store a mark in each `Edge` to be updated as it is encountered by a walk.
2017-06-19 11:08:26 -04:00
Brad King
afe3beb980 Refactor RecomputeDirty to take a node instead of an edge
All call sites have a node on which they call `in_edge()` to call
RecomputeDirty.  Simplify call sites by taking the node directly and
calling `in_edge()` internally.
2017-06-19 11:08:26 -04:00
Brad King
29a6e2fc6c Simplify BuildTest.StatFailureAbortsBuild test case
Remove a dependency cycle from the test case, as cycles are covered by
other tests.  Ensure this case covers stat failure on a valid graph.
2017-06-19 11:08:26 -04:00
Patrick Griffis
b34f744ac3 Work around mtime being set to 0 sometimes 2017-06-18 17:56:27 +09:00
Nico Weber
1029064057 Merge pull request #1291 from colincross/fix1290
Fix segfault on edge with no inputs
2017-06-17 20:33:14 -04:00
Colin Cross
11a934d427 Fix segfault on edge with no inputs
PR #1281 added a deference of most_recent_input without checking
for NULL, which can occur if a build rule has no inputs.
Check it for null before dereferencing, and add a test.

Fixes #1290.
2017-06-16 12:51:26 -07:00
Nico Weber
00f69c1795 Merge pull request #1156 from cdbennett/windows-binary-mode-output
Write subprocess output to stdout in binary mode
2017-06-14 17:49:35 -04:00
Nico Weber
0142023b82 Merge pull request #1287 from ivadasz/dragonfly_patches
Add support for DragonFly BSD.
2017-06-14 17:48:21 -04:00
Nico Weber
89d9d6221e Merge pull request #1281 from colincross/rebuild_on_error
Rebuild edges that update their output file on error
2017-06-14 17:47:05 -04:00
Imre Vadász
d806aa5bc4 Add support for DragonFly.
DragonFly uses a fork of FreeBSD ports, and also uses the /usr/local prefix.
And ppoll is also available in DragonFly.
2017-06-10 18:53:43 +02:00
Colin Cross
04d886b110 Always rebuild on errors
https://groups.google.com/forum/#!msg/ninja-build/YQuGNrECI-4/ti-lAs9SPv8J
discusses a case where an rule updates its output file and then
fails.  The next run of ninja considers the ouptut file clean
and doesn't rebuild it.  Always stat output files after they are
built, and write the mtime into .ninja_log.  Consider output files
dirty if the recorded mtime is older than the most recent input
file.
2017-05-22 11:29:06 -07:00
Colin Cross
a127dda3ee Add a test that fails if a rule updates it output file but fails
https://groups.google.com/forum/#!msg/ninja-build/YQuGNrECI-4/ti-lAs9SPv8J
discusses a case where an rule updates its output file and then
fails.  The next run of ninja considers the ouptut file clean
and doesn't rebuild it.  Add a test for this case, which currently
fails.
2017-05-22 11:29:06 -07:00
Colin Cross
036003d20e Move stat metric to DiskInterface
Stat is not always used through Node::Stat, it is often used directly
through DiskInterface.  THe next patches will cause it to be called
even more often through DiskInterface, so move the metrics to
DiskInterface.
2017-05-22 11:27:21 -07:00