mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Replace C++ UpdateTask with an empty dart version, loaded as a snapshot.
This adds a new placeholder dart package updater in sky/packages. This is built into a snapshot and compiled into the Sky engine binary using the same mechanism as the Dart isolate. I also added a SkyHeadless class, similar to SkyView, used for running Dart code without a view.
This commit is contained in:
parent
02c9ca6b77
commit
638c62d5f4
30
engine/src/flutter/sky/packages/updater/BUILD.gn
Normal file
30
engine/src/flutter/sky/packages/updater/BUILD.gn
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
action("updater") {
|
||||
snapshot = "$target_gen_dir/updater_snapshot.bin"
|
||||
main_dart = "lib/main.dart"
|
||||
|
||||
inputs = [
|
||||
main_dart,
|
||||
]
|
||||
outputs = [
|
||||
snapshot,
|
||||
]
|
||||
|
||||
sky_snapshot_dir =
|
||||
get_label_info("//sky/tools/sky_snapshot($host_toolchain)", "root_out_dir")
|
||||
script = "//sky/tools/run_sky_snapshot.py"
|
||||
|
||||
args = [
|
||||
"--compiler", rebase_path("$sky_snapshot_dir/sky_snapshot", root_build_dir),
|
||||
"--package-root", rebase_path("packages", root_build_dir),
|
||||
"--snapshot", rebase_path(snapshot, root_build_dir),
|
||||
"--main", rebase_path(main_dart, root_build_dir),
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//sky/tools/sky_snapshot($host_toolchain)",
|
||||
]
|
||||
}
|
||||
14
engine/src/flutter/sky/packages/updater/lib/main.dart
Normal file
14
engine/src/flutter/sky/packages/updater/lib/main.dart
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
class UpdateTask {
|
||||
UpdateTask() {}
|
||||
|
||||
String toString() => "UpdateTask()";
|
||||
}
|
||||
|
||||
void main() {
|
||||
var x = new UpdateTask();
|
||||
print("Success: $x");
|
||||
}
|
||||
9
engine/src/flutter/sky/packages/updater/pubspec.yaml
Normal file
9
engine/src/flutter/sky/packages/updater/pubspec.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
name: sky_updater
|
||||
version: 0.0.1
|
||||
author: Chromium Authors <sky-dev@googlegroups.com>
|
||||
description: The autoupdater for flutter
|
||||
homepage: http://flutter.io
|
||||
dependencies:
|
||||
mojo: ^0.0.21
|
||||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
33
engine/src/flutter/sky/tools/run_sky_snapshot.py
Executable file
33
engine/src/flutter/sky/tools/run_sky_snapshot.py
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015 The Chromium 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 argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC_ROOT = os.path.dirname(os.path.dirname(SKY_TOOLS_DIR))
|
||||
WORKBENCH = os.path.join(SRC_ROOT, 'sky', 'packages', 'workbench')
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Builds a Dart snapshot file')
|
||||
parser.add_argument('--main', type=str)
|
||||
parser.add_argument('--compiler', type=str)
|
||||
parser.add_argument('--package-root', type=str)
|
||||
parser.add_argument('--snapshot', type=str)
|
||||
args = parser.parse_args()
|
||||
|
||||
command = [
|
||||
os.path.abspath(args.compiler),
|
||||
'--package-root=%s' % os.path.abspath(args.package_root),
|
||||
'--snapshot=%s' % os.path.abspath(args.snapshot),
|
||||
os.path.abspath(args.main),
|
||||
]
|
||||
|
||||
subprocess.check_call(command, cwd=WORKBENCH)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Loading…
x
Reference in New Issue
Block a user