Lines Matching +full:ninja +full:- +full:build

3 # ======- check-ninja-deps - build debugging script ----*- python -*--========#
7 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 # ==------------------------------------------------------------------------==#
11 """Script to find missing formal dependencies in a build.ninja file.
15 executed after the Tablegen build step that generates the header. So the
16 dependency graph in build.ninja should have the Tablegen build step as an
17 ancestor of the C++ one. If it does not, then there's a latent build-failure
18 bug, because depending on the order that ninja chooses to schedule its build
19 steps, the C++ build step could run first, and fail because the header it needs
23 not notice, if your local test build happens to succeed. What you'd like is a
27 This script tries to do that. It's specific to the 'ninja' build tool, because
28 ninja has useful auxiliary output modes that produce the necessary data:
30 - 'ninja -t graph' emits the full DAG of formal dependencies derived from
31 build.ninja (in Graphviz format)
33 - 'ninja -t deps' dumps the database of dependencies discovered at build time
36 By cross-checking these two sources of data against each other, you can find
43 - set up a build directory using ninja as the build tool (cmake -G Ninja)
45 - in that build directory, run ninja to perform an actual build (populating
48 - then, in the same build directory, run this script. No arguments are needed
49 (but -C and -f are accepted, and propagated to ninja for convenience).
52 as the 'python3-pygraphviz' package in Debian and Ubuntu.
67 so that for any edge v->w, v is output before w."""
70 # vertex. Initially this is simply their in-degrees.
87 ideg[w] -= 1
124 "files in a build.ninja file."
126 parser.add_argument("-C", "--build-dir", help="Build directory (default cwd)")
128 "-f", "--build-file", help="Build directory (default build.ninja)"
134 ninja_prefix = ["ninja"]
136 ninja_prefix.extend(["-C", args.build_dir])
138 ninja_prefix.extend(["-f", args.build_file])
142 subprocess.check_output(ninja_prefix + ["-t", "graph"]).decode("UTF-8")
145 # Helper function to ask for the label of a vertex, which is where ninja's
149 # Start by making a list of build targets, i.e. generated files. These are
162 subprocess.check_output(ninja_prefix + ["-t", "deps"])
163 .decode("UTF-8")
166 # ninja -t deps output consists of stanzas of the following form,
174 # We parse this ad-hoc by detecting the four leading spaces in a
175 # source-file line, and the colon in a target line. 'currtarget' stores
184 # cache is not cleared when build.ninja changes, so it can contain