Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4a34769

Browse files
authored
[fuchsia] Use the dart_library template instead of the build system's implementation. (#4908)
1 parent 924b111 commit 4a34769

File tree

2 files changed

+16
-31
lines changed

2 files changed

+16
-31
lines changed

lib/snapshot/BUILD.gn

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import("//third_party/dart/utils/compile_platform.gni")
77
import("//third_party/dart/utils/generate_entry_points_json.gni")
88

99
if (is_fuchsia) {
10+
import("//build/dart/dart_library.gni")
1011
import("//build/dart/toolchain.gni")
1112
import("//topaz/public/dart-pkg/fuchsia/sdk_ext.gni")
1213
import("//topaz/public/dart-pkg/zircon/sdk_ext.gni")
@@ -24,39 +25,18 @@ copy("generate_dart_ui") {
2425
}
2526

2627
if (is_fuchsia) {
27-
action("generate_package_map") {
28-
dart_deps = [
29-
"//topaz/public/dart/fuchsia",
30-
"//topaz/public/dart/zircon",
31-
]
28+
dart_library("generate_package_map") {
29+
# The sole purpose of this target is to generate a .packages file.
30+
sources = []
3231

33-
dot_packages_file = "$target_gen_dir/snapshot.packages"
34-
outputs = [
35-
dot_packages_file
36-
]
37-
deps = []
38-
foreach(dep, dart_deps) {
39-
deps += [ "$dep($dart_toolchain)" ]
40-
}
32+
infer_package_name = true
4133

42-
depfile = "$dot_packages_file.d"
34+
disable_analysis = true
4335

44-
script = "//build/dart/gen_dot_packages.py"
45-
args = [
46-
"--out",
47-
rebase_path(dot_packages_file, root_build_dir),
48-
"--source-dir",
49-
rebase_path("."),
50-
"--root-build-dir",
51-
rebase_path(root_build_dir),
52-
"--root-gen-dir",
53-
rebase_path(dart_root_gen_dir),
54-
"--package-name",
55-
"snapshot_root",
56-
"--depfile",
57-
rebase_path(depfile),
58-
"--deps",
59-
] + dart_deps
36+
deps = [
37+
"//topaz/public/dart/fuchsia",
38+
"//topaz/public/dart/zircon",
39+
]
6040
}
6141
}
6242

@@ -157,7 +137,7 @@ action("generate_snapshot_bin") {
157137
"--url_mapping=dart:fuchsia,$fuchsia_path",
158138
"--url_mapping=dart:mozart.internal,$mozart_internal_path",
159139
"--packages",
160-
rebase_path("$target_gen_dir/snapshot.packages"),
140+
rebase_path("$target_gen_dir/generate_package_map.packages"),
161141
"--load_compilation_trace",
162142
rebase_path("fuchsia_compilation_trace.txt"),
163143
]

lib/snapshot/pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2018 The Chromium Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# This file is needed by Fuchsia's dart_library template.

0 commit comments

Comments
 (0)