mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-24 06:59: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("@bazel_gazelle//:def.bzl", "gazelle")
|
||||||
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
|
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
|
||||||
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier", "buildifier_test")
|
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")
|
gazelle(name = "gazelle_generate")
|
||||||
|
|
||||||
@ -42,22 +42,12 @@ buildifier(
|
|||||||
verbose = True,
|
verbose = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
sh_library(
|
|
||||||
name = "base_lib",
|
|
||||||
srcs = [
|
|
||||||
"lib.bash",
|
|
||||||
],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
sh_template(
|
sh_template(
|
||||||
name = "go_mod_tidy",
|
name = "go_mod_tidy",
|
||||||
data = [
|
data = [
|
||||||
":base_lib",
|
|
||||||
"@go_sdk//:bin/go",
|
"@go_sdk//:bin/go",
|
||||||
],
|
],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"@@BASE_LIB@@": "$(rootpath :base_lib)",
|
|
||||||
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
||||||
},
|
},
|
||||||
template = "tidy.sh.in",
|
template = "tidy.sh.in",
|
||||||
@ -66,11 +56,9 @@ sh_template(
|
|||||||
sh_template(
|
sh_template(
|
||||||
name = "shfmt",
|
name = "shfmt",
|
||||||
data = [
|
data = [
|
||||||
":base_lib",
|
|
||||||
"@com_github_katexochen_sh_v3//cmd/shfmt",
|
"@com_github_katexochen_sh_v3//cmd/shfmt",
|
||||||
],
|
],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"@@BASE_LIB@@": "$(rootpath :base_lib)",
|
|
||||||
"@@SHFMT@@": "$(rootpath @com_github_katexochen_sh_v3//cmd/shfmt)",
|
"@@SHFMT@@": "$(rootpath @com_github_katexochen_sh_v3//cmd/shfmt)",
|
||||||
},
|
},
|
||||||
template = "shfmt.sh.in",
|
template = "shfmt.sh.in",
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
load("//bazel/ci:def.bzl", "sh_template")
|
load("//bazel/sh:def.bzl", "sh_template")
|
||||||
|
|
||||||
sh_template(
|
sh_template(
|
||||||
name = "devbuild",
|
name = "devbuild",
|
||||||
data = [
|
data = [
|
||||||
"//bazel/ci:base_lib",
|
|
||||||
"//bootstrapper/cmd/bootstrapper",
|
"//bootstrapper/cmd/bootstrapper",
|
||||||
"//cli:cli_oss_host",
|
"//cli:cli_oss_host",
|
||||||
"//debugd/cmd/cdbg:cdbg_host",
|
"//debugd/cmd/cdbg:cdbg_host",
|
||||||
"//upgrade-agent/cmd",
|
"//upgrade-agent/cmd",
|
||||||
],
|
],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"@@BASE_LIB@@": "$(rootpath //bazel/ci:base_lib)",
|
|
||||||
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper)",
|
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper)",
|
||||||
"@@CDBG@@": "$(rootpath //debugd/cmd/cdbg:cdbg_host)",
|
"@@CDBG@@": "$(rootpath //debugd/cmd/cdbg:cdbg_host)",
|
||||||
"@@CLI@@": "$(rootpath //cli:cli_oss_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", [])
|
tags = kwargs.get("tags", [])
|
||||||
data = kwargs.get("data", [])
|
data = kwargs.get("data", [])
|
||||||
|
data.append("//bazel/sh:base_lib")
|
||||||
substitutions = kwargs.pop("substitutions", [])
|
substitutions = kwargs.pop("substitutions", [])
|
||||||
|
substitutions["@@BASE_LIB@@"] = "$(rootpath //bazel/sh:base_lib)"
|
||||||
template = kwargs.pop("template", [])
|
template = kwargs.pop("template", [])
|
||||||
|
|
||||||
_sh_template(
|
_sh_template(
|
||||||
@ -75,18 +77,16 @@ def repo_command(name, **kwargs):
|
|||||||
|
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"@@ARGS@@": args,
|
"@@ARGS@@": args,
|
||||||
"@@BASE_LIB@@": "$(rootpath :base_lib)",
|
|
||||||
"@@CMD@@": "$(rootpath %s)" % cmd,
|
"@@CMD@@": "$(rootpath %s)" % cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
data = kwargs.pop("data", [])
|
data = kwargs.pop("data", [])
|
||||||
data.append(":base_lib")
|
|
||||||
data.append(cmd)
|
data.append(cmd)
|
||||||
|
|
||||||
sh_template(
|
sh_template(
|
||||||
name = name,
|
name = name,
|
||||||
data = data,
|
data = data,
|
||||||
substitutions = substitutions,
|
substitutions = substitutions,
|
||||||
template = "repo_command.sh.in",
|
template = "//bazel/sh:repo_command.sh.in",
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
Loading…
Reference in New Issue
Block a user