blob: f0f8f2703007f460dc87fc6025d51d8311a33833 [file] [log] [blame]
# 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.
template("skyx") {
bundle_prefix = target_name
bundle = "$target_gen_dir/${bundle_prefix}.skyx"
snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin"
action("gen_${bundle_prefix}_snapshot") {
main_dart = invoker.main_dart
inputs = [
main_dart,
]
outputs = [
snapshot,
]
if (defined(invoker.sources)) {
inputs += sources
}
sky_snapshot_dir =
get_label_info("//sky/tools/sky_snapshot($host_toolchain)", "root_out_dir")
script = "//sky/tools/sky_snapshot.py"
src_dir = "//"
cwd = rebase_path(src_dir, root_build_dir)
args = [
rebase_path("$sky_snapshot_dir/sky_snapshot", src_dir),
rebase_path(main_dart, src_dir),
"--package-root", rebase_path("packages"),
"--snapshot",
rebase_path(snapshot, src_dir),
"-C",
cwd,
]
deps = [
"//sky/tools/sky_snapshot($host_toolchain)",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
action("gen_${bundle_prefix}_bundle") {
asset_base = "//sky/packages/material_design_icons/lib/icons"
sources = [
"//sky/tools/skyx/bin/skyx.dart",
snapshot,
]
outputs = [
bundle,
]
script = "//sky/tools/skyx.py"
args = [
"--package-root",
rebase_path("//sky/tools/skyx/packages", root_build_dir),
"--asset-base",
rebase_path(asset_base, root_build_dir),
"--snapshot",
rebase_path(snapshot, root_build_dir),
"-o",
rebase_path(bundle, root_build_dir),
]
if (defined(invoker.manifest)) {
sources += [ invoker.manifest ]
args += [
"--manifest",
rebase_path(invoker.manifest, root_build_dir),
]
}
deps = [
":gen_${bundle_prefix}_snapshot",
]
}
group(target_name) {
deps = [
":gen_${bundle_prefix}_bundle",
]
}
}