Emit patched_sdk in the root output directory.

Previously it was emitted in the directory used for intermediate files, which
is build system specific.

test.py script needs to locate patched_sdk thus its location must be aligned
between build systems.

Use checked in SDK if available and fallback on dart_boostrap if not available to speed up Debug builds

BUG=
R=kustermann@google.com

Review URL: https://codereview.chromium.org/2469683002 .
This commit is contained in:
Vyacheslav Egorov 2016-11-01 17:34:27 +01:00
parent 0e9d63d034
commit d96c11fcdd
4 changed files with 140 additions and 125 deletions

View file

@ -415,130 +415,128 @@ template("concatenate_patch") {
}
if (!defined(is_fuchsia) || !is_fuchsia) {
template("generate_patched_sdk") {
assert(defined(invoker.libraries), "Need libraries in $target_name")
template("generate_patched_sdk") {
assert(defined(invoker.libraries), "Need libraries in $target_name")
concatenation_target_names = []
concatenation_files = []
concatenation_target_names = []
concatenation_files = []
# Concatenate vm library patches.
foreach(library, invoker.libraries) {
name = library[1]
# Concatenate vm library patches.
foreach(library, invoker.libraries) {
name = library[1]
target_output = "$target_gen_dir/patches/${name}_patch.dart"
concatenate_patch("concatenate_${name}_patch") {
libname = name
dir = library[0]
output = target_output
target_output = "$target_gen_dir/patches/${name}_patch.dart"
concatenate_patch("concatenate_${name}_patch") {
libname = name
dir = library[0]
output = target_output
}
concatenation_target_names += [ ":concatenate_${name}_patch" ]
concatenation_files += [ target_output ]
}
# Build the patched sdk out of the concatenated patches and the special
# libraries.
action(target_name) {
deps = concatenation_target_names
patches_dir = "$target_gen_dir/patches"
patched_sdk_dir = "$root_out_dir/patched_sdk"
script = "../../tools/patch_sdk.py"
# We list all files which make up the sdk (modulo patches) and get them back
# as a GN list object.
shared_sdk_sources = exec_script("../../tools/list_dart_files.py",
[ "../../sdk/lib" ],
"list lines")
# We list the `patch_sdk.dart` tool here because the [script] (which is
# implicitly an input) will call it.
inputs = [
"../../tools/patch_sdk.dart",
]
# Files below are not patches, they will not be in [concatenation_files] but
# the `patch_sdk.dart` script will copy them into the patched sdk.
inputs += [
"../lib/typed_data.dart",
"../bin/builtin.dart",
"../bin/vmservice/vmservice_io.dart",
"../bin/vmservice/loader.dart",
"../bin/vmservice/server.dart",
]
# Add all the normal sdk sources.
inputs += shared_sdk_sources
# Add all the concatenated patch files.
inputs += concatenation_files
outputs = [
# Instead of listing all outputs we list a single well-known one.
"${patched_sdk_dir}/lib/core/core.dart",
]
args = [
"vm",
rebase_path("../../sdk"),
rebase_path(patches_dir, root_build_dir),
rebase_path(patched_sdk_dir, root_build_dir),
]
}
concatenation_target_names += [ ":concatenate_${name}_patch" ]
concatenation_files += [ target_output ]
}
# Build the patched sdk out of the concatenated patches and the special
# libraries.
action(target_name) {
deps = concatenation_target_names
patches_dir = "$target_gen_dir/patches"
patched_sdk_dir = "$target_gen_dir/patched_sdk"
script = "../../tools/patch_sdk.py"
# We list all files which make up the sdk (modulo patches) and get them back
# as a GN list object.
shared_sdk_sources = exec_script("../../tools/list_dart_files.py",
[ "../../sdk/lib" ],
"list lines")
# We list the `patch_sdk.dart` tool here because the [script] (which is
# implicitly an input) will call it.
inputs = [
"../../tools/patch_sdk.dart",
]
# Files below are not patches, they will not be in [concatenation_files] but
# the `patch_sdk.dart` script will copy them into the patched sdk.
inputs += [
"../lib/typed_data.dart",
"../bin/builtin.dart",
"../bin/vmservice/vmservice_io.dart",
"../bin/vmservice/loader.dart",
"../bin/vmservice/server.dart",
]
# Add all the normal sdk sources.
inputs += shared_sdk_sources
# Add all the concatenated patch files.
inputs += concatenation_files
outputs = [
# Instead of listing all outputs we list a single well-known one.
"${patched_sdk_dir}/lib/core/core.dart",
]
args = [
"vm",
rebase_path("../../sdk"),
rebase_path(patches_dir, root_build_dir),
rebase_path(patched_sdk_dir, root_build_dir),
generate_patched_sdk("patched_sdk") {
libraries = [
[
"lib",
"async",
],
[
"lib",
"collection",
],
[
"lib",
"convert",
],
[
"lib",
"core",
],
[
"lib",
"developer",
],
[
"lib",
"internal",
],
[
"lib",
"isolate",
],
[
"lib",
"math",
],
[
"lib",
"mirrors",
],
[
"lib",
"profiler",
],
[
"lib",
"vmservice",
],
[
"bin",
"io",
],
]
}
}
generate_patched_sdk("patched_sdk") {
libraries = [
[
"lib",
"async",
],
[
"lib",
"collection",
],
[
"lib",
"convert",
],
[
"lib",
"core",
],
[
"lib",
"developer",
],
[
"lib",
"internal",
],
[
"lib",
"isolate",
],
[
"lib",
"math",
],
[
"lib",
"mirrors",
],
[
"lib",
"profiler",
],
[
"lib",
"vmservice",
],
[
"bin",
"io",
],
]
}
}

View file

@ -1290,7 +1290,7 @@
],
'outputs': [
# Instead of listing all outputs we list a single well-known one.
'<(gen_source_dir)/patched_sdk/lib/core/core.dart',
'<(PRODUCT_DIR)/patched_sdk/lib/core/core.dart',
],
'action': [
'python',
@ -1300,7 +1300,7 @@
'vm',
'../sdk',
'<(gen_source_dir)/patches',
'<(gen_source_dir)/patched_sdk',
'<(PRODUCT_DIR)/patched_sdk',
],
},
],

View file

@ -11,6 +11,18 @@ import utils
usage = """patch_sdk.py [options]"""
def DisplayBootstrapWarning():
print """\
WARNING: Your system cannot run the checked-in Dart SDK. Using the
bootstrap Dart executable will make debug builds slow.
Please see the Wiki for instructions on replacing the checked-in Dart SDK.
https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools
"""
def BuildArguments():
result = argparse.ArgumentParser(usage=usage)
result.add_argument("--dart-executable", help="dart executable", default=None)
@ -20,12 +32,17 @@ def main():
# Parse the options.
parser = BuildArguments()
(options, args) = parser.parse_known_args()
if options.dart_executable is not None:
if utils.CheckedInSdkCheckExecutable():
options.dart_executable = utils.CheckedInSdkExecutable()
elif options.dart_executable is not None:
DisplayBootstrapWarning()
options.dart_executable = os.path.abspath(options.dart_executable)
else:
options.dart_executable = os.path.join(utils.CheckedInSdkPath(), 'bin', 'dart')
print >> sys.stderr, 'ERROR: cannot locate dart executable'
return -1
dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart')
subprocess.check_call([options.dart_executable, dart_file] + args);
subprocess.check_call([options.dart_executable, dart_file] + args)
return 0
if __name__ == '__main__':
main()
sys.exit(main())

View file

@ -228,7 +228,7 @@ class DartKCompilerConfiguration extends CompilerConfiguration {
Map<String, String> environmentOverrides) {
var extraArguments = [
'--sdk',
'$buildDir/obj/gen/patched_sdk',
'$buildDir/patched_sdk',
'--link',
'--target=vm',
'--out',