This is an archive of the discontinued LLVM Phabricator instance.

gn build: Add gn.py wrapper script that adds appropriate --dotfile= and --root= paramers
ClosedPublic

Authored by thakis on Jan 10 2019, 3:33 PM.

Details

Summary

Since people weren't enthused about moving the .gn file to the toplevel in D56419, here's a script to make gn at least somewhat more pleasant to invoke (useful for gn clean, gn args --list, gn desc, etc).

Diff Detail

Event Timeline

thakis created this revision.Jan 10 2019, 3:33 PM
phosek added inline comments.Jan 11 2019, 8:41 PM
llvm/utils/gn/gn.py
25

Shouldn't we check if help is the first argument (i.e. argv[1])? Otherwise this would catch even cases like gn gen help (which is admittedly a strange name for output directory but nevertheless valid).

thakis updated this revision to Diff 181437.Jan 12 2019, 4:05 AM
thakis marked 2 inline comments as done.

address comment

llvm/utils/gn/gn.py
25

I think either check will have false positives (e.g. gn --nocolor help gen doesn't work when checking argv[1]). It's not _that_ much code to get the first non-flag arg, so I did that.

LGTM, but only from the point of view of python 2/3 compatibility :-)

This revision is now accepted and ready to land.Jan 14 2019, 12:34 AM
phosek accepted this revision.Jan 14 2019, 1:26 AM

LGTM, although I'll probably try to fix the gn help behavior to avoid similar workarounds.

This revision was automatically updated to reflect the committed changes.