Files
allwpilib/shared/bazel/thirdparty/libssh/libssh.MODULE.bazel
PJ Reiniger cfab47e871 [bazel] Improve vendored deps, make libssh vendored (#8948)
TL;DR: kill https://github.com/wpilibsuite/bzlmodRio-libssh, update
versions, and make things easier for a script to update.

The main motivation behind this was that libssh was out of date with the
gradle version. Using these "external" dependencies can cause agita as
we churn through toolchain updates. Unlike the toolchains and opencv,
which can be used by external users (i.e. a all bazel robot, if a vendor
wanted to use bazel) a C++ wrapper around libssh maven deps almost
certainly wouldn't be pulled in, much like ceres and mrclib.

As a result of vendor'ing libssh, and knowing some potential pitfalls
and annoyances, this PR does the following:
- Vendor libssh, akin to how mrclib is pulled in
- Moves the vendor'd ceres to `shared/bazel/thirdparty`, and refactors
it to better match mrclib. To me it doesn't necessarily belong in its
`thirdparty` location because it is bazel only.
- Due to the refactoring, libssh and ceres can now be pulled into
`MODULE.bazel` instead of the `WORKSPACE.bzlmod` helper. This is good
prep for a potential upgrade to killing `--enable_workspace` / bazel 9
- Write a python script that can deal with the integrity / sha256 of the
http_archives. I suggested this be added to davo's mrclib PR, but this
one is a little bit more robust and will actually edit the files in
place. This makes upgrading versions substantially easier.
- Upgrade libssh version to what gradle is using, and mrclib to the
version in #8858. These changes have been tested against that PR.
2026-06-19 15:25:07 -07:00

64 lines
2.5 KiB
Plaintext

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
################################################################################
# Generated by shared/bazel/thirdparty/integrity_helper.py
url_pattern = "https://frcmaven.wpi.edu/release/org/wpilib/thirdparty/libssh/2027-0.120-1/libssh-2027-0.120-1-%s.zip"
headers_integrity = "ddd1f5078496ad3316cc2e35881380909fb536e450900a7d3efb57f1cefbf4d7"
_LIB_ARTIFACTS = {
"linuxarm64static": ("linux", "**/*.a", "bf253a5dfec416137f1fad88c7ae5cb50d38757e60efcd0ef9ddf1f6af272b75"),
"linuxarm64staticdebug": ("linux", "**/*.a", "b93418670c1b93589d5851580afdfb1b69339b4606d52f9d7f0501e9a073cd17"),
"linuxx86-64static": ("linux", "**/*.a", "5d02d5aecc521d0c3cab5f3ec7c5668802f38337138e97fceb5e19a957888e60"),
"linuxx86-64staticdebug": ("linux", "**/*.a", "d7c75fabd584a6c155d3d784b8edeffa75296a96c03417a9fc0b4a5106c88210"),
"osxuniversalstatic": ("osx", "**/*.a", "7acdb5f49fb3aa5fcea9cf4b1d806a42ea845f9dd628d72dec55837de09f3d3e"),
"osxuniversalstaticdebug": ("osx", "**/*.a", "41863cf0a73256df147e6f72ead07b34111e13219dbdbabb082dea1ded8ece10"),
"windowsx86-64static": ("windows", "**/*.lib", "849be403d4785a432d377a0392332839d8e293401c0509bcf3a8ea0b8a9255cc"),
"windowsx86-64staticdebug": ("windows", "**/*.lib", "347116aa6173a916fbb3362634ccd996c771499a564ef2b455212e38e07b267d"),
"windowsarm64static": ("windows", "**/*.lib", "6d42d0854a6343ec30e7d569bddbfcefcafefcde8ed68f697ba7a0bc60446f2b"),
"windowsarm64staticdebug": ("windows", "**/*.lib", "51dd10884606d839ede280bafa1ffdcefc466ac034a24e600aac3aeddf9d0d02"),
}
# End auto-gen
################################################################################
http_archive(
name = "libssh_headers",
build_file_content = """
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "headers",
hdrs = glob(["**"]),
includes = ["."],
visibility = ["//visibility:public"],
)
filegroup(
name = "header_files",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
""",
sha256 = headers_integrity,
url = url_pattern % "headers",
)
library_build_content = """
filegroup(
name = "static_libs",
srcs = glob(["%s"]),
visibility = ["//visibility:public"],
)
"""
[
http_archive(
name = "libssh_" + artifact,
build_file_content = library_build_content % glob_pattern,
sha256 = sha256,
strip_prefix = prefix,
url = url_pattern % artifact,
)
for artifact, (prefix, glob_pattern, sha256) in _LIB_ARTIFACTS.items()
]