Fuchsia: Allows building the full SDK for host and target.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2571713004 .
This commit is contained in:
Zachary Anderson 2016-12-13 13:02:52 -08:00
parent f1ae158a2a
commit 7f55ad8b86
9 changed files with 222 additions and 201 deletions

View file

@ -4,12 +4,20 @@
# This target will be built if no target is specified when invoking ninja.
group("default") {
if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [
":runtime",
]
}
group("most") {
if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [
":analysis_server",
":create_sdk",
@ -22,6 +30,10 @@ group("most") {
}
group("runtime") {
if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [
"runtime/bin:dart",
"runtime/bin:dart_bootstrap($host_toolchain)",
@ -42,6 +54,9 @@ group("runtime_precompiled") {
}
group("runtime_and_noopt") {
if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
testonly = true
}
deps = [
"runtime/bin:dart",
"runtime/bin:dart_bootstrap($host_toolchain)",

View file

@ -785,7 +785,7 @@ action("generate_snapshot_test_dat_file") {
}
executable("run_vm_tests") {
if (defined(is_fuchsia) && is_fuchsia) {
if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
testonly = true
}
@ -836,44 +836,42 @@ executable("run_vm_tests") {
}
}
if (!defined(is_fuchsia) || !is_fuchsia) {
shared_library("test_extension") {
deps = [
":dart",
]
sources = [
"test_extension.c",
"test_extension_dllmain_win.cc",
]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
"DART_SHARED_LIB",
]
if (is_win) {
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
}
}
shared_library("sample_extension") {
deps = [
":dart",
]
sources = [
"../../samples/sample_extension/sample_extension.cc",
"../../samples/sample_extension/sample_extension_dllmain_win.cc",
]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
"DART_SHARED_LIB",
]
if (is_win) {
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
}
shared_library("test_extension") {
deps = [
":dart",
]
sources = [
"test_extension.c",
"test_extension_dllmain_win.cc",
]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
"DART_SHARED_LIB",
]
if (is_win) {
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
}
}
shared_library("sample_extension") {
deps = [
":dart",
]
sources = [
"../../samples/sample_extension/sample_extension.cc",
"../../samples/sample_extension/sample_extension_dllmain_win.cc",
]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
"DART_SHARED_LIB",
]
if (is_win) {
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
}
}

View file

@ -378,157 +378,155 @@ 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[0]
# Concatenate vm library patches.
foreach(library, invoker.libraries) {
name = library[0]
target_output = "$target_gen_dir/patches/${name}_patch.dart"
concatenate_patch("concatenate_${name}_patch") {
libsources = rebase_path(library[1], ".", library[2])
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
if (!prebuilt_dart_exe_works) {
deps += [ "../bin:dart_bootstrap($host_toolchain)" ]
}
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",
[
"absolute",
rebase_path("../../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 = []
if (!prebuilt_dart_exe_works) {
dart_out_dir = get_label_info("../bin:dart_bootstrap($host_toolchain)",
"root_out_dir")
dart_bootstrap =
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
args += [
"--dart-executable",
dart_bootstrap,
]
}
args += [
"vm",
rebase_path("../../sdk"),
rebase_path(patches_dir, root_build_dir),
rebase_path(patched_sdk_dir, root_build_dir),
]
target_output = "$target_gen_dir/patches/${name}_patch.dart"
concatenate_patch("concatenate_${name}_patch") {
libsources = rebase_path(library[1], ".", library[2])
output = target_output
}
concatenation_target_names += [ ":concatenate_${name}_patch" ]
concatenation_files += [ target_output ]
}
generate_patched_sdk("patched_sdk") {
libraries = [
[
"async",
processed_gypis.async_runtime_sources,
"../lib",
],
[
"collection",
processed_gypis.collection_runtime_sources,
"../lib",
],
[
"convert",
processed_gypis.convert_runtime_sources,
"../lib",
],
[
"core",
processed_gypis.core_runtime_sources,
"../lib",
],
[
"developer",
processed_gypis.developer_runtime_sources,
"../lib",
],
[
"internal",
processed_gypis.internal_runtime_sources,
"../lib",
],
[
"isolate",
processed_gypis.isolate_runtime_sources,
"../lib",
],
[
"math",
processed_gypis.math_runtime_sources,
"../lib",
],
[
"mirrors",
processed_gypis.mirrors_runtime_sources,
"../lib",
],
[
"profiler",
processed_gypis.profiler_runtime_sources,
"../lib",
],
[
"vmservice",
processed_gypis.vmservice_runtime_sources,
"../lib",
],
[
"io",
processed_gypis.bin_io_sources,
"../bin",
],
# Build the patched sdk out of the concatenated patches and the special
# libraries.
action(target_name) {
deps = concatenation_target_names
if (!prebuilt_dart_exe_works) {
deps += [ "../bin:dart_bootstrap($host_toolchain)" ]
}
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",
[
"absolute",
rebase_path("../../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 = [ "--quiet" ]
if (!prebuilt_dart_exe_works) {
dart_out_dir = get_label_info("../bin:dart_bootstrap($host_toolchain)",
"root_out_dir")
dart_bootstrap =
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
args += [
"--dart-executable",
dart_bootstrap,
]
}
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 = [
[
"async",
processed_gypis.async_runtime_sources,
"../lib",
],
[
"collection",
processed_gypis.collection_runtime_sources,
"../lib",
],
[
"convert",
processed_gypis.convert_runtime_sources,
"../lib",
],
[
"core",
processed_gypis.core_runtime_sources,
"../lib",
],
[
"developer",
processed_gypis.developer_runtime_sources,
"../lib",
],
[
"internal",
processed_gypis.internal_runtime_sources,
"../lib",
],
[
"isolate",
processed_gypis.isolate_runtime_sources,
"../lib",
],
[
"math",
processed_gypis.math_runtime_sources,
"../lib",
],
[
"mirrors",
processed_gypis.mirrors_runtime_sources,
"../lib",
],
[
"profiler",
processed_gypis.profiler_runtime_sources,
"../lib",
],
[
"vmservice",
processed_gypis.vmservice_runtime_sources,
"../lib",
],
[
"io",
processed_gypis.bin_io_sources,
"../bin",
],
]
}

1
tools/create_timestamp_file.py Normal file → Executable file
View file

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

View file

@ -25,7 +25,13 @@ 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)
result.add_argument("-q", "--quiet",
help="emit no output",
default=False,
action="store_true")
result.add_argument("--dart-executable",
help="dart executable",
default=None)
return result
def main():
@ -35,7 +41,8 @@ def main():
if utils.CheckedInSdkCheckExecutable():
options.dart_executable = utils.CheckedInSdkExecutable()
elif options.dart_executable is not None:
DisplayBootstrapWarning()
if not options.quiet:
DisplayBootstrapWarning()
options.dart_executable = os.path.abspath(options.dart_executable)
else:
print >> sys.stderr, 'ERROR: cannot locate dart executable'

View file

@ -2,7 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import("//build/compiled_action.gni")
import("../build/compiled_action.gni")
_dart_root = rebase_path("..")

View file

@ -2,13 +2,13 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import("//build/compiled_action.gni")
import("../../build/compiled_action.gni")
import("../create_timestamp.gni")
import("../application_snapshot.gni")
create_timestamp_file("dart2js_files_stamp") {
path = rebase_path("../../pkg/compiler/lib")
output = "$root_gen_dir/dart2js_files.stamp"
output = "$target_gen_dir/dart2js_files.stamp"
}
create_timestamp_file("runtime_lib_files_stamp") {
@ -31,17 +31,17 @@ compiled_action("dart2js_create_snapshot_entries") {
dot_packages = rebase_path("../../.packages")
create_snapshot_entry = rebase_path("create_snapshot_entry.dart")
output_dir = rebase_path(root_gen_dir)
output_dir = rebase_path(target_gen_dir)
inputs = [
"../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart",
create_snapshot_entry,
"$root_gen_dir/dart2js_files.stamp",
"$target_gen_dir/dart2js_files.stamp",
"../../tools/VERSION",
]
utils_output = "$root_gen_dir/utils_wrapper.dart"
dart2js_output = "$root_gen_dir/dart2js.dart"
utils_output = "$target_gen_dir/utils_wrapper.dart"
dart2js_output = "$target_gen_dir/dart2js.dart"
outputs = [
utils_output,
dart2js_output,
@ -59,11 +59,12 @@ application_snapshot("dart2js") {
deps = [
":dart2js_create_snapshot_entries",
]
main_dart = "$root_gen_dir/dart2js.dart"
main_dart = "$target_gen_dir/dart2js.dart"
training_args = [
"--packages=" + rebase_path("../../.packages"),
"--library-root=" + rebase_path("../../sdk"),
"--categories=all",
rebase_path("$root_gen_dir/dart2js.dart"),
rebase_path("$target_gen_dir/dart2js.dart"),
]
}
@ -71,6 +72,6 @@ application_snapshot("utils_wrapper") {
deps = [
":dart2js_create_snapshot_entries",
]
main_dart = "$root_gen_dir/utils_wrapper.dart"
main_dart = "$target_gen_dir/utils_wrapper.dart"
training_args = [ "--help" ]
}

View file

@ -2,7 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import("//build/compiled_action.gni")
import("../../build/compiled_action.gni")
import("../application_snapshot.gni")
group("dartanalyzer") {
@ -50,13 +50,12 @@ template("generate_summary") {
dot_packages = rebase_path("../../.packages")
build_sdk_summaries =
rebase_path("../../pkg/analyzer/tool/summary/build_sdk_summaries.dart")
abs_output = rebase_path(output)
args = [
"--packages=$dot_packages",
build_sdk_summaries,
"build-$type",
abs_output,
rebase_path(output),
rebase_path("../../sdk"),
]
}

View file

@ -10,7 +10,9 @@ application_snapshot("pub") {
deps = [
"../compiler:dart2js_files_stamp",
]
dart2js_gen_dir =
get_label_info("../compiler:dart2js_files_stamp", "target_gen_dir")
inputs = [
"$root_gen_dir/dart2js_files.stamp",
"$dart2js_gen_dir/dart2js_files.stamp",
]
}