2232 Commits

Author SHA1 Message Date
Scott Graham
05d60b58ab Tidy up rate snprintf'ing helper 2016-10-07 15:29:58 -07:00
Nico Weber
6a2b876d3a Merge pull request #1109 from fbenkstein/enhance_write_fake_manifest
enhance write_fake_manifest.py
2016-09-22 09:35:31 -04:00
Nico Weber
067e187a7f Merge pull request #1185 from gahr/freebsd-ppoll
FreeBSD supports ppoll(2)
2016-09-20 13:22:31 -04:00
Pietro Cerutti
965e549b8d Disable ppoll(2) on FreeBSD < 10.2 2016-09-20 10:52:56 +00:00
Pietro Cerutti
68cf75583d FreeBSD supports ppoll(2) 2016-09-15 12:20:35 +00:00
Nico Weber
94fc143145 Merge pull request #1174 from gkistanova/not-initialized-elapsed-fix
Fix for not properly initialized elapsed time.
2016-07-31 21:00:37 -04:00
gkistanova
3473e08fae Fixed not initialized elapsed time. 2016-07-14 10:55:54 -07:00
gkistanova
e074e59a3b Regression test for not initialized elapsed time bug. 2016-07-14 10:53:40 -07:00
Frank Benkstein
1992ab65ad enhance write_fake_manifest.py
Add an option to write_fake_manifest.py to generate sources expected by the
manifest.  Also slightly adapt command lines to the called commands.  Together
these changes mean that generated manifest can actually be executed
successfully on Linux and OSX.  Also add command line options to to change the
number of targets being generated and the seed for the random number generator.

Example usage:

  # create build directory in fake/build, sources in fake/src
  $ python misc/write_fake_manifest.py -s ../src fake/build
  # execute build in fake/build
  $ ninja -C fake/build
2016-06-23 12:23:23 +02:00
Nico Weber
5739c14435 Merge pull request #1164 from nicolasdespres/const_rootnodes
Constify State::RootNodes().
2016-06-10 20:58:40 -04:00
Nicolas Despres
87ae5be189 Constify State::RootNodes(). 2016-06-09 18:14:22 +02:00
Nico Weber
8d65002fd5 Merge pull request #1157 from colincross/browse
Escape ninja output inserted into HTML
2016-05-30 17:07:33 -04:00
Colin Cross
8aeb91ebb1 Escape ninja output inserted into HTML
Ninja query or error output may contain characters that need to be
escaped when being inserted into HTML.  Replace &, ", <, and > with
their & equivalent.
2016-05-27 12:50:11 -07:00
Nico Weber
680efe41f1 Merge pull request #1159 from nicolasdespres/no-explicit-outputs
Parser accepts no explicit outputs.
2016-05-27 11:07:11 -04:00
Nicolas Despres
ccaa3d1c9c Parser accepts no explicit outputs.
There is a class of commands that take an output directory where
they create their output files. Among them are cp(1), tar(1) to name a
few. These commands have one or more implicit outputs but no explicit
output.

With this patch, Ninja's parser accepts build edge with an
empty list of explicit outputs.
2016-05-25 09:11:38 +02:00
Nico Weber
63a8584b06 Merge pull request #1150 from KiYugadgeter/python3_measure
Make misc/measure.py compatible with python3
2016-05-04 10:25:11 -04:00
KiYugadgeter
28cedf1695 Make misc/measure.py compatible with python3 2016-05-04 11:38:31 +09:00
Nico Weber
e2de9d24fe Merge pull request #1147 from colincross/elapsed_status
Fix NINJA_STATUS %e and %r on dumb terminals
2016-04-29 16:54:33 -04:00
Colin Cross
af4973d225 Fix NINJA_STATUS %r on dumb terminals
PR #999 made dumb terminals only output when edges finish.  PrintStatus
is called after finished_edges_ is incremented, which means the
calculation for running edges will always return 1 less than the real
number of running processes.  This happens on smart terminals too, but
ninja will immediately print the status for the next edge with
starting_edges_ incremented, so the incorrect value is never visible.

Pass a boolean specifying whether the status is being printed on an edge
finishing, and if so count the edge that just finished as being running.
2016-04-29 12:21:46 -07:00
Colin Cross
f1b5d2bf37 Fix NINJA_STATUS %e on dumb terminals
PR #999 made dumb terminals only output when edges
finish. BuildStatus::overall_rate_ stopwatch is only initialized to the
current time when PrintStatus is called with finished_edges_ == 0, but
on a dumb terminal it will be called for the first time when
finished_edge_ = 1, which results in very long elapsed times:
NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es ] "
[0 processes, 2/2 @ 0.0/s : 1461869902.367s ]

Reset the stopwatches in BuildEdgeFinished before finshed_edges_ is
incremented instead.
2016-04-28 12:35:01 -07:00
Nico Weber
644f6b1757 mark this 1.7.1.git 2016-04-28 10:55:55 -04:00
Nico Weber
2b1bc4b6ea Merge pull request #1144 from nico/statustweaks
Update %p to use finished edges after #1143.
2016-04-28 10:45:08 -04:00
Nico Weber
24694d95f5 Update %p to use finished edges after #1143. 2016-04-28 10:40:39 -04:00
Nico Weber
17a7d941fc Merge pull request #1143 from colincross/status
Change default NINJA_STATUS to [%f/%t]
2016-04-28 10:35:29 -04:00
Colin Cross
6c2c2eecbf Change default NINJA_STATUS to [%f/%t]
PR #999 changed the status line to be printed when edges finish on dumb
teerminals, but the default status message includes the number of
started edges, resulting in sequential status lines with identical
edge counts.

Change the default status to show the number of finished edges, which
will keep the count incrementing on every line.  This will slightly
change the output on smart terminals.  Previously a build that was just
starting would show a count equal to the number of concurrent jobs, and
a build waiting for the final jobs to finish would show a count equal to
the total number of edges.  Now a starting build will show 0, and build
waiting for the final jobs will show a count less than the total number
of edges by the number of remaining jobs.

Fixes: #1142
2016-04-27 17:22:08 -07:00
Nico Weber
ddaf63fe1b fix path after moving github pages to ninja-build repo 2016-04-27 16:27:45 -04:00
Nico Weber
06b0e568f6 mark this 1.7.0.git 2016-04-27 15:15:54 -04:00
Nico Weber
6d1fcc748b Merge pull request #1137 from nico/crashfix
Fix crash with duplicate implicit outputs.
2016-04-27 09:37:49 -04:00
Nico Weber
29f373a66b Fix crash with duplicate implicit outputs.
Sadly, duplicate outputs aren't an error by default in Ninja (see also
a new edge has no effect.  Remember to decrement the "number of
implicit outputs" counter for the new edge when this happens.

Fixes #1136.
2016-04-27 09:36:42 -04:00
Nico Weber
aa79fbe25f Merge pull request #1134 from danw/ubuntu-libc++
Add <stdlib.h> includes for clang++/libc++ on Ubuntu
2016-04-20 21:57:14 -04:00
Dan Willemsen
d4607eb897 Add <stdlib.h> includes for clang++/libc++ on Ubuntu
There are a number of stdlib.h uses in these files without including
stdlib.h:

 hash_collision_bench.cc: rand, RAND_MAX, srand
 manifest_parser_perftest.cc: system, exit
 ninja_test.cc: EXIT_SUCCESS, EXIT_FAILURE
 test.cc: getenv, mkdtemp, system

This works on a Ubuntu g++/libstdc++ build, as the <algorithm> header
pulls in stdlib.h, and on a OSX clang++/libc++ build the <map> and
<string> headers pull in stdlib.h. But a Ubuntu clang++/libc++ build
does not pull in stdlib.h with any of these other headers.

 $ apt-get install clang-3.6 libc++-dev
 $ CXX=clang++-3.6 CFLAGS=-stdlib=libc++ LDFLAGS=-stdlib=libc++ \
   ./configure.py
 $ ninja ninja_test hash_collision_bench manifest_parser_perftest

This was originally discovered using the host toolchain provided with
Android, but the Ubuntu version is much easier to reproduce.
2016-04-20 18:24:10 -07:00
Nico Weber
73b672ebbf Merge pull request #1116 from colincross/browse
Pass location of build.ninja file to browse script
2016-04-19 17:23:44 -04:00
Colin Cross
bff4010e56 Pass location of build.ninja file to browse script
Pass the value of -f to the browse python script so it can be passed
back to ninja -t query.
2016-04-19 13:34:16 -07:00
Nico Weber
bfe8cd9b34 Merge pull request #1131 from bradking/improve-EdgeFinished-signature
Improve Plan::EdgeFinished signature
2016-04-19 16:18:05 -04:00
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