| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RecomputDirty(edge) currently works roughly like this:
RecomputeDirty(edge):
LoadDeps(edge)
for in in edge.inputs:
if in.StatIfNecessary():
RecomputeDirty(in.in_edge) # recurse into inputs
for out in edge.outputs:
out.StatIfNecessary() # mark outputs as visited
It uses the stat state of each node to mark nodes as visited and doesn't
traverse across nodes that have been visited already. For cyclic graphs
with an edge with multiple outputs on the cycle, nothing prevents an
edge to be visited more than once if the cycle is entered through an
output that isn't on the cycle. In other words, RecomputeDirty() for
the same edge can be on the call stack more than once. This is bad for
at least two reasons:
1. Deps are added multiple times, making the graph confusing to reason
about.
2. LoadDeps() will insert into the inputs_ of an edge that's iterated
over in a callframe higher up. This can invalidate the iterator,
which causes a crash when the callframe with the loop over the
now-invalidated iterator resumes.
To fix this, let RecomputeDirty() mark all outputs of an edge as visited
as the first thing it does. This way, even if the edge is on a cycle
with several outputs, each output is already marked and no edge will
have its deps loaded more than once.
Fixes the crashes in #875. (In practice, it turns the crashes into
"stuck [this is a bug]" messages for now, due to the example without
duplicate rules in #867)
|
| |
|
|
|
|
|
|
| |
In summary: don’t escape if the path doesn’t contain problematic characters, otherwise:
- Shell: enclose string in single quotes, escape embedded single quotes with the magic quote-backslash-quote sequence
- Win32: Escape double quotes by doubling the number of consecutive backslashes that precede them (if any) and adding one more. Finally, double the number of trailing backslashes, and enclose the whole thing in double quotes.
|
|
|
|
| |
Added NestedPhonyPrintsDone unit test
|
| |
|
|
|
|
| |
It's the only piece that cares about the current time.
|
|
|
|
|
| |
Now, a 'build' block can override any special binding like 'command'
or 'description' if it needs to.
|
|
|
|
|
|
|
| |
The build log is needed in computing whether an edge is
dirty, so I think it belongs here. (It's a bit weird
that Builder needs to reach into it to record completed
commands, maybe it will become cleaner with more thought.)
|
|
|
|
|
|
|
|
|
|
| |
Rather than passing States and DiskInterfaces through all the calls,
put the necessary ambient information in a new DependencyScan object
and move the code accordingly.
Note: I didn't move the source location of the functions to preserve
history, though this does result in a sort of weird order for the
functions in graph.cc.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
The two were always one-to-one anyway. I started adding accessors
to FileStat and then realized most users wanted them on Node and
that forwarding them through was silly.
|
|
|
|
|
|
| |
Edges found through depfiles are special: they get an extra
empty "phony" rule. (This is identical to the way you hack this
with Makefiles.)
|
|
|
|
|
| |
It links, with some hacks.
Tests still fail.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Also add util_test.cc and move the CanonicalizePathTest into there.
Signed-off-by: Thiago Farina <tfarina@chromium.org>
|
|
|
|
|
|
|
| |
This is just deleting some code that was written in anticipation
of staying memory-resident; when loading a depfile, we don't need
to attempt to update existing entries in the dependency list, we
just need to blindly add them.
|
|
If a C file #includes "../foo.cc", then gcc will emit paths like
"bar/../foo.cc" into the dependency file; canonicalize these when we
load the file.
Add a test module for testing the graph dirty recomputation directly,
without all the build classes around it.
|