bazel: update BUILD files for rules_go bzlmod migration

This commit is contained in:
Malte Poll 2024-05-21 17:56:37 +02:00
parent 9e83ba12cd
commit d960121cba
30 changed files with 51 additions and 120 deletions

View File

@ -8,10 +8,7 @@ go_library(
"internal_cross.go",
],
cgo = True,
cdeps = select({
"@//bazel/settings:tpm_simulator_enabled": ["//simulator/ms-tpm-20-ref:ms_tpm_20_ref"],
"//conditions:default": ["@//3rdparty/bazel/com_github_google_go_tpm_tools/placeholder:ms_tpm_20_ref_disabled"],
}),
cdeps = ["//simulator/ms-tpm-20-ref:ms_tpm_20_ref"],
copts = [
"-fno-sanitize=all", # relax sanitizer checks for this test-only dependency
],

View File

@ -1,6 +1,6 @@
--- simulator/internal/BUILD.bazel
+++ simulator/internal/BUILD.bazel
@@ -4,83 +4,17 @@
@@ -4,83 +4,14 @@
name = "internal",
srcs = [
"doc.go",
@ -17,10 +17,8 @@
- "-L/usr/local/opt/openssl/lib",
- ],
- "//conditions:default": [],
+ cdeps = select({
+ "@//bazel/settings:tpm_simulator_enabled": ["//simulator/ms-tpm-20-ref:ms_tpm_20_ref"],
+ "//conditions:default": ["@//3rdparty/bazel/com_github_google_go_tpm_tools/placeholder:ms_tpm_20_ref_disabled"],
}),
- }),
+ cdeps = ["//simulator/ms-tpm-20-ref:ms_tpm_20_ref"],
copts = [
- "-DALG_SHA512=ALG_YES",
- "-DCERTIFYX509_DEBUG=NO",

View File

@ -229,8 +229,10 @@ cc_library(
],
deps = [
":ms_tpm_20_ref_google_samples",
"@//nix/cc:org_openssl",
],
] + select({
"@io_bazel_rules_go//go/platform:linux_arm64": ["@@org_openssl_aarch64-linux//:org_openssl"],
"@io_bazel_rules_go//go/platform:linux_amd64": ["@@org_openssl_x86_64-linux//:org_openssl"],
}),
target_compatible_with = [
"@platforms//os:linux",
]

View File

@ -1,6 +1,6 @@
--- simulator/ms-tpm-20-ref/BUILD.bazel
+++ simulator/ms-tpm-20-ref/BUILD.bazel
@@ -0,0 +1,512 @@
@@ -0,0 +1,516 @@
+cc_library(
+ name = "ms_tpm_20_ref",
+ visibility = ["//visibility:public"],
@ -229,10 +229,14 @@
+ ],
+ deps = [
+ ":ms_tpm_20_ref_google_samples",
+ "@//nix/cc:org_openssl",
+ ],
+ ] + select({
+ "@io_bazel_rules_go//go/platform:darwin_arm64": ["@@org_openssl_aarch64-darwin//:org_openssl"],
+ "@io_bazel_rules_go//go/platform:darwin_amd64": ["@@org_openssl_x86_64-darwin//:org_openssl"],
+ "@io_bazel_rules_go//go/platform:linux_arm64": ["@@org_openssl_aarch64-linux//:org_openssl"],
+ "@io_bazel_rules_go//go/platform:linux_amd64": ["@@org_openssl_x86_64-linux//:org_openssl"],
+ }),
+ target_compatible_with = [
+ "@platforms//os:linux",
+ "@@platforms//os:linux",
+ ],
+)
+

View File

@ -1,12 +0,0 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "ms_tpm_20_ref_disabled",
srcs = ["ms_tpm_20_disabled.c"],
hdrs = [
"Platform.h",
"Tpm.h",
],
includes = ["."],
visibility = ["//visibility:public"],
)

View File

@ -1,22 +0,0 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
extern int g_inFailureMode;
typedef union {
uint16_t size;
uint8_t *buffer;
} TPM2B, TPM2B_SEED;
typedef struct
{
TPM2B_SEED EPSeed;
TPM2B_SEED SPSeed;
TPM2B_SEED PPSeed;
} PERSISTENT_DATA;
extern PERSISTENT_DATA gp;
void _plat__Reset(bool forceManufacture);
void _plat__RunCommand(uint32_t requestSize, unsigned char *request,
uint32_t *responseSize, unsigned char **response);

View File

@ -1,27 +0,0 @@
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0
#undef YES
#define YES 1
#undef NO
#define NO 0
#undef SET
#define SET 1
#undef CLEAR
#define CLEAR 0
#ifndef MAX_RESPONSE_SIZE
#define MAX_RESPONSE_SIZE 4096
#endif
#ifndef EPSeed
#define EPSeed 1
#endif
#ifndef SPSeed
#define SPSeed 1
#endif
#ifndef PPSeed
#define PPSeed 1
#endif
#define NV_SYNC_PERSISTENT(x)

View File

@ -1,9 +0,0 @@
#include "Platform.h"
#include "Tpm.h"
int g_inFailureMode = 0;
void _plat__Reset(bool forceManufacture) {}
void _plat__RunCommand(uint32_t requestSize, unsigned char *request,
uint32_t *responseSize, unsigned char **response) {}

View File

@ -4,9 +4,9 @@
"plain.go",
],
cgo = True,
+ cdeps = [
+ "@//nix/cc:cryptsetup",
+ ],
+ cdeps = select({
+ "@io_bazel_rules_go//go/platform:linux_amd64": ["@@cryptsetup_x86_64-linux//:cryptsetup"],
+ }),
importpath = "github.com/martinjungblut/go-cryptsetup",
visibility = ["//visibility:public"],
)

View File

@ -5,7 +5,7 @@
"typedparams.go",
],
+ cdeps = [
+ "@//nix/cc:libvirt",
+ "@@libvirt_x86_64-linux//:libvirt",
+ ],
cgo = True,
importpath = "libvirt.org/go/libvirt",

View File

@ -21,7 +21,7 @@ go_library(
"//internal/nodestate",
"//internal/role",
"//internal/versions/components",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//keepalive",
"@org_golang_google_grpc//status",
@ -50,7 +50,7 @@ go_test(
"@com_github_spf13_afero//:afero",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_x_crypto//bcrypt",
"@org_uber_go_goleak//:goleak",
],

View File

@ -20,7 +20,7 @@ go_library(
"@io_k8s_kubernetes//cmd/kubeadm/app/apis/kubeadm/v1beta3",
"@io_k8s_kubernetes//cmd/kubeadm/app/constants",
"@io_k8s_utils//clock",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
],
)
@ -48,7 +48,7 @@ go_test(
"@com_github_stretchr_testify//require",
"@io_k8s_kubernetes//cmd/kubeadm/app/apis/kubeadm/v1beta3",
"@io_k8s_utils//clock/testing",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_uber_go_goleak//:goleak",
],
)

View File

@ -109,8 +109,8 @@ go_library(
"@io_k8s_client_go//tools/clientcmd",
"@io_k8s_client_go//tools/clientcmd/api/latest",
"@io_k8s_sigs_yaml//:yaml",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_x_mod//semver",
"@org_golang_google_grpc//:grpc",
] + select({
"@io_bazel_rules_go//go/platform:android_amd64": [
"@org_golang_x_sys//unix",
@ -193,7 +193,7 @@ go_test(
"@io_k8s_apimachinery//pkg/runtime/schema",
"@io_k8s_client_go//tools/clientcmd",
"@io_k8s_client_go//tools/clientcmd/api",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
"@org_golang_x_mod//semver",

View File

@ -8,7 +8,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//keyservice/keyserviceproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)
@ -20,7 +20,7 @@ go_test(
deps = [
"//keyservice/keyserviceproto",
"@com_github_stretchr_testify//assert",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//test/bufconn",
"@org_uber_go_goleak//:goleak",
],

View File

@ -22,7 +22,7 @@ go_library(
"//internal/logger",
"@com_github_spf13_afero//:afero",
"@com_github_spf13_cobra//:cobra",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)

View File

@ -18,7 +18,7 @@ go_library(
"//internal/constants",
"@com_github_coreos_go_systemd_v22//dbus",
"@com_github_spf13_afero//:afero",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)
@ -39,7 +39,7 @@ go_test(
"@com_github_spf13_afero//:afero",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_uber_go_goleak//:goleak",
],
)

View File

@ -13,7 +13,7 @@ go_library(
"//debugd/service",
"//internal/constants",
"//internal/logger",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//keepalive",
],
)
@ -32,7 +32,7 @@ go_test(
"//internal/logger",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
"@org_uber_go_goleak//:goleak",
],

View File

@ -14,7 +14,7 @@ go_library(
"//internal/grpc/grpclog",
"//internal/kms/kms",
"//internal/logger",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
],

View File

@ -12,7 +12,7 @@ go_library(
"//internal/role",
"//joinservice/joinproto",
"@io_k8s_utils//clock",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
],
)
@ -31,7 +31,7 @@ go_test(
"//joinservice/joinproto",
"@com_github_stretchr_testify//assert",
"@io_k8s_utils//clock/testing",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_uber_go_goleak//:goleak",
],
)

View File

@ -38,7 +38,7 @@ go_library(
"//internal/versions",
"@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1:apiextensions",
"@io_k8s_client_go//tools/clientcmd",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
],
)
@ -69,6 +69,6 @@ go_test(
"@com_github_stretchr_testify//require",
"@io_k8s_client_go//tools/clientcmd",
"@io_k8s_client_go//tools/clientcmd/api",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
],
)

View File

@ -21,7 +21,7 @@ go_test(
"//internal/atls",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//test/bufconn",
"@org_uber_go_goleak//:goleak",
],

View File

@ -9,7 +9,7 @@ go_library(
deps = [
"//internal/atls",
"//internal/grpc/atlscredentials",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)
@ -25,7 +25,7 @@ go_test(
"//internal/grpc/testdialer",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//interop/grpc_testing",
"@org_uber_go_goleak//:goleak",
],

View File

@ -12,7 +12,7 @@ go_library(
visibility = ["//:__subpackages__"],
deps = [
"@com_github_grpc_ecosystem_go_grpc_middleware_v2//interceptors/logging",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//grpclog",
],
)

View File

@ -8,7 +8,7 @@ go_library(
visibility = ["//joinservice:__subpackages__"],
deps = [
"//keyservice/keyserviceproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)
@ -21,7 +21,7 @@ go_test(
"//internal/logger",
"//keyservice/keyserviceproto",
"@com_github_stretchr_testify//assert",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//test/bufconn",
"@org_uber_go_goleak//:goleak",
],

View File

@ -15,7 +15,7 @@ go_library(
"//internal/versions/components",
"//joinservice/joinproto",
"@io_k8s_kubernetes//cmd/kubeadm/app/apis/kubeadm/v1beta3",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//credentials",
"@org_golang_google_grpc//status",

View File

@ -12,7 +12,7 @@ go_library(
"//internal/kms/kms",
"//internal/logger",
"//keyservice/keyserviceproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
],

View File

@ -9,7 +9,7 @@ go_library(
"//internal/constants",
"//internal/versions/components",
"//upgrade-agent/upgradeproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)

View File

@ -8,7 +8,7 @@ go_library(
visibility = ["//s3proxy:__subpackages__"],
deps = [
"//keyservice/keyserviceproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//credentials/insecure",
],
)
@ -21,7 +21,7 @@ go_test(
"//internal/logger",
"//keyservice/keyserviceproto",
"@com_github_stretchr_testify//assert",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//test/bufconn",
"@org_uber_go_goleak//:goleak",
],

View File

@ -13,7 +13,7 @@ go_library(
"//internal/logger",
"//internal/versions/components",
"//upgrade-agent/upgradeproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
"@org_golang_x_mod//semver",

View File

@ -10,7 +10,7 @@ go_library(
"//internal/constants",
"//internal/logger",
"//verify/verifyproto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//keepalive",
"@org_golang_google_grpc//peer",