mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[flutter] split frontend_server from vm package
To support JavaScript compilation, the frontend_server will require a dependency on the dev_compiler. To avoid conflating this with the vm specific functionality, the frontend server will be split from its current location. This change will require a small corresponding update in flutter/engine, documented in the patches directory Change-Id: I47923765546f7f6fa43e36ef38f8f466d3a7b2fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120321 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
parent
a389015083
commit
13fbf569f6
|
@ -38,6 +38,7 @@ dev_compiler:pkg/dev_compiler/lib
|
|||
diagnostic:pkg/diagnostic/lib
|
||||
expect:pkg/expect/lib
|
||||
fixnum:third_party/pkg/fixnum/lib
|
||||
frontend_server:pkg/frontend_server/lib
|
||||
front_end:pkg/front_end/lib
|
||||
gardening:tools/gardening/lib
|
||||
glob:third_party/pkg/glob/lib
|
||||
|
|
26
pkg/frontend_server/LICENSE
Normal file
26
pkg/frontend_server/LICENSE
Normal file
|
@ -0,0 +1,26 @@
|
|||
Copyright 2019, the Dart project authors. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -60,7 +60,7 @@ ArgParser argParser = new ArgParser(allowTrailingOptions: true)
|
|||
..addFlag('aot',
|
||||
help: 'Run compiler in AOT mode (enables whole-program transformations)',
|
||||
defaultsTo: false)
|
||||
// TODO(alexmarkov): Cleanup uses in Flutter and remove these obsolete flags.
|
||||
// TODO(alexmarkov): Cleanup uses in Flutter and remove these obsolete flags.
|
||||
..addFlag('strong', help: 'Obsolete', defaultsTo: true)
|
||||
..addFlag('tfa',
|
||||
help:
|
13
pkg/frontend_server/pubspec.yaml
Normal file
13
pkg/frontend_server/pubspec.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# This package is not intended to be published.
|
||||
name: frontend_server
|
||||
# version: do-not-upload
|
||||
description: A resident kernel compiler
|
||||
|
||||
dependencies:
|
||||
build_integration:
|
||||
path: ../build_integration
|
||||
vm:
|
||||
path: ../vm
|
||||
front_end: ^0.1.6
|
||||
kernel: ^0.3.6
|
||||
args: ^1.4.4
|
|
@ -0,0 +1,282 @@
|
|||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index b894fe26f..e4ce1dea1 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -42,7 +42,7 @@ group("flutter") {
|
||||
if (!is_fuchsia && !is_fuchsia_host) {
|
||||
if (current_toolchain == host_toolchain) {
|
||||
public_deps += [
|
||||
- "$flutter_root/frontend_server",
|
||||
+ "$flutter_root/flutter_frontend_server:frontend_server",
|
||||
"//third_party/dart:create_sdk",
|
||||
]
|
||||
|
||||
diff --git a/frontend_server/.gitignore b/flutter_frontend_server/.gitignore
|
||||
similarity index 100%
|
||||
rename from frontend_server/.gitignore
|
||||
rename to flutter_frontend_server/.gitignore
|
||||
diff --git a/flutter_frontend_server/BUILD.gn b/flutter_frontend_server/BUILD.gn
|
||||
new file mode 100644
|
||||
index 000000000..37740acaa
|
||||
--- /dev/null
|
||||
+++ b/flutter_frontend_server/BUILD.gn
|
||||
@@ -0,0 +1,63 @@
|
||||
+# 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.
|
||||
+
|
||||
+if (!is_fuchsia_host && !is_fuchsia) {
|
||||
+ import("//third_party/dart/utils/application_snapshot.gni")
|
||||
+
|
||||
+ frontend_server_files =
|
||||
+ exec_script("//third_party/dart/tools/list_dart_files.py",
|
||||
+ [
|
||||
+ "absolute",
|
||||
+ rebase_path("."),
|
||||
+ ],
|
||||
+ "list lines")
|
||||
+
|
||||
+ frontend_server_files +=
|
||||
+ exec_script("//third_party/dart/tools/list_dart_files.py",
|
||||
+ [
|
||||
+ "absolute",
|
||||
+ rebase_path("../../third_party/dart/pkg"),
|
||||
+ ],
|
||||
+ "list lines")
|
||||
+
|
||||
+ application_snapshot("frontend_server") {
|
||||
+ main_dart = "bin/starter.dart"
|
||||
+ deps = [
|
||||
+ ":package_incremental_compiler",
|
||||
+ "$flutter_root/lib/snapshot:kernel_platform_files",
|
||||
+ ]
|
||||
+ dot_packages = rebase_path(".packages")
|
||||
+ flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
|
||||
+ training_args = [
|
||||
+ "--train",
|
||||
+ "--sdk-root=$flutter_patched_sdk",
|
||||
+ rebase_path(main_dart),
|
||||
+ ]
|
||||
+
|
||||
+ inputs = frontend_server_files
|
||||
+ }
|
||||
+
|
||||
+ # For flutter/flutter#36738 we make the source files available so that
|
||||
+ # we can generate a local frontend_server snapshot in the tools cache.
|
||||
+ action("package_incremental_compiler") {
|
||||
+ script = "$flutter_root/flutter_frontend_server/package_incremental.py"
|
||||
+
|
||||
+ inputs = frontend_server_files
|
||||
+
|
||||
+ outputs = [
|
||||
+ "$root_gen_dir/dart-pkg/frontend_server/pubspec.yaml",
|
||||
+ "$root_gen_dir/dart-pkg/vm/pubspec.yaml",
|
||||
+ "$root_gen_dir/dart-pkg/build_integration/pubspec.yaml",
|
||||
+ "$root_gen_dir/dart-pkg/front_end/pubspec.yaml",
|
||||
+ "$root_gen_dir/dart-pkg/kernel/pubspec.yaml",
|
||||
+ "$root_gen_dir/dart-pkg/dev_compiler/pubspec.yaml",
|
||||
+ ]
|
||||
+
|
||||
+ args = [
|
||||
+ "--input-root=" + rebase_path("//third_party/dart/pkg"),
|
||||
+ "--output-root=" + rebase_path("$root_gen_dir/dart-pkg"),
|
||||
+ "--frontend-server=" + rebase_path("$flutter_root"),
|
||||
+ ]
|
||||
+ }
|
||||
+}
|
||||
diff --git a/frontend_server/README.md b/flutter_frontend_server/README.md
|
||||
similarity index 100%
|
||||
rename from frontend_server/README.md
|
||||
rename to flutter_frontend_server/README.md
|
||||
diff --git a/frontend_server/bin/starter.dart b/flutter_frontend_server/bin/starter.dart
|
||||
similarity index 76%
|
||||
rename from frontend_server/bin/starter.dart
|
||||
rename to flutter_frontend_server/bin/starter.dart
|
||||
index da85e5575..862a8a7ea 100644
|
||||
--- a/frontend_server/bin/starter.dart
|
||||
+++ b/flutter_frontend_server/bin/starter.dart
|
||||
@@ -2,7 +2,7 @@ library frontend_server;
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
-import 'package:frontend_server/server.dart';
|
||||
+import 'package:flutter_frontend_server/server.dart';
|
||||
|
||||
void main(List<String> args) async {
|
||||
final int exitCode = await starter(args);
|
||||
diff --git a/frontend_server/lib/server.dart b/flutter_frontend_server/lib/server.dart
|
||||
similarity index 98%
|
||||
rename from frontend_server/lib/server.dart
|
||||
rename to flutter_frontend_server/lib/server.dart
|
||||
index 8e34efa93..24894c878 100644
|
||||
--- a/frontend_server/lib/server.dart
|
||||
+++ b/flutter_frontend_server/lib/server.dart
|
||||
@@ -11,7 +11,7 @@ import 'package:args/args.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'package:vm/incremental_compiler.dart';
|
||||
-import 'package:vm/frontend_server.dart' as frontend
|
||||
+import 'package:frontend_server/frontend_server.dart' as frontend
|
||||
show
|
||||
FrontendCompiler,
|
||||
CompilerInterface,
|
||||
diff --git a/frontend_server/package_incremental.py b/flutter_frontend_server/package_incremental.py
|
||||
similarity index 94%
|
||||
rename from frontend_server/package_incremental.py
|
||||
rename to flutter_frontend_server/package_incremental.py
|
||||
index 63b019a33..a8b424260 100755
|
||||
--- a/frontend_server/package_incremental.py
|
||||
+++ b/flutter_frontend_server/package_incremental.py
|
||||
@@ -15,7 +15,7 @@ PACKAGES = [
|
||||
"kernel",
|
||||
"front_end",
|
||||
"dev_compiler",
|
||||
- "frontend_server",
|
||||
+ "flutter_frontend_server",
|
||||
]
|
||||
|
||||
VM_PUBSPEC = r'''name: vm
|
||||
@@ -41,7 +41,7 @@ dependencies:
|
||||
meta: any
|
||||
'''
|
||||
|
||||
-FRONTEND_SERVER_PUBSPEC = r'''name: frontend_server
|
||||
+FLUTTER_FRONTEND_SERVER_PUBSPEC = r'''name: flutter_frontend_server
|
||||
version: 0.0.1
|
||||
environment:
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
@@ -87,7 +87,7 @@ dependencies:
|
||||
PUBSPECS = {
|
||||
'vm': VM_PUBSPEC,
|
||||
'build_integration': BUILD_INTEGRATION_PUBSPEC,
|
||||
- 'frontend_server': FRONTEND_SERVER_PUBSPEC,
|
||||
+ 'flutter_frontend_server': FLUTTER_FRONTEND_SERVER_PUBSPEC,
|
||||
'kernel': KERNEL_PUBSPEC,
|
||||
'front_end': FRONT_END_PUBSPEC,
|
||||
'dev_compiler': DEV_COMPILER_PUBSPEC,
|
||||
@@ -103,7 +103,7 @@ def main():
|
||||
for package in PACKAGES:
|
||||
base = args.input
|
||||
# Handle different path for frontend_server
|
||||
- if package == 'frontend_server':
|
||||
+ if package == 'flutter_frontend_server':
|
||||
base = args.frontend
|
||||
package_root = os.path.join(base, package)
|
||||
for root, directories, files in os.walk(package_root):
|
||||
diff --git a/frontend_server/pubspec.yaml b/flutter_frontend_server/pubspec.yaml
|
||||
similarity index 100%
|
||||
rename from frontend_server/pubspec.yaml
|
||||
rename to flutter_frontend_server/pubspec.yaml
|
||||
diff --git a/frontend_server/BUILD.gn b/frontend_server/BUILD.gn
|
||||
index 330f1e394..6cb8ce88f 100644
|
||||
--- a/frontend_server/BUILD.gn
|
||||
+++ b/frontend_server/BUILD.gn
|
||||
@@ -6,9 +6,9 @@ if (is_fuchsia_host || is_fuchsia) {
|
||||
import("//build/dart/dart_library.gni")
|
||||
import("//build/dart/dart_tool.gni")
|
||||
|
||||
- dart_library("frontend_server") {
|
||||
+ dart_library("flutter_frontend_server") {
|
||||
disable_analysis = true
|
||||
- package_name = "frontend_server"
|
||||
+ package_name = "flutter_frontend_server"
|
||||
|
||||
sources = [
|
||||
"server.dart",
|
||||
@@ -19,6 +19,7 @@ if (is_fuchsia_host || is_fuchsia) {
|
||||
"//third_party/dart-pkg/pub/path",
|
||||
"//third_party/dart-pkg/pub/usage",
|
||||
"//third_party/dart/pkg/build_integration",
|
||||
+ "//third_party/dart/pkg/frontend_server",
|
||||
"//third_party/dart/pkg/front_end",
|
||||
"//third_party/dart/pkg/kernel",
|
||||
"//third_party/dart/pkg/vm",
|
||||
@@ -27,72 +28,15 @@ if (is_fuchsia_host || is_fuchsia) {
|
||||
|
||||
dart_tool("frontend_server_tool") {
|
||||
main_dart = "bin/starter.dart"
|
||||
- source_dir = "."
|
||||
+ source_dir = "../flutter_frontend_server"
|
||||
disable_analysis = true
|
||||
output_name = "frontend_server"
|
||||
|
||||
sources = []
|
||||
|
||||
deps = [
|
||||
- ":frontend_server",
|
||||
- ]
|
||||
- }
|
||||
-} else {
|
||||
- import("//third_party/dart/utils/application_snapshot.gni")
|
||||
-
|
||||
- frontend_server_files =
|
||||
- exec_script("//third_party/dart/tools/list_dart_files.py",
|
||||
- [
|
||||
- "absolute",
|
||||
- rebase_path("."),
|
||||
- ],
|
||||
- "list lines")
|
||||
-
|
||||
- frontend_server_files +=
|
||||
- exec_script("//third_party/dart/tools/list_dart_files.py",
|
||||
- [
|
||||
- "absolute",
|
||||
- rebase_path("../../third_party/dart/pkg"),
|
||||
- ],
|
||||
- "list lines")
|
||||
-
|
||||
- application_snapshot("frontend_server") {
|
||||
- main_dart = "bin/starter.dart"
|
||||
- deps = [
|
||||
- ":package_incremental_compiler",
|
||||
- "$flutter_root/lib/snapshot:kernel_platform_files",
|
||||
- ]
|
||||
- dot_packages = rebase_path(".packages")
|
||||
- flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
|
||||
- training_args = [
|
||||
- "--train",
|
||||
- "--sdk-root=$flutter_patched_sdk",
|
||||
- rebase_path(main_dart),
|
||||
- ]
|
||||
-
|
||||
- inputs = frontend_server_files
|
||||
- }
|
||||
-
|
||||
- # For flutter/flutter#36738 we make the source files available so that
|
||||
- # we can generate a local frontend_server snapshot in the tools cache.
|
||||
- action("package_incremental_compiler") {
|
||||
- script = "$flutter_root/frontend_server/package_incremental.py"
|
||||
-
|
||||
- inputs = frontend_server_files
|
||||
-
|
||||
- outputs = [
|
||||
- "$root_gen_dir/dart-pkg/frontend_server/pubspec.yaml",
|
||||
- "$root_gen_dir/dart-pkg/vm/pubspec.yaml",
|
||||
- "$root_gen_dir/dart-pkg/build_integration/pubspec.yaml",
|
||||
- "$root_gen_dir/dart-pkg/front_end/pubspec.yaml",
|
||||
- "$root_gen_dir/dart-pkg/kernel/pubspec.yaml",
|
||||
- "$root_gen_dir/dart-pkg/dev_compiler/pubspec.yaml",
|
||||
- ]
|
||||
-
|
||||
- args = [
|
||||
- "--input-root=" + rebase_path("//third_party/dart/pkg"),
|
||||
- "--output-root=" + rebase_path("$root_gen_dir/dart-pkg"),
|
||||
- "--frontend-server=" + rebase_path("$flutter_root"),
|
||||
+ ":flutter_frontend_server",
|
||||
]
|
||||
}
|
||||
}
|
||||
+
|
||||
diff --git a/tools/generate_package_files.py b/tools/generate_package_files.py
|
||||
index 13399b126..1eb1e6f6c 100644
|
||||
--- a/tools/generate_package_files.py
|
||||
+++ b/tools/generate_package_files.py
|
||||
@@ -10,7 +10,7 @@ import os
|
||||
import shutil
|
||||
|
||||
ALL_PACKAGES = {
|
||||
- 'frontend_server': [],
|
||||
+ 'flutter_frontend_server': [],
|
||||
}
|
||||
|
||||
SRC_DIR = os.getcwd()
|
|
@ -47,7 +47,7 @@ copy("copy_kernel-service_snapshot") {
|
|||
}
|
||||
|
||||
application_snapshot("frontend_server") {
|
||||
main_dart = "../../pkg/vm/bin/frontend_server_starter.dart"
|
||||
main_dart = "../../pkg/frontend_server/bin/frontend_server_starter.dart"
|
||||
deps = [
|
||||
"../../runtime/vm:kernel_platform_files($host_toolchain)",
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue