summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | | | | Address review commentsPeter Bell2021-08-273-29/+25
| | | | | | | |
| | * | | | | | clang-format diffPeter Bell2021-08-253-17/+12
| | | | | | | |
| | * | | | | | Fix critical time calculationPeter Bell2021-08-252-70/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing algorithm doesn't work because it strictly requires that all outputs are visited before updating an edge. So any task downstream from a task with multiple out-edges may get ignored. The fix is to always propagate your critical time to the next input node, and only place it in the queue if you offer a higher critical time.
| | * | | | | | Change priority_list_ into a std::priority_queue of ready edgesPeter Bell2021-08-252-47/+92
| | | | | | | |
| | * | | | | | Use explicit std:: style and remove debug print statementsPeter Bell2021-08-252-56/+30
| | | | | | | |
| | * | | | | | support explicit build orderNico Weber2021-08-253-6/+200
| | | | | | | |
| * | | | | | | Merge pull request #2385 from icebreaker/missing_include_guardsJan Niklas Hasse2024-02-212-0/+10
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | added missing include guards in order to support easy amalgamation
| | * | | | | | | added missing include guardsMihail Szabolcs2024-02-182-0/+10
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These changes make it easy to build an amalgamated `ninja.cc` that can be used to bootstrap ninja with just a working C++ compiler, without the need for any third-party tools like `cmake` or `python`. *nix c++ -O2 src/ninja_amalgamated.cc -o ninja osx-cross x86_64-apple-darwin19-c++ -O2 src/one.cc -o ninja mingw x86_64-w64-mingw32-c++ -O2 src/ninja_amalgamated.cc -o ninja.exe msvc cl.exe /nologo /Ox /GR- src\ninja_amalgamated.cc /out:ninja.exe
| * | | | | | | GitHub Actions: Only specify major version for actions/upload-release-assetJan Niklas Hasse2024-02-133-4/+4
| | | | | | | |
| * | | | | | | GitHub Actions: Don't specify patch version for actions/upload-release-assetJan Niklas Hasse2024-02-133-4/+4
| | | | | | | |
| * | | | | | | Merge pull request #2373 from digit-google/document-manual-generationJan Niklas Hasse2024-02-131-0/+36
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | README.md: document Manual and Doxygen generation
| | * | | | | | | README.md: document Manual and Doxygen generationDavid 'Digit' Turner2024-02-131-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #2362
| * | | | | | | | Merge pull request #2369 from Colecf/dark_modeJan Niklas Hasse2024-02-131-0/+26
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Add a dark mode to the docs
| | * | | | | | | | Add a dark mode to the docsCole Faust2023-12-311-0/+26
| | | | | | | | | |
| * | | | | | | | | Merge pull request #2375 from scivision/correct-flagJan Niklas Hasse2024-02-131-3/+3
| |\ \ \ \ \ \ \ \ \ | | |_|/ / / / / / / | |/| | | | | | | | correction to #2360
| | * | | | | | | | correction to #2360scivision2024-01-161-3/+3
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in general, flags check have to be to the non-no option. Updates use of deprecated CMake command.
| * | | | | | | | Merge pull request #2360 from Simonhancrew/masterJan Niklas Hasse2024-01-021-0/+10
| |\ \ \ \ \ \ \ \ | | |/ / / / / / / | |/| | | | | | | [FIX] compile: gcc version > 11.3, treat -Wmaybe-uninitialized as error
| | * | | | | | | [FIX] compile: gcc version > 11.3, treat -Wmaybe-uninitialized as erroryourfather2023-12-301-0/+10
| | | | | | | | |
| * | | | | | | | Merge pull request #2358 from digit-google/fix-canonicalize-path2Jan Niklas Hasse2023-12-282-42/+208
| |\ \ \ \ \ \ \ \ | | |/ / / / / / / | |/| | | | | | | CanonicalizePath: Remove kMaxComponents limit
| | * | | | | | | CanonicalizePath: Remove kMaxComponents limitDavid 'Digit' Turner2023-12-072-42/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch refactors the CanonicalizePath() to fix two issues and improve performance. This is achieved through the following: - Remove the kMaxPathComponents limit entirely, which fixes ninja-build#1732, by dropping the `components` array entirely, in favor of back-tracking the destination pointer. - Properly handle '/' and '\' which were incorrectly converted into an empty string. This fixes ninja-build#2008. - Skip initial '../' components in relative paths, as these are common when referencing source files in build plans, and doing so make the loop after this step run faster in practice since most source files do not need adjustments. - Simplify the inner loop logic by handling the last component (which is not followed by a trailing directory separator) separately. This noticeably improves performance because the inner loop becomes smaller with less branch mis-predictions in the general case. - Never access or copy the caharacter after the end of the input string. - Use memchr() to find the next '/' on Posix, which allows the use of SIMD implementations provided by the C runtime (e.g. through IFUNC functions on Linux), resulting in very noticeable speedup. This is also why a statically Ninja executable will be slower than one that links to the C library dynamically :-/ - Avoid performing any writes when the input path doesn't need any adjustment, which is also quite common. Note that this patch does _not_ remove the 64-bit limit for the `slash_bits` value, which is only used on Win32. Benchmarking was done in several ways: - On Linux, running `hyperfine canon-perftest` to run the canonicalization benchmark program and measure its total running time. Three compilers were used to generate dynamically-linked executables. ``` BEFORE (ms) AFTER (ms) GCC 13.2.0 651 369 Clang 14.0 591 402 Clang 18,0 653 400 ``` - On Windows, running `canon-perftest` 5 times and keeping the best reported average result. The number are slower since they only measure the benched function. ``` BEFORE (ms) AFTER (ms) Mingw64 GCC 12 246 195 ``` - On Linux, run `hyperfine ninja -C out/default -n --quiet` on a large Fuchsia build plan, once with 70000+ pending commands, and once after the build (i.e. `ninja: no work to do`). ```` BEFORE (s) AFTER (s) pre_build 8.789 8.647 post_build 6.703 6.590 ```
| * | | | | | | | Merge pull request #2356 from jhasse/remove-w-dupbuildJan Niklas Hasse2023-12-078-87/+36
| |\ \ \ \ \ \ \ \ | | |/ / / / / / / | |/| | | | | | | Remove `-w dupbuild` completely, always error on duplicate edges
| | * | | | | | | Improve misleading error message when an output is defined multiple timesJan Niklas Hasse2023-12-066-11/+18
| | | | | | | | |
| | * | | | | | | Remove `-w dupbuild` completely, always error on duplicate edgesJan Niklas Hasse2023-11-294-79/+21
| | | |_|_|/ / / | | |/| | | | | | | | | | | | | | | | | | | | | Step 5, fixes #931.
| * | | | | | | Merge pull request #2302 from Snektron/timer-to-micros-chronoJan Niklas Hasse2023-11-291-2/+7
| |\ \ \ \ \ \ \ | | |/ / / / / / | |/| | | | | | metrics: use chrono to convert ticks to micros
| | * | | | | | metrics: use chrono to convert ticks to microsRobin Voetter2023-06-151-2/+7
| | | |_|_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | This was previously causing undefined behavior, as multiplying dt by 1000000 overflowed on some systems. Fixes #2301.
| * | | | | | Merge pull request #2292 from digit-google/fix-stats-reportJan Niklas Hasse2023-11-223-2/+11
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix stats report
| | * | | | | | Don't double-count the 'node stat' metric.David 'Digit' Turner2023-09-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is already done in RealDiskInterface::Stat() itself, and removes a confusing duplicate line in `-d stats` output, e.g.: BEFORE: metric count avg (us) total (ms) ... node stat 119145 3.0 355.2 node stat 270673 3.1 834.9 AFTER: metric count avg (us) total (ms) ... node stat 270673 2.9 774.0
| | * | | | | | Fix .ninja parse time reported by `-d stats`.David 'Digit' Turner2023-09-252-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because Parser::Load() is called recursively during Ninja manifest parsing, the call to METRIC_RECORD() in this function used to over-count the total parsing time (for example, by a factor of 2 for the Fuchsia build). This fixes the problem by introducing a new RECORD_METRIC_IF() macro, which only records anything if a given condition is true. This ensures that metric collection only starts and stops with the outer Parser::Load() call, and none of its recursive sub-calls. The effect on the output of `-d stats`is, for a Fuchsia build plan where `ninja -d stats nothing` takes a bit more than 5s: BEFORE: metric count avg (us) total (ms) .ninja parse 27304 372.6 10172.2 AFTER: metric count avg (us) total (ms) .ninja parse 1 4165297.0 4165.3 Note that |count| went to 1, since there is only one top-level Parser::Load() operation in this build. It would be more if dyndeps files were loaded, which does not happen in this build plan.
| * | | | | | | Merge pull request #2219 from Siogian/masterJan Niklas Hasse2023-11-221-1/+1
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix garbled error message, like Chinese in Windows
| | * | | | | | | fix garbled error message, like Chinese in Windowsxiaojian.liang2022-12-041-1/+1
| | | | | | | | |
| * | | | | | | | Merge pull request #1562 from jhasse/googletestJan Niklas Hasse2023-11-228-277/+39
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Use GoogleTest instead of our own framework
| | * | | | | | | | CMakeLists.txt: Use GTest::gtest instead of gtestDavid 'Digit' Turner2023-11-161-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the case where GTEST_ROOT is set to point to a local GoogleTest installation (see example below). Note that this needs a work-around for a subtle GTest 1.10.0: - When downloading, building then installing googletest-1.10.0, the installation directory contains CMake files that are picked later by Ninja's find_package() function properly, and which define the GTest::gtest target. This is the target name that should be used by projects that depend on GoogleTest, per the official documentation. - When instead 1.10.0, i.e. the same version, is downloaded and used locally with FetchContent_Declare() + FetchContent_MakeAvailable(), then only the `gtest` target will be defined. This was fixed in 1.11.0, where this use case properly defines GTest::gtest instead. The work-around checks for the definition of GTest::gtest after the FetchContent_MakeAvailable(googletest) call. If not defined, an alias to `gtest` is created instead. This ensures the code works with more recent GoogleTest releases as well.
| | * | | | | | | | GitHub Actions: C++11 is now the defaultJan Niklas Hasse2023-10-141-1/+1
| | | | | | | | | |
| | * | | | | | | | GitHub Actions: Install libgtest-dev for Ubuntu 20.04Jan Niklas Hasse2023-10-121-1/+1
| | | | | | | | | |
| | * | | | | | | | Revert back to GoogleTest 1.10.0 for RHEL 7Jan Niklas Hasse2023-10-121-2/+2
| | | | | | | | | |
| | * | | | | | | | GitHub Actions: configure.py no longer builds testsJan Niklas Hasse2023-10-121-1/+0
| | | | | | | | | |
| | * | | | | | | | Update GoogleTest to last release to support C++11Jan Niklas Hasse2023-10-121-2/+2
| | | | | | | | | |
| | * | | | | | | | Merge branch 'master' into googletestJan Niklas Hasse2023-10-1258-587/+2121
| | |\ \ \ \ \ \ \ \
| | * | | | | | | | | GoogleTest doesn't allow calling ASSERT from a constructorJan Niklas Hasse2021-11-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/missing_deps_test.cc:36:5: error: returning a value from a constructor 36 | ASSERT_EQ("", err); | ^~~~~~~~~
| | * | | | | | | | | Merge branch 'master' into googletestJan Niklas Hasse2021-11-1658-746/+2374
| | |\ \ \ \ \ \ \ \ \
| | * | | | | | | | | | GoogleTest 1.11.0 now requires linking pthread on LinuxJan Niklas Hasse2021-11-161-1/+2
| | | | | | | | | | | |
| | * | | | | | | | | | Use GoogleTest instead of our own frameworkJan Niklas Hasse2020-11-187-273/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #1248.
| * | | | | | | | | | | Merge pull request #2355 from orgads/typoJan Niklas Hasse2023-11-221-1/+1
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Fix typo
| | * | | | | | | | | | | Fix typoOrgad Shaneh2023-11-191-1/+1
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends a744eea2b6c9b37024b12e749e61170e5c87d171.
| * | | | | | | | | | | Merge pull request #2352 from digit-google/remove-phony-in-edgesJan Niklas Hasse2023-11-188-60/+66
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Remove phony edges for nodes created by a dependency loader.
| | * | | | | | | | | | | Remove phony edges for nodes created by a dependency loader.David 'Digit' Turner2023-11-078-60/+66
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch simplifies Ninja internals without modifying its behavior. It removes the creation (and removal) of phony edges as producers for nodes loaded by dependency loaders, i.e. coming from depfiles, dyndep files or the deps log. These edges were only used to ensure the build did not abort when these files are missing, unlike regular source inputs. This can be easily checked by adding a new flag to the Node class instead. This makes it easier to reason about how Ninja works internally. More specifically: - Move the generated_by_dep_loader_ flag from the Edge class to the Node class. The flag is true by default to minimize changes to the source code, since node instances can be first created by reading the deps or build logs before the manifest itself. - Modify Plan::AddSubTarget() to avoid aborting the build when a generated-by-deploader node is missing. Instead the function exits immediately, which corresponds to what happened before. - State::AddOut(), State::AddIn(), State::AddValidation(): Ensure that nodes added by these methods, which are only called from the manifest parser and unit-tests set the |generated_by_dep_loader_| flag to false, to indicate that these are regular input / output nodes. - ManifestParser::ParseEdge(): Add an assertion verifying that the dyndep file is marked as a regular input. - DyndepLoader::UpdateEdge(): Remove code path that looked for phony in-edges and ignored them. - DepLoader::CreatePhonyInEdge() is removed as no longer necessary. + Update a few places in unit-tests that were checking for the creation of the phony edges. Fuchsia-Topic: persistent-mode Change-Id: I98998238002351ef9c7a103040eb8a26d4183969
| * | | | | | | | | | | Merge pull request #2350 from ↵Jan Niklas Hasse2023-11-012-1/+4
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | taminob/bugfix/2342/remove-no-work-to-do-output-with-quiet Do not print 'no work to do' with --quiet
| | * | | | | | | | | | | Add output_test assertion for quiet without 'no work to do'Tamino Bauknecht2023-10-241-0/+1
| | | | | | | | | | | | |
| | * | | | | | | | | | | Do not print 'no work to do' with --quietTamino Bauknecht2023-10-241-1/+3
| | | | | | | | | | | | |
| * | | | | | | | | | | | Merge pull request #2347 from sunshaoce/RE2C_PROPERJan Niklas Hasse2023-10-301-1/+6
| |\ \ \ \ \ \ \ \ \ \ \ \ | | |/ / / / / / / / / / / | |/| | | | | | | | | | | Add a check for re2c version