mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-23 14:39:40 -05:00
bazel: refactor shell rules into own package
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
e3f37e9a38
commit
a0fddd44eb
@ -1,7 +1,7 @@
|
||||
load("@bazel_gazelle//:def.bzl", "gazelle")
|
||||
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
|
||||
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier", "buildifier_test")
|
||||
load(":def.bzl", "repo_command", "sh_template")
|
||||
load("//bazel/sh:def.bzl", "repo_command", "sh_template")
|
||||
|
||||
gazelle(name = "gazelle_generate")
|
||||
|
||||
@ -42,22 +42,12 @@ buildifier(
|
||||
verbose = True,
|
||||
)
|
||||
|
||||
sh_library(
|
||||
name = "base_lib",
|
||||
srcs = [
|
||||
"lib.bash",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
sh_template(
|
||||
name = "go_mod_tidy",
|
||||
data = [
|
||||
":base_lib",
|
||||
"@go_sdk//:bin/go",
|
||||
],
|
||||
substitutions = {
|
||||
"@@BASE_LIB@@": "$(rootpath :base_lib)",
|
||||
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
||||
},
|
||||
template = "tidy.sh.in",
|
||||
@ -66,11 +56,9 @@ sh_template(
|
||||
sh_template(
|
||||
name = "shfmt",
|
||||
data = [
|
||||
":base_lib",
|
||||
"@com_github_katexochen_sh_v3//cmd/shfmt",
|
||||
],
|
||||
substitutions = {
|
||||
"@@BASE_LIB@@": "$(rootpath :base_lib)",
|
||||
"@@SHFMT@@": "$(rootpath @com_github_katexochen_sh_v3//cmd/shfmt)",
|
||||
},
|
||||
template = "shfmt.sh.in",
|
||||
|
@ -1,16 +1,14 @@
|
||||
load("//bazel/ci:def.bzl", "sh_template")
|
||||
load("//bazel/sh:def.bzl", "sh_template")
|
||||
|
||||
sh_template(
|
||||
name = "devbuild",
|
||||
data = [
|
||||
"//bazel/ci:base_lib",
|
||||
"//bootstrapper/cmd/bootstrapper",
|
||||
"//cli:cli_oss_host",
|
||||
"//debugd/cmd/cdbg:cdbg_host",
|
||||
"//upgrade-agent/cmd",
|
||||
],
|
||||
substitutions = {
|
||||
"@@BASE_LIB@@": "$(rootpath //bazel/ci:base_lib)",
|
||||
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper)",
|
||||
"@@CDBG@@": "$(rootpath //debugd/cmd/cdbg:cdbg_host)",
|
||||
"@@CLI@@": "$(rootpath //cli:cli_oss_host)",
|
||||
|
9
bazel/sh/BUILD.bazel
Normal file
9
bazel/sh/BUILD.bazel
Normal file
@ -0,0 +1,9 @@
|
||||
exports_files(["repo_command.sh.in"])
|
||||
|
||||
sh_library(
|
||||
name = "base_lib",
|
||||
srcs = [
|
||||
"lib.bash",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -46,7 +46,9 @@ def sh_template(name, **kwargs):
|
||||
|
||||
tags = kwargs.get("tags", [])
|
||||
data = kwargs.get("data", [])
|
||||
data.append("//bazel/sh:base_lib")
|
||||
substitutions = kwargs.pop("substitutions", [])
|
||||
substitutions["@@BASE_LIB@@"] = "$(rootpath //bazel/sh:base_lib)"
|
||||
template = kwargs.pop("template", [])
|
||||
|
||||
_sh_template(
|
||||
@ -75,18 +77,16 @@ def repo_command(name, **kwargs):
|
||||
|
||||
substitutions = {
|
||||
"@@ARGS@@": args,
|
||||
"@@BASE_LIB@@": "$(rootpath :base_lib)",
|
||||
"@@CMD@@": "$(rootpath %s)" % cmd,
|
||||
}
|
||||
|
||||
data = kwargs.pop("data", [])
|
||||
data.append(":base_lib")
|
||||
data.append(cmd)
|
||||
|
||||
sh_template(
|
||||
name = name,
|
||||
data = data,
|
||||
substitutions = substitutions,
|
||||
template = "repo_command.sh.in",
|
||||
template = "//bazel/sh:repo_command.sh.in",
|
||||
**kwargs
|
||||
)
|
Loading…
Reference in New Issue
Block a user