Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: tools/gn.py

Issue 2394063002: Have GN generate ide files (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn.py
diff --git a/tools/gn.py b/tools/gn.py
index 44b4b4116e750845a95ae165f27f924bfe3eed5a..7598b5f862958773934b7e727accdc58350da771 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -179,6 +179,19 @@ def process_options(args):
return True
+def os_has_ide(host_os):
+ return host_os.startswith('win') or host_os.startswith('mac')
+
+
+def ide_switch(host_os):
+ if host_os.startswith('win'):
+ return '--ide=vs'
+ elif host_os.startswith('mac'):
+ return '--ide=xcode'
+ else:
+ return '--ide=json'
+
+
def parse_args(args):
args = args[1:]
parser = argparse.ArgumentParser(description='A script to run `gn gen`.')
@@ -222,6 +235,10 @@ def parse_args(args):
help='Disable Clang',
dest='clang',
action='store_false')
+ parser.add_argument('--ide',
+ help='Generate an IDE file.',
+ default=os_has_ide(HOST_OS),
+ action='store_true')
parser.add_argument('--target-sysroot', '-s',
type=str,
help='Path to the toolchain sysroot')
@@ -278,6 +295,8 @@ def main(argv):
out_dir = get_out_dir(mode, arch, target_os)
if args.verbose:
print "gn gen --check in %s" % out_dir
+ if args.ide:
+ command.append(ide_switch(HOST_OS))
command.append(out_dir)
command.append('--args=%s' % ' '.join(gn_args))
commands.append(command)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698