Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Latest commit

 

History

History

multirun

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

multirun

Bazel rule to bazel run multiple executable targets sequentially or in parallel.

Setup and usage via Bazel

WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

# multirun is written in Go and hence needs rules_go to be built.
# See https://github.com/bazelbuild/rules_go for the up to date setup instructions.
http_archive(
    name = "io_bazel_rules_go",
)

git_repository(
    name = "com_github_ash2k_bazel_tools",
    commit = "<commit>",
    remote = "https://github.com/ash2k/bazel-tools.git",
    shallow_since = "<bla>",
)

load("@com_github_ash2k_bazel_tools//multirun:deps.bzl", "multirun_dependencies")

multirun_dependencies()

BUILD.bazel file:

load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun", "command")

command(
    name = "command1",
    command = "//some/label",
    arguments = [
        "-arg1",
        "value1",
        "-arg2",
    ],
    environment = {
        "ABC": "DEF",
    },
    raw_environment = {
        "PATH": "$(pwd)/path",
    },
)

multirun(
    name = "run_all",
    commands = [
        ":command1",
        "//some/other:label",
    ],
)

multirun(
    name = "run_all_parallel",
    commands = [
        ":command1",
        "//some/other:label",
    ],
    jobs = 0,
)

Invoke with

bazel run //:run_all