bazel: use export_files instead of genrule (#1506)

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-23 12:26:48 -04:00 committed by GitHub
parent 41b966156b
commit e92c08be31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 70 deletions

View File

@ -78,10 +78,10 @@ noop_warn(
alias(
name = "com_github_koalaman_shellcheck",
actual = select({
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_koalaman_shellcheck_darwin_x86_64//:shellcheck_bin",
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_koalaman_shellcheck_darwin_x86_64//:shellcheck",
"@io_bazel_rules_go//go/platform:darwin_arm64": ":shellcheck_noop_warning",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_koalaman_shellcheck_linux_x86_64//:shellcheck_bin",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_koalaman_shellcheck_linux_aaarch64//:shellcheck_bin",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_koalaman_shellcheck_linux_x86_64//:shellcheck",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_koalaman_shellcheck_linux_aaarch64//:shellcheck",
}),
)
@ -101,10 +101,10 @@ sh_template(
alias(
name = "com_github_rhysd_actionlint",
actual = select({
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_rhysd_actionlint_darwin_amd64//:actionlint_bin",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_rhysd_actionlint_darwin_arm64//:actionlint_bin",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_rhysd_actionlint_linux_amd64//:actionlint_bin",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_rhysd_actionlint_linux_arm64//:actionlint_bin",
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_rhysd_actionlint_darwin_amd64//:actionlint",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_rhysd_actionlint_darwin_arm64//:actionlint",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_rhysd_actionlint_linux_amd64//:actionlint",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_rhysd_actionlint_linux_arm64//:actionlint",
}),
)
@ -149,10 +149,10 @@ repo_command(
alias(
name = "com_github_aquasecurity_tfsec",
actual = select({
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_aquasecurity_tfsec_darwin_amd64//:tfsec_bin",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_aquasecurity_tfsec_darwin_arm64//:tfsec_bin",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_aquasecurity_tfsec_linux_amd64//:tfsec_bin",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_aquasecurity_tfsec_linux_arm64//:tfsec_bin",
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_aquasecurity_tfsec_darwin_amd64//:tfsec",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_aquasecurity_tfsec_darwin_arm64//:tfsec",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_aquasecurity_tfsec_linux_amd64//:tfsec",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_aquasecurity_tfsec_linux_arm64//:tfsec",
}),
)
@ -170,10 +170,10 @@ sh_template(
alias(
name = "com_github_hashicorp_terraform",
actual = select({
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_hashicorp_terraform_darwin_amd64//:terraform_bin",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_hashicorp_terraform_darwin_arm64//:terraform_bin",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_hashicorp_terraform_linux_amd64//:terraform_bin",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_hashicorp_terraform_linux_arm64//:terraform_bin",
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_hashicorp_terraform_darwin_amd64//:terraform",
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_hashicorp_terraform_darwin_arm64//:terraform",
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_hashicorp_terraform_linux_amd64//:terraform",
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_hashicorp_terraform_linux_arm64//:terraform",
}),
)

View File

@ -1,8 +0,0 @@
genrule(
name = "actionlint_bin",
srcs = ["actionlint"],
outs = ["actionlint_bin_out"],
cmd = "cp $< $@", # Copy the binary to the output directory.
executable = True,
visibility = ["//visibility:public"],
)

View File

@ -1,8 +0,0 @@
genrule(
name = "gofumpt_bin",
srcs = ["gofumpt"],
outs = ["gofumpt_bin_out"],
cmd = "cp $< $@", # Copy the binary to the output directory.
executable = True,
visibility = ["//visibility:public"],
)

View File

@ -1,8 +0,0 @@
genrule(
name = "shellcheck_bin",
srcs = ["shellcheck"],
outs = ["shellcheck_bin_out"],
cmd = "cp $< $@", # Copy the binary to the output directory.
executable = True,
visibility = ["//visibility:public"],
)

View File

@ -1,8 +0,0 @@
genrule(
name = "terraform_bin",
srcs = ["terraform"],
outs = ["terraform_bin_out"],
cmd = "cp $< $@", # Copy the binary to the output directory.
executable = True,
visibility = ["//visibility:public"],
)

View File

@ -1,8 +0,0 @@
genrule(
name = "tfsec_bin",
srcs = ["tfsec"],
outs = ["tfsec_bin_out"],
cmd = "cp $< $@", # Copy the binary to the output directory.
executable = True,
visibility = ["//visibility:public"],
)

View File

@ -18,7 +18,7 @@ def _shellcheck_deps():
],
sha256 = "700324c6dd0ebea0117591c6cc9d7350d9c7c5c287acbad7630fa17b1d4d9e2f",
strip_prefix = "shellcheck-v0.9.0",
build_file = "//bazel/toolchains:BUILD.shellcheck.bazel",
build_file_content = """exports_files(["shellcheck"], visibility = ["//visibility:public"])""",
)
http_archive(
name = "com_github_koalaman_shellcheck_linux_aaarch64",
@ -27,7 +27,7 @@ def _shellcheck_deps():
],
sha256 = "179c579ef3481317d130adebede74a34dbbc2df961a70916dd4039ebf0735fae",
strip_prefix = "shellcheck-v0.9.0",
build_file = "//bazel/toolchains:BUILD.shellcheck.bazel",
build_file_content = """exports_files(["shellcheck"], visibility = ["//visibility:public"])""",
)
http_archive(
name = "com_github_koalaman_shellcheck_darwin_x86_64",
@ -36,13 +36,13 @@ def _shellcheck_deps():
],
sha256 = "7d3730694707605d6e60cec4efcb79a0632d61babc035aa16cda1b897536acf5",
strip_prefix = "shellcheck-v0.9.0",
build_file = "//bazel/toolchains:BUILD.shellcheck.bazel",
build_file_content = """exports_files(["shellcheck"], visibility = ["//visibility:public"])""",
)
def _terraform_deps():
http_archive(
name = "com_github_hashicorp_terraform_linux_amd64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
build_file_content = """exports_files(["terraform"], visibility = ["//visibility:public"])""",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_linux_amd64.zip",
],
@ -50,7 +50,7 @@ def _terraform_deps():
)
http_archive(
name = "com_github_hashicorp_terraform_linux_arm64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
build_file_content = """exports_files(["terraform"], visibility = ["//visibility:public"])""",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_linux_arm64.zip",
],
@ -58,7 +58,7 @@ def _terraform_deps():
)
http_archive(
name = "com_github_hashicorp_terraform_darwin_amd64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
build_file_content = """exports_files(["terraform"], visibility = ["//visibility:public"])""",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_darwin_amd64.zip",
],
@ -66,7 +66,7 @@ def _terraform_deps():
)
http_archive(
name = "com_github_hashicorp_terraform_darwin_arm64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
build_file_content = """exports_files(["terraform"], visibility = ["//visibility:public"])""",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_darwin_arm64.zip",
],
@ -76,7 +76,7 @@ def _terraform_deps():
def _actionlint_deps():
http_archive(
name = "com_github_rhysd_actionlint_linux_amd64",
build_file = "//bazel/toolchains:BUILD.actionlint.bazel",
build_file_content = """exports_files(["actionlint"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_linux_amd64.tar.gz",
],
@ -84,7 +84,7 @@ def _actionlint_deps():
)
http_archive(
name = "com_github_rhysd_actionlint_linux_arm64",
build_file = "//bazel/toolchains:BUILD.actionlint.bazel",
build_file_content = """exports_files(["actionlint"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_linux_arm64.tar.gz",
],
@ -92,7 +92,7 @@ def _actionlint_deps():
)
http_archive(
name = "com_github_rhysd_actionlint_darwin_amd64",
build_file = "//bazel/toolchains:BUILD.actionlint.bazel",
build_file_content = """exports_files(["actionlint"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_darwin_amd64.tar.gz",
],
@ -100,7 +100,7 @@ def _actionlint_deps():
)
http_archive(
name = "com_github_rhysd_actionlint_darwin_arm64",
build_file = "//bazel/toolchains:BUILD.actionlint.bazel",
build_file_content = """exports_files(["actionlint"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_darwin_arm64.tar.gz",
],
@ -144,7 +144,7 @@ def _gofumpt_deps():
def _tfsec_deps():
http_archive(
name = "com_github_aquasecurity_tfsec_linux_amd64",
build_file = "//bazel/toolchains:BUILD.tfsec.bazel",
build_file_content = """exports_files(["tfsec"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/aquasecurity/tfsec/releases/download/v1.28.1/tfsec_1.28.1_linux_amd64.tar.gz",
],
@ -152,7 +152,7 @@ def _tfsec_deps():
)
http_archive(
name = "com_github_aquasecurity_tfsec_linux_arm64",
build_file = "//bazel/toolchains:BUILD.tfsec.bazel",
build_file_content = """exports_files(["tfsec"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/aquasecurity/tfsec/releases/download/v1.28.1/tfsec_1.28.1_linux_arm64.tar.gz",
],
@ -160,7 +160,7 @@ def _tfsec_deps():
)
http_archive(
name = "com_github_aquasecurity_tfsec_darwin_amd64",
build_file = "//bazel/toolchains:BUILD.tfsec.bazel",
build_file_content = """exports_files(["tfsec"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/aquasecurity/tfsec/releases/download/v1.28.1/tfsec_1.28.1_darwin_amd64.tar.gz",
],
@ -168,7 +168,7 @@ def _tfsec_deps():
)
http_archive(
name = "com_github_aquasecurity_tfsec_darwin_arm64",
build_file = "//bazel/toolchains:BUILD.tfsec.bazel",
build_file_content = """exports_files(["tfsec"], visibility = ["//visibility:public"])""",
urls = [
"https://github.com/aquasecurity/tfsec/releases/download/v1.28.1/tfsec_1.28.1_darwin_arm64.tar.gz",
],