Skip to content

Commit

Permalink
Merge branch 'flutter:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiehe-google-com committed Sep 25, 2024
2 parents afdb4b7 + c558459 commit 8a3d63a
Show file tree
Hide file tree
Showing 57 changed files with 1,278 additions and 2,666 deletions.
8 changes: 4 additions & 4 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vars = {
'flutter_git': 'https://flutter.googlesource.com',
'skia_git': 'https://skia.googlesource.com',
'llvm_git': 'https://llvm.googlesource.com',
'skia_revision': '2e92f0b443f4ac362bc0be0560b15a379fe5043d',
'skia_revision': '9f3b32b7b772d748ab1f9e3b96192bd2a1e3219f',

# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
Expand Down Expand Up @@ -56,7 +56,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '7af8c4882e07c8bc0f540c0cf80bcacaabfdc941',
'dart_revision': 'c2728b947e46b42fe0ce210247c4474c652ab24c',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand Down Expand Up @@ -255,7 +255,7 @@ vars = {

# The version / instance id of the cipd:chromium/fuchsia/gn-sdk which will be
# used altogether with fuchsia-sdk to generate gn based build rules.
'fuchsia_gn_sdk_version': 'em2Jr5ylJrKKI86rUNPyGXlpTo4qGNTePgT70PDtRT8C',
'fuchsia_gn_sdk_version': 'tHRCseOuPnZ5H4a7kb4Zl6YQ2rhEDWIzcEX3G9NPFhkC',
}

gclient_gn_args_file = 'src/flutter/third_party/dart/build/config/gclient_args.gni'
Expand Down Expand Up @@ -960,7 +960,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/linux-amd64',
'version': '-kKh_AYzPh_iEmTxKBbtNwlmYMh9MBAnyO1BTFhQjUAC'
'version': 'T0BbBnkQd0GfMnGQcJ9u06UKCMOVmK4oVCZJiVJGKWYC'
}
],
'condition': 'download_fuchsia_deps and not download_fuchsia_sdk',
Expand Down
148 changes: 148 additions & 0 deletions build/dart/internal/application_snapshot.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# 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.

import("//build/compiled_action.gni")
import("//build/module_args/dart.gni")
import("//flutter/build/dart/dart.gni")
import("//flutter/common/config.gni")

import("$dart_src/build/dart/dart_action.gni")
import("$dart_src/sdk_args.gni")

# Creates an app-jit snapshot for a command-line Dart program based on a
# training run.
#
# Parameters:
# main_dart (required):
# The entrypoint to the Dart application.
#
# training_args (required):
# Arguments to pass to the Dart application for the training run.
#
# vm_args (optional):
# Additional arguments to the Dart VM.
#
# deps (optional):
# Any build dependencies.
#
# package_config (required):
# The .packages file for the app. Defaults to the $_dart_root/.packages.
#
# output (optional):
# Overrides the full output path.
#
# snapshot_kind (optional)
# Either an "app-jit" snapshot (default) or a "kernel" snapshot
template("application_snapshot") {
assert(defined(invoker.main_dart), "Must specify 'main_dart'")
assert(defined(invoker.training_args), "Must specify 'training_args'")

main_dart = invoker.main_dart
training_args = invoker.training_args
name = target_name

package_config = ""
if (defined(invoker.package_config)) {
package_config = rebase_path(invoker.package_config, root_build_dir)
} else {
# Use the root engine package config by default.
# As we move towards a single pub workspace for the engine, this will be
# the correct package config to use, as we will no longer have a per-package
# .dart_tool/package_config.json.
package_config = rebase_path("//flutter/.dart_tool/package_config.json")
}

extra_deps = []
if (defined(invoker.deps)) {
extra_deps += invoker.deps
}
extra_inputs = [ main_dart ]
if (defined(invoker.inputs)) {
extra_inputs += invoker.inputs
}
output = "$root_gen_dir/$name.dart.snapshot"
if (defined(invoker.output)) {
output = invoker.output
}

depfile = output + ".d"
abs_depfile = rebase_path(depfile)
abs_output = rebase_path(output)
rel_output = rebase_path(output, root_build_dir)
snapshot_vm_args = [
"--deterministic",
"--packages=$package_config",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
"--depfile-output-filename=$rel_output",
]
if (defined(invoker.vm_args)) {
snapshot_vm_args += invoker.vm_args
}

snapshot_kind = "app-jit"
if (target_cpu != host_cpu) {
snapshot_kind = "kernel"
}
if (defined(invoker.snapshot_kind)) {
snapshot_kind = invoker.snapshot_kind
}
if (snapshot_kind == "kernel") {
snapshot_vm_args += [ "--snapshot-kind=kernel" ]
} else if (snapshot_kind == "app-jit") {
snapshot_vm_args += [ "--snapshot-kind=app-jit" ]
} else {
assert(false, "Bad snapshot_kind: '$snapshot_kind'")
}

# Ensure the compiled appliation (e.g. frontend-server, ...) will use this
# Dart SDK hash when consuming/producing kernel.
#
# (Instead of ensuring every user of the "application_snapshot" passes its
# own)
snapshot_vm_args += [ "-Dsdk_hash=$sdk_hash" ]

if (flutter_prebuilt_dart_sdk) {
action(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
deps = extra_deps
script = "//build/gn_run_binary.py"
inputs = extra_inputs
outputs = [ output ]
depfile = depfile
pool = "//build/toolchain:toolchain_pool"

ext = ""
if (is_win) {
ext = ".exe"
}
dart = rebase_path("$host_prebuilt_dart_sdk/bin/dart$ext", root_build_dir)

args = [ dart ]
args += snapshot_vm_args
args += [ rebase_path(main_dart) ]
args += training_args
}
} else {
dart_action(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
script = main_dart
pool = "//build/toolchain:toolchain_pool"
deps = extra_deps
inputs = extra_inputs
outputs = [ output ]
depfile = depfile
vm_args = snapshot_vm_args
args = training_args
}
}
}
121 changes: 121 additions & 0 deletions build/dart/internal/flutter_frontend_server.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 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.

import("//flutter/build/dart/dart.gni")
import("//flutter/common/config.gni")

import("$dart_src/build/dart/dart_action.gni")

# Generates a Dart kernel snapshot using flutter_frontend_server.
#
# Arguments
# main_dart (required):
# The Dart entrypoint file.
#
# kernel_output (required):
# The path to the output kernel snapshot in the out directory.
#
# package_config (optional):
# The path to the package_config.json file.
#
# deps (optional):
# Additional dependencies. Dependencies on the frontend server and
# Flutter's platform.dill are included by default. This rule creates and
# uses a depfile, so listing all Dart sources is not necessary.
#
# extra_args (optional):
# Additional frontend server command line arguments.
template("flutter_frontend_server") {
assert(defined(invoker.main_dart), "The Dart test file must be specified.")
assert(defined(invoker.kernel_output),
"The Dart Kernel file location must be specified.")

kernel_output = invoker.kernel_output

common_deps = [ "//flutter/lib/snapshot:strong_platform" ]
if (defined(invoker.deps)) {
common_deps += invoker.deps
}

extra_args = []
if (defined(invoker.extra_args)) {
extra_args += invoker.extra_args
}

packages_args = []
package_config = ""
if (defined(invoker.package_config)) {
package_config = rebase_path(invoker.package_config, root_build_dir)
} else {
# Use the root engine package config by default.
# As we move towards a single pub workspace for the engine, this will be
# the correct package config to use, as we will no longer have a per-package
# .dart_tool/package_config.json.
package_config = rebase_path("//flutter/.dart_tool/package_config.json")
}
packages_args += [
"--packages",
package_config,
]
snapshot_depfile = "$kernel_output.d"

flutter_patched_sdk =
rebase_path("$root_out_dir/flutter_patched_sdk", root_build_dir)

common_args = extra_args + packages_args + [
"--sdk-root",
flutter_patched_sdk,
"--target=flutter",
"--depfile",
rebase_path(snapshot_depfile, root_build_dir),
"--output-dill",
rebase_path(invoker.kernel_output, root_build_dir),
rebase_path(invoker.main_dart, root_build_dir),
]

if (flutter_prebuilt_dart_sdk) {
common_deps += [ "//flutter/flutter_frontend_server:frontend_server" ]
action(target_name) {
forward_variables_from(invoker,
[
"visibility",
"testonly",
],
[ "pool" ])
deps = common_deps
pool = "//build/toolchain:toolchain_pool"
script = "//build/gn_run_binary.py"
inputs = [ invoker.main_dart ]
outputs = [ invoker.kernel_output ]
depfile = snapshot_depfile

ext = ""
if (is_win) {
ext = ".exe"
}
dart = rebase_path("$host_prebuilt_dart_sdk/bin/dartaotruntime$ext",
root_out_dir)
frontend_server =
rebase_path("$root_gen_dir/frontend_server_aot.dart.snapshot")

args = [ dart ] + [ frontend_server ] + common_args
}
} else {
prebuilt_dart_action(target_name) {
forward_variables_from(invoker,
[
"visibility",
"testonly",
],
[ "pool" ])
deps = common_deps
pool = "//build/toolchain:toolchain_pool"
script = "$dart_src/pkg/frontend_server/bin/frontend_server_starter.dart"
inputs = [ invoker.main_dart ]
outputs = [ invoker.kernel_output ]
depfile = snapshot_depfile
args = common_args
}
}
}
Loading

0 comments on commit 8a3d63a

Please sign in to comment.