mirror of
https://github.com/peridotbuild/peridot.git
synced 2024-12-21 10:08:30 +00:00
Add taskrunner2 macro
This commit is contained in:
parent
7f162d8f68
commit
5d3cea7da3
@ -1,6 +1,8 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
|
||||
|
||||
exports_files(["runner.sh"])
|
||||
|
||||
go_library(
|
||||
name = "taskrunner2_lib",
|
||||
srcs = ["main.go"],
|
||||
|
29
devtools/taskrunner2/defs.bzl
Normal file
29
devtools/taskrunner2/defs.bzl
Normal file
@ -0,0 +1,29 @@
|
||||
def taskrunner2(name, targets = [], watch_targets = []):
|
||||
args = []
|
||||
|
||||
for target in targets:
|
||||
args.append("-t")
|
||||
args.append(target)
|
||||
|
||||
for target in watch_targets:
|
||||
args.append("-w")
|
||||
args.append(target)
|
||||
|
||||
# generate args output
|
||||
native.genrule(
|
||||
name = name + "_args",
|
||||
outs = ["args"],
|
||||
cmd = "echo " + " ".join(args) + " > $@",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
native.sh_binary(
|
||||
name = name,
|
||||
srcs = [
|
||||
"//devtools/taskrunner2:runner.sh",
|
||||
],
|
||||
data = [
|
||||
"//devtools/taskrunner2",
|
||||
":" + name + "_args",
|
||||
],
|
||||
)
|
4
devtools/taskrunner2/runner.sh
Executable file
4
devtools/taskrunner2/runner.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ARGS_PATH="$(find . -name "args")"
|
||||
devtools/taskrunner2/taskrunner2_/taskrunner2 $(cat "${ARGS_PATH}")
|
@ -0,0 +1,9 @@
|
||||
load("//devtools/taskrunner2:defs.bzl", "taskrunner2")
|
||||
|
||||
taskrunner2(
|
||||
name = "mothership",
|
||||
watch_targets = [
|
||||
"//tools/mothership/cmd/mship_api",
|
||||
"//tools/mothership/ui",
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue
Block a user