[bazel] Create better static libraries and add basic publishing (#8029)

This commit is contained in:
PJ Reiniger
2025-06-27 19:36:12 -04:00
committed by GitHub
parent 22b58c1853
commit e13d237390
38 changed files with 1445 additions and 216 deletions

View File

@@ -1,9 +1,9 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library", "wpilib_cc_static_library")
wpilib_cc_library(
name = "cameraserver.static",
name = "cameraserver",
srcs = glob(["src/main/native/cpp/**"]),
hdrs = glob(["src/main/native/include/**/*"]),
includes = [
@@ -13,11 +13,21 @@ wpilib_cc_library(
strip_include_prefix = "src/main/native/include",
visibility = ["//visibility:public"],
deps = [
"//cscore:cscore.static",
"//ntcore:ntcore.static",
"//cscore",
"//ntcore",
],
)
wpilib_cc_static_library(
name = "static/cameraserver",
static_deps = [
"//cscore:static/cscore",
"//ntcore:static/ntcore",
],
visibility = ["//visibility:public"],
deps = [":cameraserver"],
)
java_library(
name = "cameraserver-java",
srcs = glob(["src/main/java/**/*.java"]),
@@ -25,7 +35,7 @@ java_library(
deps = [
"//cscore:cscore-java",
"//hal:hal-java",
"//ntcore:networktables-java",
"//ntcore:ntcore-java",
"//wpimath:wpimath-java",
"//wpinet:wpinet-java",
"//wpiutil:wpiutil-java",
@@ -38,8 +48,8 @@ cc_test(
size = "small",
srcs = glob(["src/test/native/**"]),
deps = [
":cameraserver.static",
"//thirdparty/googletest:googletest.static",
":cameraserver",
"//thirdparty/googletest",
],
)
@@ -47,7 +57,7 @@ cc_binary(
name = "DevMain-Cpp",
srcs = ["src/dev/native/cpp/main.cpp"],
deps = [
":cameraserver.static",
":cameraserver",
],
)

View File

@@ -8,7 +8,7 @@ java_binary(
"//cameraserver:cameraserver-java",
"//cscore:cscore-java",
"//hal:hal-java",
"//ntcore:networktables-java",
"//ntcore:ntcore-java",
"//wpimath:wpimath-java",
"//wpiutil:wpiutil-java",
"@maven//:com_google_code_gson_gson",