| Index: sdk/BUILD.gn
|
| diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
|
| index c9d7f6bcebb9a49da76618cccf6a0c441566e105..fa5f73ead95bbe7e774739d74716c8c8f1c653a4 100644
|
| --- a/sdk/BUILD.gn
|
| +++ b/sdk/BUILD.gn
|
| @@ -2,70 +2,247 @@
|
| # 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.
|
|
|
| -# The SDK for Fuchsia does not include:
|
| -# dart2js
|
| -# dartdoc
|
| -# ddc
|
| -# and libraries that are browser-specific, since these are not used and require
|
| -# significant time to build.
|
| -# TODO(zra): Assemble the SDK completely with GN, and remove create_sdk.py.
|
| -if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
|
| - template("copy_tree") {
|
| - assert(defined(invoker.source), "copy_tree must define 'source'")
|
| - assert(defined(invoker.dest), "copy_tree must define 'dest'")
|
| - source = invoker.source
|
| - dest = invoker.dest
|
| - action(target_name) {
|
| - deps = []
|
| - if (defined(invoker.deps)) {
|
| - deps += invoker.deps
|
| - }
|
| -
|
| - common_args = [
|
| - "--from",
|
| - rebase_path(source),
|
| - "--to",
|
| - rebase_path(dest),
|
| - ]
|
| - if (defined(invoker.exclude)) {
|
| - common_args += [
|
| - "--exclude",
|
| - invoker.exclude,
|
| - ]
|
| - }
|
| -
|
| - dry_run_args = common_args + [ "--dry-run" ]
|
| - input_files =
|
| - exec_script("../tools/copy_tree.py", dry_run_args, "list lines")
|
| - inputs = input_files
|
| - relative_files = rebase_path(input_files, rebase_path(source))
|
| -
|
| - output_files = []
|
| - foreach(input, relative_files) {
|
| - output_files += [ "$dest/$input" ]
|
| - }
|
| -
|
| - outputs = output_files
|
| - script = "../tools/copy_tree.py"
|
| - args = common_args
|
| - }
|
| - }
|
| +# This GN file contains build rules for assembling the Dart SDK. There are
|
| +# two possible variants: the "Full" SDK, and the "Platform" SDK. If you want
|
| +# to make a new subset of the Full SDK, make it the same way we make
|
| +# the Platform SDK.
|
| +#
|
| +# Warning:
|
| +# If you need to copy something into dart-sdk/lib/foo in addition to the stuff
|
| +# copied there by :copy_libraries, then you must depend on ":copy_libraries",
|
| +# or ":copy_libraries" may delete/overwrite your addition, and the build will
|
| +# fail.
|
| +
|
| +import("../build/copy_tree.gni")
|
| +
|
| +declare_args() {
|
| + # Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries.
|
| + dart_platform_sdk = false
|
| +}
|
|
|
| - copy("copy_dart") {
|
| - deps = [
|
| - "../runtime/bin:dart",
|
| +if (is_fuchsia || is_fuchsia_host) {
|
| + dart_platform_sdk = true
|
| +}
|
| +
|
| +# The directory layout of the SDK is as follows:
|
| +#
|
| +# ..dart-sdk/
|
| +# ....bin/
|
| +# ......dart or dart.exe (executable)
|
| +# ......dart.lib (import library for VM native extensions on Windows)
|
| +# ......dartdoc
|
| +# ......dartfmt
|
| +# ......dart2js
|
| +# ......dartanalyzer
|
| +# ......dartdevc
|
| +# ......pub
|
| +# ......snapshots/
|
| +# ........analysis_server.dart.snapshot
|
| +# ........dart2js.dart.snapshot
|
| +# ........dartanalyzer.dart.snapshot
|
| +# ........dartdoc.dart.snapshot
|
| +# ........dartfmt.dart.snapshot
|
| +# ........dartdevc.dart.snapshot
|
| +# ........pub.dart.snapshot
|
| +# ........utils_wrapper.dart.snapshot
|
| +#.........resources/
|
| +#...........dartdoc/
|
| +#..............packages
|
| +#.............resources/
|
| +#.............templates/
|
| +# ....include/
|
| +# ......dart_api.h
|
| +# ......dart_mirrors_api.h
|
| +# ......dart_native_api.h
|
| +# ......dart_tools_api.h
|
| +# ....lib/
|
| +# ......dart_client.platform
|
| +# ......dart_server.platform
|
| +# ......dart_shared.platform
|
| +# ......_internal/
|
| +#.........spec.sum
|
| +#.........strong.sum
|
| +#.........dev_compiler/
|
| +# ......analysis_server/
|
| +# ......analyzer/
|
| +# ......async/
|
| +# ......collection/
|
| +# ......convert/
|
| +# ......core/
|
| +# ......front_end/
|
| +# ......html/
|
| +# ......internal/
|
| +# ......io/
|
| +# ......isolate/
|
| +# ......js/
|
| +# ......js_util/
|
| +# ......kernel/
|
| +# ......math/
|
| +# ......mirrors/
|
| +# ......typed_data/
|
| +# ......api_readme.md
|
| +
|
| +# Scripts that go under bin/
|
| +_platform_sdk_scripts = [
|
| + "dartanalyzer",
|
| + "dartfmt",
|
| + "pub",
|
| +]
|
| +
|
| +_full_sdk_scripts = [
|
| + "dart2js",
|
| + "dartanalyzer",
|
| + "dartdevc",
|
| + "dartfmt",
|
| + "pub",
|
| +]
|
| +
|
| +# Scripts not ending in _sdk that go under bin/
|
| +_scripts = [ "dartdoc" ]
|
| +
|
| +# Snapshots that go under bin/snapshots
|
| +_platform_sdk_snapshots = [
|
| + [
|
| + "analysis_server",
|
| + "../utils/analysis_server",
|
| + ],
|
| + [
|
| + "dartanalyzer",
|
| + "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
|
| + ],
|
| + [
|
| + "dartdoc",
|
| + "../utils/dartdoc",
|
| + ],
|
| + [
|
| + "dartfmt",
|
| + "../utils/dartfmt",
|
| + ],
|
| + [
|
| + "pub",
|
| + "../utils/pub",
|
| + ],
|
| +]
|
| +
|
| +_full_sdk_snapshots = [
|
| + [
|
| + "analysis_server",
|
| + "../utils/analysis_server",
|
| + ],
|
| + [
|
| + "dart2js",
|
| + "../utils/compiler:dart2js",
|
| + ],
|
| + [
|
| + "dartanalyzer",
|
| + "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
|
| + ],
|
| + [
|
| + "dartdevc",
|
| + "../utils/dartdevc",
|
| + ],
|
| + [
|
| + "dartdoc",
|
| + "../utils/dartdoc",
|
| + ],
|
| + [
|
| + "dartfmt",
|
| + "../utils/dartfmt",
|
| + ],
|
| + [
|
| + "pub",
|
| + "../utils/pub",
|
| + ],
|
| + [
|
| + "utils_wrapper",
|
| + "../utils/compiler:utils_wrapper",
|
| + ],
|
| +]
|
| +
|
| +# Libraries that go under lib/
|
| +_platform_sdk_libraries = [
|
| + "_internal",
|
| + "async",
|
| + "collection",
|
| + "convert",
|
| + "core",
|
| + "developer",
|
| + "internal",
|
| + "io",
|
| + "isolate",
|
| + "math",
|
| + "mirrors",
|
| + "profiler",
|
| + "typed_data",
|
| +]
|
| +
|
| +_full_sdk_libraries = [
|
| + "_blink",
|
| + "_chrome",
|
| + "_internal",
|
| + "async",
|
| + "collection",
|
| + "convert",
|
| + "core",
|
| + "developer",
|
| + "html",
|
| + "indexed_db",
|
| + "internal",
|
| + "io",
|
| + "isolate",
|
| + "js",
|
| + "js_util",
|
| + "math",
|
| + "mirrors",
|
| + "profiler",
|
| + "svg",
|
| + "typed_data",
|
| + "web_audio",
|
| + "web_gl",
|
| + "web_sql",
|
| +]
|
| +
|
| +# Package sources copied to lib/
|
| +_analyzer_source_dirs = [
|
| + "analyzer",
|
| + "analysis_server",
|
| + "front_end",
|
| + "kernel",
|
| +]
|
| +
|
| +# Copies the Dart VM binary into bin/
|
| +copy("copy_dart") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + deps = [
|
| + "../runtime/bin:dart",
|
| + ]
|
| + dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
|
| + if (is_win) {
|
| + sources = [
|
| + "$dart_out/dart.exe",
|
| ]
|
| - dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
|
| - dart_name = get_label_info("../runtime/bin:dart", "name")
|
| + } else if (is_fuchsia || is_fuchsia_host) {
|
| sources = [
|
| - "$dart_out/$dart_name",
|
| + "$dart_out/dart",
|
| ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/bin/dart",
|
| + } else {
|
| + sources = [
|
| + "$dart_out/exe.stripped/dart",
|
| ]
|
| }
|
| + if (is_win) {
|
| + sources += [ "$dart_out/dart.lib" ]
|
| + }
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
|
| + ]
|
| +}
|
|
|
| +# Copies dynamically linked libraries into bin/. This is currently only needed
|
| +# for Fuchsia when building for Linux hosts.
|
| +if (is_fuchsia_host && is_linux) {
|
| copy("copy_dylibs") {
|
| + visibility = [ ":create_common_sdk" ]
|
| deps = [
|
| "//third_party/boringssl:crypto",
|
| "//third_party/boringssl:ssl",
|
| @@ -86,324 +263,490 @@ if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
|
| "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
|
| ]
|
| }
|
| +}
|
|
|
| - template("copy_sdk_script") {
|
| - assert(defined(invoker.name), "copy_sdk_script must define 'name'")
|
| - name = invoker.name
|
| - copy(target_name) {
|
| - sources = [
|
| - "bin/${name}_sdk",
|
| - ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/bin/${name}",
|
| - ]
|
| - }
|
| - }
|
| -
|
| - _sdk_scripts = [
|
| - "dartanalyzer",
|
| - "dartfmt",
|
| - "pub",
|
| - ]
|
| -
|
| - foreach(sdk_script, _sdk_scripts) {
|
| - copy_sdk_script("copy_${sdk_script}_script") {
|
| - name = sdk_script
|
| - }
|
| +# A template for copying the things in _platform_sdk_scripts and
|
| +# _full_sdk_scripts into bin/
|
| +template("copy_sdk_script") {
|
| + assert(defined(invoker.name), "copy_sdk_script must define 'name'")
|
| + name = invoker.name
|
| + ext = ""
|
| + if (is_win) {
|
| + ext = ".bat"
|
| }
|
| -
|
| - group("copy_scripts") {
|
| - deps = [
|
| - ":copy_dartanalyzer_script",
|
| - ":copy_dartfmt_script",
|
| - ":copy_pub_script",
|
| + copy(target_name) {
|
| + visibility = [
|
| + ":copy_platform_sdk_scripts",
|
| + ":copy_full_sdk_scripts",
|
| + ]
|
| + sources = [
|
| + "bin/${name}_sdk$ext",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/bin/$name$ext",
|
| ]
|
| }
|
| +}
|
|
|
| - _snapshots = [
|
| - [
|
| - "analysis_server",
|
| - "../utils/analysis_server",
|
| - ],
|
| - [
|
| - "dartanalyzer",
|
| - "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
|
| - ],
|
| - [
|
| - "dartfmt",
|
| - "../utils/dartfmt",
|
| - ],
|
| - [
|
| - "pub",
|
| - "../utils/pub",
|
| - ],
|
| - ]
|
| -
|
| - foreach(snapshot, _snapshots) {
|
| - copy("copy_${snapshot[0]}_snapshot") {
|
| - deps = [
|
| - snapshot[1],
|
| - ]
|
| - sources = [
|
| - "$root_gen_dir/${snapshot[0]}.dart.snapshot",
|
| - ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
|
| - ]
|
| - }
|
| - }
|
| -
|
| - group("copy_snapshots") {
|
| - deps = [
|
| - ":copy_analysis_server_snapshot",
|
| - ":copy_dartanalyzer_snapshot",
|
| - ":copy_dartfmt_snapshot",
|
| - ":copy_pub_snapshot",
|
| - ]
|
| +foreach(sdk_script, _full_sdk_scripts) {
|
| + copy_sdk_script("copy_${sdk_script}_script") {
|
| + name = sdk_script
|
| }
|
| +}
|
|
|
| - copy("copy_analysis_summaries") {
|
| - deps = [
|
| - ":copy_libraries",
|
| - "../utils/dartanalyzer:generate_summary_spec",
|
| - "../utils/dartanalyzer:generate_summary_strong",
|
| +foreach(script, _scripts) {
|
| + copy("copy_${script}_script") {
|
| + visibility = [
|
| + ":copy_platform_sdk_scripts",
|
| + ":copy_full_sdk_scripts",
|
| ]
|
| + ext = ""
|
| + if (is_win) {
|
| + ext = ".bat"
|
| + }
|
| sources = [
|
| - "$root_gen_dir/spec.sum",
|
| - "$root_gen_dir/strong.sum",
|
| + "bin/$script$ext",
|
| ]
|
| outputs = [
|
| - "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
|
| + "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
|
| ]
|
| }
|
| +}
|
| +
|
| +# This is the main target for copying scripts in _platform_sdk_scripts to bin/
|
| +group("copy_platform_sdk_scripts") {
|
| + visibility = [ ":create_platform_sdk" ]
|
| + deps = []
|
| + foreach(sdk_script, _platform_sdk_scripts) {
|
| + deps += [ ":copy_${sdk_script}_script" ]
|
| + }
|
| + foreach(script, _scripts) {
|
| + deps += [ ":copy_${script}_script" ]
|
| + }
|
| +}
|
|
|
| - copy("copy_headers") {
|
| - sources = [
|
| - "../runtime/include/dart_api.h",
|
| - "../runtime/include/dart_mirrors_api.h",
|
| - "../runtime/include/dart_native_api.h",
|
| - "../runtime/include/dart_tools_api.h",
|
| - ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/include/{{source_file_part}}",
|
| - ]
|
| +# This is the main target for copying scripts in _full_sdk_scripts to bin/
|
| +group("copy_full_sdk_scripts") {
|
| + visibility = [ ":create_full_sdk" ]
|
| + deps = []
|
| + foreach(sdk_script, _full_sdk_scripts) {
|
| + deps += [ ":copy_${sdk_script}_script" ]
|
| + }
|
| + foreach(script, _scripts) {
|
| + deps += [ ":copy_${script}_script" ]
|
| }
|
| +}
|
|
|
| - copy("copy_platform_files") {
|
| +# This loop generates "copy" targets that put snapshots into bin/snapshots
|
| +foreach(snapshot, _full_sdk_snapshots) {
|
| + copy("copy_${snapshot[0]}_snapshot") {
|
| + visibility = [
|
| + ":copy_platform_sdk_snapshots",
|
| + ":copy_full_sdk_snapshots",
|
| + ]
|
| + deps = [
|
| + snapshot[1],
|
| + ]
|
| sources = [
|
| - "lib/dart_client.platform",
|
| - "lib/dart_server.platform",
|
| - "lib/dart_shared.platform",
|
| + "$root_gen_dir/${snapshot[0]}.dart.snapshot",
|
| ]
|
| outputs = [
|
| - "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
|
| + "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
|
| ]
|
| }
|
| +}
|
|
|
| - copy_tree("copy_pub_assets") {
|
| - deps = [
|
| - ":copy_libraries",
|
| - ]
|
| - source = "../third_party/pkg/pub/lib/src/asset"
|
| - dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
|
| +# This is the main rule for copying snapshots from _platform_sdk_snapshots to
|
| +# bin/snapshots
|
| +group("copy_platform_sdk_snapshots") {
|
| + visibility = [ ":create_platform_sdk" ]
|
| + deps = []
|
| + foreach(snapshot, _platform_sdk_snapshots) {
|
| + deps += [ ":copy_${snapshot[0]}_snapshot" ]
|
| }
|
| +}
|
|
|
| - _libraries = [
|
| - "_internal",
|
| - "async",
|
| - "collection",
|
| - "convert",
|
| - "core",
|
| - "developer",
|
| - "internal",
|
| - "io",
|
| - "isolate",
|
| - "math",
|
| - "mirrors",
|
| - "profiler",
|
| - "typed_data",
|
| - ]
|
| -
|
| - foreach(library, _libraries) {
|
| - copy_tree("copy_${library}_library") {
|
| - source = "lib/$library"
|
| - dest = "$root_out_dir/dart-sdk/lib/$library"
|
| - exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
|
| - }
|
| +# This is the main rule for copying snapshots from _full_sdk_snapshots to
|
| +# bin/snapshots
|
| +group("copy_full_sdk_snapshots") {
|
| + visibility = [ ":create_full_sdk" ]
|
| + deps = []
|
| + foreach(snapshot, _full_sdk_snapshots) {
|
| + deps += [ ":copy_${snapshot[0]}_snapshot" ]
|
| }
|
| +}
|
|
|
| - group("copy_libraries") {
|
| - deps = [
|
| - ":copy__internal_library",
|
| - ":copy_async_library",
|
| - ":copy_collection_library",
|
| - ":copy_convert_library",
|
| - ":copy_core_library",
|
| - ":copy_developer_library",
|
| - ":copy_internal_library",
|
| - ":copy_io_library",
|
| - ":copy_isolate_library",
|
| - ":copy_math_library",
|
| - ":copy_mirrors_library",
|
| - ":copy_profiler_library",
|
| - ":copy_typed_data_library",
|
| - ]
|
| +# This loop generates rules for copying analyzer sources into lib/
|
| +foreach(analyzer_source_dir, _analyzer_source_dirs) {
|
| + copy_tree("copy_${analyzer_source_dir}_source_dir") {
|
| + visibility = [ ":copy_analyzer_sources" ]
|
| + source = "../pkg/$analyzer_source_dir"
|
| + dest = "$root_out_dir/dart-sdk/lib/$analyzer_source_dir"
|
| + exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore,packages"
|
| }
|
| +}
|
|
|
| - action("write_version_file") {
|
| - output = "$root_out_dir/dart-sdk/version"
|
| - outputs = [
|
| - output,
|
| - ]
|
| - script = "../tools/write_version_file.py"
|
| - args = [
|
| - "--output",
|
| - rebase_path(output),
|
| - ]
|
| +# This is the main rule for copying analyzer sources to lib/
|
| +group("copy_analyzer_sources") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + deps = []
|
| + foreach(analyzer_source_dir, _analyzer_source_dirs) {
|
| + deps += [ ":copy_${analyzer_source_dir}_source_dir" ]
|
| }
|
| +}
|
|
|
| - action("write_revision_file") {
|
| - output = "$root_out_dir/dart-sdk/revision"
|
| - outputs = [
|
| - output,
|
| - ]
|
| - script = "../tools/write_revision_file.py"
|
| - args = [
|
| - "--output",
|
| - rebase_path(output),
|
| +# This rule copies dartdoc templates to
|
| +# bin/snapshots/resources/dartdoc/templates
|
| +copy_tree("copy_dartdoc_templates") {
|
| + visibility = [ ":copy_dartdoc_files" ]
|
| + source = "../third_party/pkg/dartdoc/lib/templates"
|
| + dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/templates"
|
| +}
|
| +
|
| +# This rule copies dartdoc resources to
|
| +# bin/snapshots/resources/dartdoc/resources
|
| +copy_tree("copy_dartdoc_resources") {
|
| + visibility = [ ":copy_dartdoc_files" ]
|
| + source = "../third_party/pkg/dartdoc/lib/resources"
|
| + dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/resources"
|
| +}
|
| +
|
| +# This rule writes the .packages file for dartdoc resources.
|
| +write_file("$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/.packages",
|
| + "dartdoc:.")
|
| +
|
| +# This is the main rule for copying the files that dartdoc needs.
|
| +group("copy_dartdoc_files") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + deps = [
|
| + ":copy_dartdoc_resources",
|
| + ":copy_dartdoc_templates",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies analyzer summaries to lib/_internal
|
| +copy("copy_analysis_summaries") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + deps = [
|
| + ":copy_libraries",
|
| + "../utils/dartanalyzer:generate_summary_spec",
|
| + "../utils/dartanalyzer:generate_summary_strong",
|
| + ]
|
| + sources = [
|
| + "$root_gen_dir/spec.sum",
|
| + "$root_gen_dir/strong.sum",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies ddc summaries to lib/_internal
|
| +copy("copy_dev_compiler_summary") {
|
| + visibility = [ ":copy_dev_compiler_sdk" ]
|
| + deps = [
|
| + ":copy_libraries",
|
| + ]
|
| + sources = [
|
| + "../pkg/dev_compiler/lib/sdk/ddc_sdk.sum",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies js needed by ddc to lib/dev_compiler
|
| +copy_tree("copy_dev_compiler_js") {
|
| + visibility = [
|
| + ":copy_dev_compiler_sdk",
|
| + ":copy_dev_compiler_require_js",
|
| + ]
|
| + source = "../pkg/dev_compiler/lib/js"
|
| + dest = "$root_out_dir/dart-sdk/lib/dev_compiler"
|
| +}
|
| +
|
| +# This rule copies require.js to lib/dev_compiler/amd
|
| +copy("copy_dev_compiler_require_js") {
|
| + visibility = [ ":copy_dev_compiler_sdk" ]
|
| + deps = [
|
| + ":copy_dev_compiler_js",
|
| + ]
|
| + sources = [
|
| + "../third_party/requirejs/require.js",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/dev_compiler/amd/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +# This is the main rule for copying ddc's dependencies to lib/
|
| +group("copy_dev_compiler_sdk") {
|
| + visibility = [ ":create_full_sdk" ]
|
| + deps = [
|
| + ":copy_dev_compiler_js",
|
| + ":copy_dev_compiler_require_js",
|
| + ":copy_dev_compiler_summary",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies header files to include/
|
| +copy("copy_headers") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + sources = [
|
| + "../runtime/include/dart_api.h",
|
| + "../runtime/include/dart_mirrors_api.h",
|
| + "../runtime/include/dart_native_api.h",
|
| + "../runtime/include/dart_tools_api.h",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/include/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies .platform files to lib/
|
| +copy("copy_platform_files") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + sources = [
|
| + "lib/dart_client.platform",
|
| + "lib/dart_server.platform",
|
| + "lib/dart_shared.platform",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies pub assets to lib/_internal/pub/asset
|
| +copy_tree("copy_pub_assets") {
|
| + visibility = [
|
| + ":create_common_sdk",
|
| + ":copy_7zip",
|
| + ]
|
| + deps = [
|
| + ":copy_libraries",
|
| + ]
|
| + source = "../third_party/pkg/pub/lib/src/asset"
|
| + dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
|
| +}
|
| +
|
| +# This loop generates rules to copy libraries to lib/
|
| +foreach(library, _full_sdk_libraries) {
|
| + copy_tree("copy_${library}_library") {
|
| + visibility = [
|
| + ":copy_platform_sdk_libraries",
|
| + ":copy_full_sdk_libraries",
|
| ]
|
| + source = "lib/$library"
|
| + dest = "$root_out_dir/dart-sdk/lib/$library"
|
| + exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
|
| }
|
| +}
|
|
|
| - copy("copy_readme") {
|
| - sources = [
|
| - "../README.dart-sdk",
|
| - ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/README",
|
| - ]
|
| +# This is the main rule to copy libraries in _platform_sdk_libraries to lib/
|
| +group("copy_platform_sdk_libraries") {
|
| + visibility = [
|
| + ":create_platform_sdk",
|
| + ":copy_libraries",
|
| + ]
|
| + deps = []
|
| + foreach(library, _platform_sdk_libraries) {
|
| + deps += [ ":copy_${library}_library" ]
|
| }
|
| +}
|
|
|
| - copy("copy_license") {
|
| - sources = [
|
| - "../LICENSE",
|
| - ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/LICENSE",
|
| - ]
|
| +# This is the main rule to copy libraries in _full_sdk_libraries to lib/
|
| +group("copy_full_sdk_libraries") {
|
| + visibility = [
|
| + ":create_full_sdk",
|
| + ":copy_libraries",
|
| + ]
|
| + deps = []
|
| + foreach(library, _full_sdk_libraries) {
|
| + deps += [ ":copy_${library}_library" ]
|
| }
|
| +}
|
|
|
| - copy("copy_api_readme") {
|
| - sources = [
|
| - "api_readme.md",
|
| +group("copy_libraries") {
|
| + if (dart_platform_sdk) {
|
| + deps = [
|
| + ":copy_platform_sdk_libraries",
|
| ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/lib/api_readme.md",
|
| + } else {
|
| + deps = [
|
| + ":copy_full_sdk_libraries",
|
| ]
|
| }
|
| +}
|
|
|
| - group("create_sdk") {
|
| +if (is_win) {
|
| + copy_tree("copy_7zip") {
|
| + visibility = [ ":create_common_sdk" ]
|
| deps = [
|
| - ":copy_analysis_summaries",
|
| - ":copy_api_readme",
|
| - ":copy_dart",
|
| - ":copy_headers",
|
| ":copy_libraries",
|
| - ":copy_license",
|
| - ":copy_platform_files",
|
| ":copy_pub_assets",
|
| - ":copy_readme",
|
| - ":copy_scripts",
|
| - ":copy_snapshots",
|
| - ":write_revision_file",
|
| - ":write_version_file",
|
| ]
|
| - if (is_fuchsia_host && is_linux) {
|
| - deps += [ ":copy_dylibs" ]
|
| - }
|
| + source = "../third_party/7zip"
|
| + dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset/7zip"
|
| + exclude = ".svn"
|
| }
|
| -} else {
|
| - action("create_sdk") {
|
| - deps = [
|
| - "../runtime/bin:dart",
|
| - "../utils/analysis_server",
|
| - "../utils/compiler:dart2js",
|
| - "../utils/compiler:utils_wrapper",
|
| - "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
|
| - "../utils/dartanalyzer:generate_summary_spec",
|
| - "../utils/dartanalyzer:generate_summary_strong",
|
| - "../utils/dartdevc",
|
| - "../utils/dartdoc",
|
| - "../utils/dartfmt",
|
| - "../utils/pub",
|
| - ]
|
| +}
|
|
|
| - sdk_lib_files = exec_script("../tools/list_dart_files.py",
|
| - [
|
| - "absolute",
|
| - rebase_path("lib"),
|
| - ],
|
| - "list lines")
|
| -
|
| - preamble_files =
|
| - exec_script("../tools/list_files.py",
|
| - [
|
| - "absolute",
|
| - "",
|
| - rebase_path("lib/_internal/js_runtime/lib/preambles"),
|
| - ],
|
| - "list lines")
|
| -
|
| - sdk_bin_files = exec_script("../tools/list_files.py",
|
| - [
|
| - "absolute",
|
| - "",
|
| - rebase_path("bin"),
|
| - ],
|
| - "list lines")
|
| -
|
| - inputs = sdk_lib_files + preamble_files + sdk_bin_files + [
|
| - "lib/dart_client.platform",
|
| - "lib/dart_server.platform",
|
| - "lib/dart_shared.platform",
|
| - "$root_gen_dir/dart2js.dart.snapshot",
|
| - "$root_gen_dir/utils_wrapper.dart.snapshot",
|
| - "$root_gen_dir/pub.dart.snapshot",
|
| - "$root_gen_dir/dartanalyzer.dart.snapshot",
|
| - "$root_gen_dir/dartdevc.dart.snapshot",
|
| - "$root_gen_dir/dartfmt.dart.snapshot",
|
| - "$root_gen_dir/analysis_server.dart.snapshot",
|
| - "$root_gen_dir/dartdoc.dart.snapshot",
|
| - "$root_gen_dir/spec.sum",
|
| - "$root_gen_dir/strong.sum",
|
| - "../tools/VERSION",
|
| - ]
|
| +# This rule writes the version file.
|
| +action("write_version_file") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + output = "$root_out_dir/dart-sdk/version"
|
| + outputs = [
|
| + output,
|
| + ]
|
| + script = "../tools/write_version_file.py"
|
| + args = [
|
| + "--output",
|
| + rebase_path(output),
|
| + ]
|
| +}
|
|
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/README",
|
| - ]
|
| +# This rule writes the revision file.
|
| +action("write_revision_file") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + output = "$root_out_dir/dart-sdk/revision"
|
| + outputs = [
|
| + output,
|
| + ]
|
| + script = "../tools/write_revision_file.py"
|
| + args = [
|
| + "--output",
|
| + rebase_path(output),
|
| + ]
|
| +}
|
|
|
| - script = "../tools/create_sdk.py"
|
| - args = [
|
| - "--sdk_output_dir",
|
| - rebase_path("$root_out_dir/dart-sdk"),
|
| - "--snapshot_location",
|
| - rebase_path("$root_gen_dir"),
|
| - ]
|
| +# Copy libraries.dart to lib/_internal/libraries.dart for backwards
|
| +# compatibility.
|
| +#
|
| +# TODO(sigmund): stop copying libraries.dart. Old versions (<=0.25.1-alpha.4)
|
| +# of the analyzer package do not support the new location of this file. We
|
| +# should be able to remove the old file once we release a newer version of
|
| +# analyzer and popular frameworks have migrated to use it.
|
| +copy("copy_libraries_dart") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + deps = [
|
| + ":copy_libraries",
|
| + ]
|
| + sources = [
|
| + "lib/_internal/sdk_library_metadata/lib/libraries.dart",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies the README file.
|
| +copy("copy_readme") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + sources = [
|
| + "../README.dart-sdk",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/README",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies the LICENSE file.
|
| +copy("copy_license") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + sources = [
|
| + "../LICENSE",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/LICENSE",
|
| + ]
|
| +}
|
| +
|
| +# This rule copies the API readme file to lib/
|
| +copy("copy_api_readme") {
|
| + visibility = [ ":create_common_sdk" ]
|
| + sources = [
|
| + "api_readme.md",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/api_readme.md",
|
| + ]
|
| +}
|
| +
|
| +# Parts common to both platform and full SDKs.
|
| +group("create_common_sdk") {
|
| + visibility = [ ":create_sdk" ]
|
| + deps = [
|
| + ":copy_analysis_summaries",
|
| + ":copy_analyzer_sources",
|
| + ":copy_api_readme",
|
| + ":copy_dart",
|
| + ":copy_dartdoc_files",
|
| + ":copy_headers",
|
| + ":copy_libraries_dart",
|
| + ":copy_license",
|
| + ":copy_platform_files",
|
| + ":copy_pub_assets",
|
| + ":copy_readme",
|
| + ":write_revision_file",
|
| + ":write_version_file",
|
| + ]
|
| + if (is_win) {
|
| + deps += [ ":copy_7zip" ]
|
| + }
|
| + if (is_fuchsia_host && is_linux) {
|
| + deps += [ ":copy_dylibs" ]
|
| }
|
| +}
|
|
|
| - copy("copy_dev_compiler_tools") {
|
| - deps = [
|
| - ":create_sdk",
|
| - "../utils/dartdevc:dartdevc_web",
|
| - "../utils/dartdevc:stack_trace_mapper",
|
| - ]
|
| - dart_out = get_label_info("../utils/dartdevc:dartdevc_web", "root_out_dir")
|
| - sources = [
|
| - "$dart_out/dev_compiler/build/web/ddc_web_compiler.js",
|
| - "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
|
| - ]
|
| - outputs = [
|
| - "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
|
| - ]
|
| +# Parts specific to the platform SDK.
|
| +group("create_platform_sdk") {
|
| + visibility = [ ":create_sdk" ]
|
| + deps = [
|
| + ":copy_platform_sdk_libraries",
|
| + ":copy_platform_sdk_scripts",
|
| + ":copy_platform_sdk_snapshots",
|
| + ]
|
| +}
|
| +
|
| +# Parts specific to the full SDK.
|
| +group("create_full_sdk") {
|
| + visibility = [
|
| + ":copy_dev_compiler_tools",
|
| + ":create_sdk",
|
| + ]
|
| + deps = [
|
| + ":copy_dev_compiler_sdk",
|
| + ":copy_full_sdk_libraries",
|
| + ":copy_full_sdk_scripts",
|
| + ":copy_full_sdk_snapshots",
|
| + ]
|
| +}
|
| +
|
| +# The main target to depend on from ../BUILD.gn
|
| +group("create_sdk") {
|
| + deps = [
|
| + ":create_common_sdk",
|
| + ]
|
| + if (dart_platform_sdk) {
|
| + deps += [ ":create_platform_sdk" ]
|
| + } else {
|
| + deps += [ ":create_full_sdk" ]
|
| }
|
| }
|
| +
|
| +# This rule copies tools to go along with ddc.
|
| +copy("copy_dev_compiler_tools") {
|
| + deps = [
|
| + ":create_full_sdk",
|
| + "../utils/dartdevc:dartdevc_web",
|
| + "../utils/dartdevc:stack_trace_mapper",
|
| + ]
|
| + dart_out = get_label_info("../utils/dartdevc:dartdevc_web", "root_out_dir")
|
| + sources = [
|
| + "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
|
| + "$dart_out/dev_compiler/build/web/ddc_web_compiler.js",
|
| + ]
|
| + outputs = [
|
| + "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
|
| + ]
|
| +}
|
|
|