Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/samu
/.ninja_deps
/.ninja_log
.vscode/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you can do here is add it to your .git/info/exclude. I don't want to start adding ignored files for every editor and IDE, only for the files produced during the build.

11 changes: 6 additions & 5 deletions graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ enum {
MTIME_MISSING = -2,
};

/* corresponds to a file */
struct node {
/* shellpath is the escaped shell path, and is populated as needed by nodepath */
struct string *path, *shellpath;

/* modification time of file (in nanoseconds) and build log entry (in seconds) */
int64_t mtime, logmtime;

/* generating edge and dependent edges.
*
* only gen and nuse are set in parse.c:parseedge; use is allocated and
* populated in build.c:computedirty. */
struct edge *gen, **use;
/* edge that builds this node */
struct edge *gen;
/* list of edges that use this node as input, allocated and populated in graph.c:nodeuse */
struct edge **use;
/* number of edges in this.use */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Duncaen already fixed this incorrect comment in #48, and I have just cherry-picked that patch.

I think "dependent edges" is a more succinct and precise way to describe this field.

size_t nuse;

/* command hash used to build this output, read from build log */
Expand Down
6 changes: 6 additions & 0 deletions parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ parseedge(struct scanner *s, struct environment *env)

e = mkedge(env);

/* scan outputs */
for (out = NULL, end = &out; (str = scanstring(s, true)); ++e->nout)
pushstr(&end, str);
e->outimpidx = e->nout;
Expand All @@ -88,6 +89,8 @@ parseedge(struct scanner *s, struct environment *env)
if (e->nout == 0)
scanerror(s, "expected output path");
scanchar(s, ':');

/* scan rule name and inputs */
name = scanname(s);
e->rule = envrule(env, name);
if (!e->rule)
Expand All @@ -107,6 +110,8 @@ parseedge(struct scanner *s, struct environment *env)
for (; (str = scanstring(s, true)); ++e->nin)
pushstr(&end, str);
}

/* scan variables for the build rule */
scannewline(s);
while (scanindent(s)) {
name = scanname(s);
Expand All @@ -115,6 +120,7 @@ parseedge(struct scanner *s, struct environment *env)
envaddvar(e->env, name, val);
}

/* evaluate output strings and make output nodes */
e->out = xreallocarray(NULL, e->nout, sizeof(e->out[0]));
for (i = 0; i < e->nout; out = str) {
str = out->next;
Expand Down