2398 Commits

Author SHA1 Message Date
Brad King
87b57e8875 Improve Plan::EdgeFinished signature
Use an enumeration instead of a boolean to clarify the purpose of
arguments at call sites.

Suggested-by: Nico Weber <nicolasweber@gmx.de>
2016-04-19 15:59:08 -04:00
Nico Weber
10ef5bf7f9 Merge pull request #1126 from bradking/pool-release-on-fail
Release the pool slot held by an edge whether it succeeds or fails
2016-04-19 15:13:59 -04:00
Nico Weber
ad671a6349 Merge pull request #1130 from JohnstonJ/fix-tests-on-vs2015
ninja_test: Fix Visual C++ 2015 warnings/errors about name hiding.
2016-04-19 14:10:47 -04:00
Nico Weber
144a0138e6 Merge pull request #1059 from bradking/avoid-double-scheduling-edge
Avoid double-scheduling build edges in another case
2016-04-19 11:22:53 -04:00
James Johnston
50d85fc61d ninja_test: Fix Visual C++ 2015 warnings/errors about name hiding.
Visual C++ 2015 warns if a local variable hides visibility of another variable
in a higher scope.  Since this project declares warnings as errors, ninja_test
simply won't build on Visual C++ 2015.

The variables have been renamed and scope limited as appropriate, so that
ninja_test will build without error now on Visual C++ 2015.
2016-04-18 20:32:16 +00:00
David Emett
ff6eedb968 Add another test case covering pool release on edge failure
With this build file:

    pool failpool
      depth = 1
    rule fail
      command = fail
      pool = failpool
    build out1: fail
    build out2: fail
    build out3: fail
    build final: phony out1 out2 out3

Running `ninja -k 0` should run out1..3 sequentially before failing, but
until recently we would fail after just running out1.  Add a test
covering this case.
2016-04-06 11:24:46 -04:00
Fredrik Medley
7d21426c56 Release the pool slot held by an edge whether it succeeds or fails
When an edge finishes building, it should be release from its pool.
Make sure that this also is the case when an edge fails to build.

The bug can be shown with a pool has size N, then `ninja -k N+1` will
still stop after N failing commands for that pool, even if there are
many more jobs to be done for that pool:

    pool mypool
      depth = 1
    rule bad_rule
      command = false
      pool = mypool
    build a : bad_rule
    build b : bad_rule

Current behaviour:

    $ ninja -k 0
    [1/2] false
    FAILED: false
    ninja: build stopped: cannot make progress due to previous errors.

Expected behaviour:

    $ ninja -k 0
    [1/2] false
    FAILED: false
    [2/2] false
    FAILED: false
    ninja: build stopped: cannot make progress due to previous errors.

Signed-off-by: Fredrik Medley <fredrik.medley@gmail.com>
2016-04-06 11:21:09 -04:00
Nico Weber
78f548880e Merge pull request #1125 from nico/wintools
Make deps=msvc experimentally available on non-Windows.
2016-04-05 21:31:29 -04:00
Nico Weber
3a88912624 Make deps=msvc experimentally available on non-Windows.
This makes it possible to run most of the clparser tests on non-Windows,
and is potentially useful for cross-compiling on non-Windows hosts.
Also, the manual didn't document this as Windows-only previously.

If you use this on non-Windows, please let me know, else I might undo
this change again in the future.
2016-04-05 21:08:32 -04:00
Nico Weber
aea5a4d41f Merge pull request #1118 from nico/posixspawn2
Use posix_spawn() instead of fork()/exec().
2016-04-05 14:13:44 -04:00
Nico Weber
4b4c65c3b1 Merge pull request #1112 from Lekensteyn/browse-tool-fixes
browse tool: Allow customization of port number, Py3 fix
2016-04-04 14:29:04 -07:00
Nico Weber
8958719670 Use posix_spawn() instead of fork()/exec().
posix_spawn() is a syscall on OS X and Solaris and a bit faster.  It's
also easier emulate for cygwin, and the code is a bit simpler.
2016-03-20 21:42:17 -04:00
Peter Wu
048ad189e1 browse: support --port and --no-browser options
Add --port option to override the default port (8000).
Add --no-browser option to avoid opening a web browser (useful over
SSH).
Make the target name optional, using "all" if omitted.
2016-03-12 00:24:00 +01:00
Peter Wu
f7491398a2 browse.py: Python 3 compatibility 2016-03-11 23:35:01 +01:00
Nico Weber
b231274de3 Merge pull request #1113 from nico/nosetsid
Revert #910.
2016-03-04 18:21:14 -08:00
Nico Weber
e605fcc8ea Revert #910.
The change caused some issues (it makes it impossible ot use
posix_spawn() and makes it harder to suspend children on ctrl-z).  After
discussing with jln: Since it fixes a corner case that can be fixed by
explicitly running commands that need it in a wrapper that setsid()s
them, let's try reverting it for a while.  Please shout if this is a
problem for you.

See also #1097.
2016-03-04 18:17:09 -08:00
Nico Weber
d63fe50c49 Merge pull request #1102 from bradking/remove-unnecessary-StatIfNecessary
Remove StatIfNecessary call that is never necessary
2016-03-04 17:43:33 -08:00
Peter Wu
572cc8eb6f browse.py: allow port override via environment variable 2016-02-26 00:16:15 +01:00
Brad King
1a8e545593 Remove StatIfNecessary call that is never necessary
The call to StatIfNecessary in DependencyScan::RecomputeOutputsDirty was
added by commit v1.4.0^2~7^2~1 (Share more code between CleanNode() and
RecomputeDirty(), 2013-09-02) while consolidating code paths.  However,
it was needed only when called from RecomputeDirty because prior to
refactoring the CleanNode code path did not call it.

Later commit v1.6.0^2~46^2 (Let DependencyScan::RecomputeDirty() work
correclty with cyclic graphs, 2014-12-07) added back to RecomputeDirty a
loop over outputs that calls StatIfNecessary.  Therefore
RecomputeOutputsDirty no longer needs to call StatIfNecessary for either
of its own callers.
2016-02-25 16:01:21 -05:00
Nico Weber
d1763746b6 Merge pull request #1110 from G4m4/explicit_std_prefix
Fix ambiguous call to set_terminate on Windows platform
2016-02-17 15:03:14 -05:00
g4m4
71eaf652ba Fix ambiguous call to set_terminate on Windows platform
On Windows set_terminate() could either be the standard C++ one or (actually the same one but in the global namespace) the CRT one declared in corecrt_terminate.h
Hence this ambiguity - this patch solves it.

Signed-off-by: g4m4 <misept.dieseneuf@gmail.com>
2016-02-17 11:35:52 +01:00
Nico Weber
4674e0dc4f Merge pull request #1107 from nicolasdespres/ninja_syntax_implicit_outputs
Add support for implicit outputs in ninja_syntax.py.
2016-02-07 15:57:30 -05:00
Nico Weber
467b725897 Merge pull request #1108 from edbaunton/patch-1
Add link to mailing list
2016-02-07 15:56:19 -05:00
Ed Baunton
d49d111842 Add link to mailing list
As a convenience to new users, provide a link to the mailing list.
2016-02-06 22:56:20 +00:00
Nicolas Despres
d3c7da5893 Add support for implicit outputs in ninja_syntax.py. 2016-02-06 09:37:51 +01:00
Nico Weber
bc4f7bf752 Merge pull request #1106 from nico/winfix
win: Only drop /showIncludes in bootstrap builds.
2016-02-05 16:26:52 -05:00
Nico Weber
2f127fab68 win: Only drop /showIncludes in bootstrap builds.
Fixes #1103.
2016-02-05 13:28:56 -05:00
Nico Weber
a4d4787de1 Merge pull request #1101 from fbenkstein/vs2010
disable warning about conditional expressions
2016-02-05 11:39:40 -05:00
Frank Benkstein
ab652787de MSVC: disable warning about constant conditional expressions
The standard headers for Visual Studio 2008 generate a warning about
constant conditional expressions when compiled with exception support
disabled.  This is caused by the _CATCH_ALL macro in xstddef which is
defined thusly:

  #ifdef _HAS_EXCEPTIONS
  #define _CATCH_ALL } catch (...) {
  #else
  #define _CATCH_ALL } if (0) {
  #endif
2016-02-05 14:56:53 +01:00
Nico Weber
8028e91a9d Merge pull request #1100 from nico/doc
Minor updates to the manual.
2016-02-03 17:16:49 -05:00
Nico Weber
17852dae5b Minor updates to the manual.
* Update link to Chromium's ninja docs (fixes #1038)
* Update cmake URL to what it redirects to, and mention that ninja
  is well-supported on all platforms in newer CMake versions.
* Let "others" link to the wiki page listing generators.
2016-02-03 17:01:45 -05:00
Brad King
e8d855f262 Avoid double-scheduling build edges in another case
The change in commit v1.2.0~3^2~3^2~3 (Fix duplicate edge Pool crash in
the minimally invasive way, 2013-03-18) avoids double-scheduling in a
case involving duplicate out edges.  However, double-scheduling may also
occur on a consistent graph when an edge and one of its dependencies
share an order-only input:

    $ cat build.ninja
    ...
    build c: touch
    build b: touch || c
    build a: touch | b || c
    $ ninja a
    $ rm a c
    $ ninja a

In this case 'c' will build first.  When NodeFinished('c') loops over
the out edges it will find AllInputsReady is true for 'b' and call
EdgeFinished('b') since it is not wanted (up to date).  This will
call NodeFinished('b') which will loop over its out edges, find
AllInputsReady is true for 'a', and call ScheduleEdge('a').  When
we eventually return to the loop in NodeFinished('c') it will move
on to its second output and find that AllInputsReady is true for
'a' and call ScheduleEdge('a') again.

Teach ScheduleEdge to tolerate duplicate calls for an edge that has
already been scheduled.  Avoid calling EdgeScheduled more than once
for the same edge.
2016-02-03 16:23:11 -05:00
Nico Weber
ca5fc795f3 Merge pull request #1033 from colincross/failed
Print output file on failure
2016-02-03 16:11:28 -05:00
Nico Weber
f38a52c839 Merge pull request #989 from bradking/implicit-outputs
Add support for build statement implicit outputs
2016-02-03 16:07:11 -05:00
Nico Weber
27c87c5efd Merge pull request #1060 from bradking/deduplicate-disk-interface
Deduplicate disk abstraction infrastructure
2016-02-03 15:57:10 -05:00
Nico Weber
7d8f9ef43e Merge pull request #1099 from bradking/fix-perftest-compilation
perftest: fix compilation after dupe_edge_should_err change
2016-02-03 15:47:56 -05:00
Brad King
e74cefa6c6 Replace ManifestParser::FileReader with general FileReader
Avoid having two separate filesystem interfaces.  Simplify test
infrastructure by avoiding custom `ManifestParser::FileReader`
implementations.
2016-02-03 13:44:46 -05:00
Brad King
858386d841 Expose more details in FileReader::ReadFile signature
Return a status so callers can distinguish a missing file from an empty
file.  This allows our VirtualFileSystem test infrastructure to report
as missing any file for which it has no entry.
2016-02-03 13:42:18 -05:00
Brad King
f9487ac797 Factor a FileReader base class out of DiskInterface
Some clients will need only the ability to read files, so provide this
as a more narrow interface than the full disk interface.
2016-02-03 13:19:42 -05:00
Brad King
cc39240a10 Add support for build statement implicit outputs
Some build rules produce outputs that are not mentioned on the command
line but that should be part of the build graph.  Such outputs should
not be named in the `$out` variable.  Extend the build statement syntax
to support specification of implicit outputs using the syntax
`| out1 out2` after the explicit outputs and before the `:`.

For example, compilation of a Fortran source file `foo.f90` that defines
`MODULE FOO` may now be specified as:

    rule fc
      command = f95 -c $in -o $out
    build foo.o | foo.mod: fc foo.f90

The `foo.mod` file is an implicit output generated by the compiler based
on the content of the source file and not mentioned on the command line.
2016-02-03 09:37:17 -05:00
Nico Weber
f1f3f494f5 Merge pull request #1076 from colincross/canonicalize
Canonicalize "." to "."
2016-02-02 18:20:01 -05:00
Brad King
94086e990c perftest: fix compilation after dupe_edge_should_err change
Fix some ManifestParser constructor calls missed by commit 56bab441b7
(dupe_edge_should_err from bool to enum, 2016-01-27).
2016-02-02 09:34:53 -05:00
Nico Weber
35e950d4c2 Merge pull request #1096 from sgraham/dupe-edge-action
dupe_edge_should_err from bool to enum
2016-01-28 22:07:12 -05:00
Nico Weber
16553f76a6 Merge pull request #1098 from shinh/keepdep
Add -d keepdepfile to preserve depfiles
2016-01-28 22:01:22 -05:00
Shinichiro Hamaji
24750de7d7 Add -d keepdepfile to preserve depfiles
This is useful when you are developing a tool which generates
GCC-style depfiles.
2016-01-28 18:22:12 +09:00
Scott Graham
56bab441b7 dupe_edge_should_err from bool to enum 2016-01-27 11:10:34 -08:00
Nico Weber
233acbad4d Merge pull request #1095 from sgraham/dupbuild-err
Make dupbuild=err work in subninja
2016-01-27 10:17:31 -05:00
Scott Graham
902f78227f Make dupbuild=err work in subninja 2016-01-26 19:44:27 -08:00
Nico Weber
162219af66 Merge pull request #1094 from sphawk/master
fix for localized version of cl.exe
2016-01-26 21:18:11 -05:00
Nico Weber
3dc91c8e45 Merge pull request #1085 from tetsuok/remove-unnecessary-std
Remove unnecessary `std::`
2016-01-26 21:15:23 -05:00