mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
014a34e64f
Generate a manifest of just Dart's files, no longer rolling in the main Fuchsia manifest. Use Fuchsia's new bootdata() template to generate a BOOTFS image of just the Dart test files. A new Fuchsia GN build argument will control rolling this into the final image. IN-70 Change-Id: Idd2db5aab483f49d6f6f3e4065798ded130d606a Reviewed-on: https://dart-review.googlesource.com/15987 Reviewed-by: Zach Anderson <zra@google.com> Commit-Queue: Zach Anderson <zra@google.com>
83 lines
2.5 KiB
Python
Executable file
83 lines
2.5 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# Copyright 2017 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.
|
|
|
|
# This script creates a qemu image manifest for Fuchsia that contains the
|
|
# Dart tree. In particular in contains Dart's test suite, and test harness.
|
|
|
|
import argparse
|
|
import json
|
|
import os
|
|
import sys
|
|
import utils
|
|
|
|
SCRIPT_DIR = os.path.dirname(sys.argv[0])
|
|
DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
|
|
FUCHSIA_ROOT= os.path.realpath(os.path.join(DART_ROOT, '..', '..'))
|
|
|
|
FUCHSIA_TEST_MANIFEST_PREFIX = os.path.join('test', 'dart')
|
|
|
|
EXCLUDE_DIRS = [ '.git', 'out', '.jiri' ]
|
|
|
|
BINARY_FILES = [ 'dart', 'run_vm_tests', 'process_test' ]
|
|
|
|
def parse_args(args):
|
|
args = args[1:]
|
|
parser = argparse.ArgumentParser(
|
|
description='A script that generates Dart/Fuchsia test commands.')
|
|
|
|
parser.add_argument('--arch', '-a',
|
|
type=str,
|
|
help='Target architectures (comma-separated).',
|
|
metavar='[x64]',
|
|
default='x64')
|
|
parser.add_argument('--mode', '-m',
|
|
type=str,
|
|
help='Build variant',
|
|
metavar='[debug,release]',
|
|
default='debug')
|
|
parser.add_argument('--output', '-o',
|
|
type=str,
|
|
help='Path to output file prefix.')
|
|
parser.add_argument("-v", "--verbose",
|
|
help='Verbose output.',
|
|
default=False,
|
|
action="store_true")
|
|
|
|
return parser.parse_args(args)
|
|
|
|
|
|
def fuchsia_arch(arch):
|
|
if arch is 'x64':
|
|
return 'x86-64'
|
|
return None
|
|
|
|
|
|
def main(argv):
|
|
args = parse_args(argv)
|
|
|
|
manifest_output = args.output + '.manifest'
|
|
with open(manifest_output, 'w') as manifest:
|
|
# Write the Dart tree.
|
|
for root, dirs, files in os.walk(DART_ROOT):
|
|
dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS]
|
|
for file in files:
|
|
filepath = os.path.join(root, file)
|
|
relpath = filepath[len(DART_ROOT) + 1:]
|
|
fuchsiapath = os.path.join(FUCHSIA_TEST_MANIFEST_PREFIX, relpath)
|
|
manifest.write('%s=%s\n' % (fuchsiapath, os.path.join(root, file)))
|
|
|
|
dart_conf = utils.GetBuildConf(args.mode, args.arch)
|
|
dart_out = os.path.join(FUCHSIA_TEST_MANIFEST_PREFIX, 'out', dart_conf)
|
|
fuchsia_conf = '%s-%s' % (args.mode, fuchsia_arch(args.arch))
|
|
fuchsia_out = os.path.join(FUCHSIA_ROOT, 'out', fuchsia_conf)
|
|
for file in BINARY_FILES:
|
|
manifest.write('%s=%s\n' % (os.path.join(dart_out, file),
|
|
os.path.join(fuchsia_out, file)))
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv))
|