mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Manual roll of Dart from 24c7666def...40fd1c456e dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest" dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland) dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants. dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner. dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests. dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA. dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider. dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone"" dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns." dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers" dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places. dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector. dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65 dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10 * Rev buildroot to latest version. * Update license. * update. * Update gn revision. * Format BUILD.gn files as the gn revision has been updated.
234 lines
7.0 KiB
Plaintext
234 lines
7.0 KiB
Plaintext
# Copyright 2013 The Flutter 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 file has rules for making Dart packages and Dart-based Mojo applications.
|
|
# The entrypoint is the dart_pkg rule.
|
|
|
|
import("//build/module_args/dart.gni")
|
|
|
|
template("dart_pkg_helper") {
|
|
assert(defined(invoker.package_name))
|
|
package_name = invoker.package_name
|
|
pkg_directory = rebase_path("$root_gen_dir/dart-pkg")
|
|
package_root = rebase_path("$root_gen_dir/dart-pkg/packages")
|
|
stamp_file = "$root_gen_dir/dart-pkg/${package_name}.stamp"
|
|
entries_file = "$root_gen_dir/dart-pkg/${package_name}.entries"
|
|
|
|
assert(defined(invoker.sources) || defined(invoker.apps) ||
|
|
defined(invoker.libs) || defined(invoker.pkg_dir))
|
|
|
|
action(target_name) {
|
|
deps = []
|
|
if (defined(invoker.deps)) {
|
|
deps += invoker.deps
|
|
}
|
|
|
|
datadeps = []
|
|
if (defined(invoker.datadeps)) {
|
|
datadeps += invoker.datadeps
|
|
}
|
|
|
|
sdk_ext_directory = []
|
|
if (defined(invoker.sdk_ext_directory)) {
|
|
sdk_ext_directory += [ invoker.sdk_ext_directory ]
|
|
}
|
|
|
|
sdk_ext_files = []
|
|
if (defined(invoker.sdk_ext_files)) {
|
|
sdk_ext_files += invoker.sdk_ext_files
|
|
}
|
|
|
|
sdk_ext_mappings = []
|
|
if (defined(invoker.sdk_ext_mappings)) {
|
|
sdk_ext_mappings += invoker.sdk_ext_mappings
|
|
}
|
|
|
|
script = rebase_path("//flutter/build/dart/tools/dart_pkg.py", ".", "//")
|
|
|
|
entrypoints = []
|
|
if (defined(invoker.apps)) {
|
|
foreach(app, invoker.apps) {
|
|
entrypoints += [ app[1] ]
|
|
}
|
|
}
|
|
if (defined(invoker.libs)) {
|
|
entrypoints += invoker.libs
|
|
}
|
|
|
|
sources = entrypoints
|
|
extra_flags = []
|
|
if (defined(invoker.sources)) {
|
|
sources += invoker.sources
|
|
} else if (defined(invoker.pkg_dir)) {
|
|
list_script = rebase_path("//flutter/build/dart/tools/ls.py", ".", "//")
|
|
extra_flags += [ "--read_only" ]
|
|
ls_sources = exec_script(list_script,
|
|
[
|
|
"--target-directory",
|
|
rebase_path(invoker.pkg_dir),
|
|
],
|
|
"list lines")
|
|
sources += ls_sources
|
|
}
|
|
|
|
# We have to use foreach to set up outputs instead of rebase_path because
|
|
# GN doesn't like assignments to outputs that aren't obviously under
|
|
# $root_gen_dir somewhere.
|
|
outputs = [
|
|
"$root_gen_dir/dart-pkg/${package_name}",
|
|
"$root_gen_dir/dart-pkg/${package_name}/pubspec.yaml",
|
|
"$root_gen_dir/dart-pkg/packages/${package_name}",
|
|
stamp_file,
|
|
]
|
|
|
|
inputs = [ script ] + rebase_path(sources)
|
|
|
|
args = [
|
|
"--package-name",
|
|
package_name,
|
|
"--dart-sdk",
|
|
rebase_path(dart_sdk_root),
|
|
"--pkg-directory",
|
|
pkg_directory,
|
|
"--package-root",
|
|
package_root,
|
|
"--stamp-file",
|
|
rebase_path(stamp_file),
|
|
"--entries-file",
|
|
rebase_path(entries_file),
|
|
"--package-sources",
|
|
] + rebase_path(sources) + [ "--package-entrypoints" ] +
|
|
rebase_path(entrypoints) + [ "--sdk-ext-directories" ] +
|
|
rebase_path(sdk_ext_directory) + [ "--sdk-ext-files" ] +
|
|
rebase_path(sdk_ext_files) + [ "--sdk-ext-mappings" ] +
|
|
sdk_ext_mappings + extra_flags
|
|
}
|
|
}
|
|
|
|
template("dart_pkg") {
|
|
if (defined(invoker.pkg_dir)) {
|
|
pubspec_yaml_path = rebase_path("pubspec.yaml", "", invoker.pkg_dir)
|
|
} else {
|
|
pubspec_yaml_path = rebase_path("pubspec.yaml")
|
|
}
|
|
dart_package_name_script =
|
|
rebase_path("//flutter/build/dart/tools/dart_package_name.py", ".", "//")
|
|
dart_package_name = exec_script(dart_package_name_script,
|
|
[
|
|
"--pubspec",
|
|
pubspec_yaml_path,
|
|
],
|
|
"trim string",
|
|
[ pubspec_yaml_path ])
|
|
|
|
dart_pkg_target_name = "${target_name}_pkg_helper"
|
|
dart_pkg_helper(dart_pkg_target_name) {
|
|
package_name = dart_package_name
|
|
if (defined(invoker.sources)) {
|
|
sources = invoker.sources
|
|
}
|
|
if (defined(invoker.apps)) {
|
|
apps = invoker.apps
|
|
}
|
|
if (defined(invoker.libs)) {
|
|
libs = invoker.libs
|
|
}
|
|
if (defined(invoker.pkg_dir)) {
|
|
pkg_dir = invoker.pkg_dir
|
|
}
|
|
if (defined(invoker.deps)) {
|
|
deps = invoker.deps
|
|
}
|
|
if (defined(invoker.datadeps)) {
|
|
datadeps = invoker.datadeps
|
|
}
|
|
if (defined(invoker.sdk_ext_directory)) {
|
|
sdk_ext_directory = invoker.sdk_ext_directory
|
|
}
|
|
if (defined(invoker.sdk_ext_files)) {
|
|
sdk_ext_files = invoker.sdk_ext_files
|
|
}
|
|
if (defined(invoker.sdk_ext_mappings)) {
|
|
sdk_ext_mappings = invoker.sdk_ext_mappings
|
|
}
|
|
}
|
|
|
|
if (defined(invoker.apps)) {
|
|
pkg_helper_output_dir = "$root_gen_dir/dart-pkg/${dart_package_name}"
|
|
foreach(app, invoker.apps) {
|
|
app_name = app[0]
|
|
app_entrypoint = app[1]
|
|
dartx_output_name = app_name
|
|
dartx_application("${app_name}_dart_app") {
|
|
output_name = dartx_output_name
|
|
main_dart = rebase_path(app_entrypoint, "", pkg_helper_output_dir)
|
|
sources = [ "$root_gen_dir/dart-pkg/${dart_package_name}.stamp" ]
|
|
deps = [ ":$dart_pkg_target_name" ]
|
|
deps += invoker.deps
|
|
if (defined(invoker.strict)) {
|
|
strict = invoker.strict
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group(target_name) {
|
|
public_deps = [ ":$dart_pkg_target_name" ]
|
|
if (defined(invoker.apps)) {
|
|
foreach(app, invoker.apps) {
|
|
app_name = app[0]
|
|
dartx_target_name = "${app_name}_dart_app"
|
|
deps += [ ":$dartx_target_name" ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Used to create dart_pkgs from a directory populated by fetch_dart_packages.py
|
|
#
|
|
# This build rule will result in a many packages under $root_gen_dir/dart-pkg/.
|
|
#
|
|
# base_dir (optional)
|
|
# Directory populated by fetch_dart_packages.py. Defaults to BUILD.gn
|
|
# directory.
|
|
template("dart_packages") {
|
|
base_dir = "."
|
|
if (defined(invoker.base_dir)) {
|
|
base_dir = invoker.base_dir
|
|
}
|
|
|
|
# Determine list of packages.
|
|
list_script =
|
|
rebase_path("build/dart/dart/tools/fetch_dart_packages.py", ".", "//")
|
|
packages = exec_script(list_script,
|
|
[
|
|
"--directory",
|
|
rebase_path(base_dir),
|
|
"--list",
|
|
],
|
|
"list lines",
|
|
[
|
|
rebase_path("pubspec.yaml"),
|
|
rebase_path("pubspec.lock"),
|
|
])
|
|
|
|
# Generate dart_pkg for each package.
|
|
foreach(package_dir, packages) {
|
|
dart_pkg("$package_dir") {
|
|
pkg_dir = rebase_path("$package_dir")
|
|
}
|
|
}
|
|
|
|
# Generate target group.
|
|
group(target_name) {
|
|
deps = []
|
|
foreach(package_dir, packages) {
|
|
deps += [ ":$package_dir" ]
|
|
}
|
|
if (defined(invoker.deps)) {
|
|
deps += invoker.deps
|
|
}
|
|
}
|
|
}
|