mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 17:51:19 +00:00
632b744046
Ryan landed a fix for #28200 so we can try to land this again. Tests on Debug builds will be slower until https://codereview.chromium.org/2614003003/ lands, but we didn't notice an uptick in bot timeouts when we tried this before, so I suspect the bots will continue to be unaffected. R=whesse@google.com Review-Url: https://codereview.chromium.org/2617803003 .
93 lines
2 KiB
Python
Executable file
93 lines
2 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# Copyright 2016 The Dart project authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import utils
|
|
|
|
SCRIPT_DIR = os.path.dirname(sys.argv[0])
|
|
DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
|
|
DART_USE_GYP = "DART_USE_GYP"
|
|
DART_DISABLE_BUILDFILES = "DART_DISABLE_BUILDFILES"
|
|
|
|
|
|
def use_gyp():
|
|
return DART_USE_GYP in os.environ
|
|
|
|
|
|
def disable_buildfiles():
|
|
return DART_DISABLE_BUILDFILES in os.environ
|
|
|
|
|
|
def execute(args):
|
|
process = subprocess.Popen(args, cwd=DART_ROOT)
|
|
process.wait()
|
|
return process.returncode
|
|
|
|
|
|
def run_gn(options):
|
|
gn_command = [
|
|
'python',
|
|
os.path.join(DART_ROOT, 'tools', 'gn.py'),
|
|
'-m', 'all',
|
|
'-a', 'all',
|
|
]
|
|
if options.verbose:
|
|
gn_command.append('-v')
|
|
print ' '.join(gn_command)
|
|
return execute(gn_command)
|
|
|
|
|
|
def run_gyp(options):
|
|
gyp_command = [
|
|
'python',
|
|
os.path.join(DART_ROOT, 'tools', 'gyp_dart.py'),
|
|
]
|
|
if options.verbose:
|
|
print ' '.join(gyp_command)
|
|
return execute(gyp_command)
|
|
|
|
|
|
def parse_args(args):
|
|
args = args[1:]
|
|
parser = argparse.ArgumentParser(
|
|
description="A script to generate Dart's build files.")
|
|
|
|
parser.add_argument("-v", "--verbose",
|
|
help='Verbose output.',
|
|
default=False,
|
|
action="store_true")
|
|
parser.add_argument("--gn",
|
|
help='Use GN',
|
|
default=not use_gyp(),
|
|
action='store_true')
|
|
parser.add_argument("--gyp",
|
|
help='Use gyp',
|
|
default=use_gyp(),
|
|
action='store_true')
|
|
|
|
options = parser.parse_args(args)
|
|
# If gyp is enabled one way or another, then disable gn
|
|
if options.gyp:
|
|
options.gn = False
|
|
return options
|
|
|
|
|
|
def main(argv):
|
|
# Check the environment and become a no-op if directed.
|
|
if disable_buildfiles():
|
|
return 0
|
|
options = parse_args(argv)
|
|
if options.gn:
|
|
return run_gn(options)
|
|
else:
|
|
return run_gyp(options)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv))
|