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

Side by Side Diff: tools/generate_buildfiles.py

Issue 2992593002: [infra] Begin removing gyp (Closed)
Patch Set: Created 3 years, 4 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 unified diff | Download patch
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 HOST_OS = utils.GuessOS() 12 HOST_OS = utils.GuessOS()
13 SCRIPT_DIR = os.path.dirname(sys.argv[0]) 13 SCRIPT_DIR = os.path.dirname(sys.argv[0])
14 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) 14 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
15 DART_USE_GYP = "DART_USE_GYP"
16 DART_DISABLE_BUILDFILES = "DART_DISABLE_BUILDFILES" 15 DART_DISABLE_BUILDFILES = "DART_DISABLE_BUILDFILES"
17 16
18 17
19 def UseGyp():
20 return DART_USE_GYP in os.environ
21
22
23 def DisableBuildfiles(): 18 def DisableBuildfiles():
24 return DART_DISABLE_BUILDFILES in os.environ 19 return DART_DISABLE_BUILDFILES in os.environ
25 20
26 21
27 def Execute(args): 22 def Execute(args):
28 process = subprocess.Popen(args, cwd=DART_ROOT) 23 process = subprocess.Popen(args, cwd=DART_ROOT)
29 process.wait() 24 process.wait()
30 return process.returncode 25 return process.returncode
31 26
32 27
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 def RunGn(options): 72 def RunGn(options):
78 status = RunHostGn(options) 73 status = RunHostGn(options)
79 if status != 0: 74 if status != 0:
80 return status 75 return status
81 status = RunCrossGn(options) 76 status = RunCrossGn(options)
82 if status != 0: 77 if status != 0:
83 return status 78 return status
84 return RunAndroidGn(options) 79 return RunAndroidGn(options)
85 80
86 81
87 def RunGyp(options):
88 gyp_command = [
89 'python',
90 os.path.join(DART_ROOT, 'tools', 'gyp_dart.py'),
91 ]
92 if options.verbose:
93 print ' '.join(gyp_command)
94 return Execute(gyp_command)
95
96
97 def ParseArgs(args): 82 def ParseArgs(args):
98 args = args[1:] 83 args = args[1:]
99 parser = argparse.ArgumentParser( 84 parser = argparse.ArgumentParser(
100 description="A script to generate Dart's build files.") 85 description="A script to generate Dart's build files.")
101 86
102 parser.add_argument("-v", "--verbose", 87 parser.add_argument("-v", "--verbose",
103 help='Verbose output.', 88 help='Verbose output.',
104 default=False, 89 default=False,
105 action="store_true") 90 action="store_true")
106 parser.add_argument("--gn",
107 help='Use GN',
108 default=not UseGyp(),
109 action='store_true')
110 parser.add_argument("--gyp",
111 help='Use gyp',
112 default=UseGyp(),
113 action='store_true')
114 91
115 options = parser.parse_args(args) 92 return parser.parse_args(args)
116 # If gyp is enabled one way or another, then disable gn
117 if options.gyp:
118 options.gn = False
119 return options
120 93
121 94
122 def main(argv): 95 def main(argv):
123 # Check the environment and become a no-op if directed. 96 # Check the environment and become a no-op if directed.
124 if DisableBuildfiles(): 97 if DisableBuildfiles():
125 return 0 98 return 0
126 options = ParseArgs(argv) 99 options = ParseArgs(argv)
127 if options.gn: 100 RunGn(options)
128 return RunGn(options)
129 else:
130 return RunGyp(options)
131 101
132 102
133 if __name__ == '__main__': 103 if __name__ == '__main__':
134 sys.exit(main(sys.argv)) 104 sys.exit(main(sys.argv))
OLDNEW
« runtime/vm/vm.gypi ('K') | « third_party/tcmalloc/tcmalloc.gypi ('k') | tools/gyp/all.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698