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

Side by Side Diff: tools/generate_buildfiles.py

Issue 2507483002: Adds an environment variable that makes generate_buildfiles.py a no-op (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Dart project authors. All rights reserved. 2 # Copyright 2016 The Dart project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import os 7 import os
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 import utils 10 import utils
11 11
12 SCRIPT_DIR = os.path.dirname(sys.argv[0]) 12 SCRIPT_DIR = os.path.dirname(sys.argv[0])
13 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) 13 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
14 DART_USE_GN = "DART_USE_GN" 14 DART_USE_GN = "DART_USE_GN"
15 DART_DISABLE_BUILDFILES = "DART_DISABLE_BUILDFILES"
15 16
16 17
17 def use_gn(): 18 def use_gn():
18 return DART_USE_GN in os.environ 19 return DART_USE_GN in os.environ
19 20
20 21
22 def disable_buildfiles():
23 return DART_DISABLE_BUILDFILES in os.environ
24
25
21 def execute(args): 26 def execute(args):
22 process = subprocess.Popen(args, cwd=DART_ROOT) 27 process = subprocess.Popen(args, cwd=DART_ROOT)
23 process.wait() 28 process.wait()
24 return process.returncode 29 return process.returncode
25 30
26 31
27 def run_gn(): 32 def run_gn():
28 gn_command = [ 33 gn_command = [
29 'python', 34 'python',
30 os.path.join(DART_ROOT, 'tools', 'gn.py'), 35 os.path.join(DART_ROOT, 'tools', 'gn.py'),
(...skipping 30 matching lines...) Expand all
61 action='store_true') 66 action='store_true')
62 67
63 options = parser.parse_args(args) 68 options = parser.parse_args(args)
64 # If gn is enabled one way or another, then disable gyp 69 # If gn is enabled one way or another, then disable gyp
65 if options.gn: 70 if options.gn:
66 options.gyp = False 71 options.gyp = False
67 return options 72 return options
68 73
69 74
70 def main(argv): 75 def main(argv):
76 # Check the environment and become a no-op if directed.
77 if disable_buildfiles():
78 return 0
71 options = parse_args(argv) 79 options = parse_args(argv)
72 if options.gn: 80 if options.gn:
73 return run_gn() 81 return run_gn()
74 else: 82 else:
75 return run_gyp() 83 return run_gyp()
76 84
77 85
78 if __name__ == '__main__': 86 if __name__ == '__main__':
79 sys.exit(main(sys.argv)) 87 sys.exit(main(sys.argv))
OLDNEW
« 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