Skip to content

[bazel] Clean up bazel scripts #7984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 14, 2025
Merged

Conversation

pjreiniger
Copy link
Contributor

@pjreiniger pjreiniger commented May 20, 2025

This is a big cleanup of some of the things Austin has seen as he is getting up to speed, as well as prep work for future efforts like publishing and eventualy bazel version upgrades.

  • Clean up empty globs. incompatible_disallow_empty_glob will be enabled by default in bazel 8, and there were quite a few places that were providing no files in the 2027 branch.
  • Create helper functions for dealing with the third party libraries. Just some syntactic sugar and will be helpful when doing source / header publishing
  • Limit target visibility. My original implementation had more BUILD files (i.e one for java, one for c++, one for tests, etc) instead of monolithic ones per project. This resulted in a lot of targets having something like //wpiutil:__subpackages__. Since the build files are monolithic that does basically nothing, so I deleted visibility which makes it package private.
  • Austin noticed a lot of things where being guarded on build with either no-roborio / manual / etc tags, because they would break during cross compilation. This updates all of those locations to use target_compatible_with instead.
  • The examples json files did not correctly indicate some examples that had tests, and bazel uses the json files to generate targets.
  • Adds bazel targets for cscore examples
  • Adds bazel target for datalogtool. I skipped it with the gui PR because I didn't think I moved the libssh library to wpilibsuite control, but it turns out I had good foresight when transfering all those repos over.
  • Deletes a multiple files that were not built by gradle. Since these were not built by gradle they have fallen severely out of date and have no chance to compile. If you like it you should have put a build target on it #BeyonceRule

With these changes the bazel coverage should be everything except wpical and ntcoreffi

@pjreiniger pjreiniger marked this pull request as ready for review May 20, 2025 02:54
@pjreiniger pjreiniger requested review from PeterJohnson and a team as code owners May 20, 2025 02:54
@github-actions github-actions bot added component: ntcore NetworkTables library component: cscore CameraServer library component: wpiutil WPI utility library component: wpilibj WPILib Java component: wpilibc WPILib C++ component: hal Hardware Abstraction Layer component: command-based WPILib Command Based Library component: wpimath Math library component: glass Glass app and backend component: datalogtool DataLog Tool component: wpinet WPI networking library component: apriltag AprilTag library component: examples component: sysid SysId app labels May 20, 2025
@github-actions github-actions bot added component: wpiunits Java units library 2027 2027 target labels May 20, 2025
@pjreiniger pjreiniger requested a review from AustinSchuh May 20, 2025 02:54
Copy link
Contributor

@AustinSchuh AustinSchuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some quick comments before I dig in further tomorrow. Thanks for posting this!

WORKSPACE Outdated
name = "bzlmodrio-libssh",
sha256 = "65caef82554617403a16c79e8bcac6553d40eca3e23197e63275bba22db7d5b5",
strip_prefix = "bzlmodRio-libssh-8405fbd5eb4e42b495f08f6ccf6fbbe5ced28bb7",
urls = ["https://github.com/bzlmodrio/bzlmodRio-libssh/archive/8405fbd5eb4e42b495f08f6ccf6fbbe5ced28bb7.tar.gz"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep this in the wpilibsuite org? Or move it into it?

"usbviewer",
]

def build_cpp_examples():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI,

[
  cc_library(name = f, ...) for f in ['a', 's' ,'d', 'f']
 ]

works in BUILD files.

@AustinSchuh
Copy link
Contributor

Hey @pjreiniger , the rest of it looks good, could you address those 2 comments, then let's merge?

@PeterJohnson PeterJohnson merged commit fbbc4bc into wpilibsuite:2027 Jun 14, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2027 2027 target component: apriltag AprilTag library component: command-based WPILib Command Based Library component: cscore CameraServer library component: datalogtool DataLog Tool component: examples component: glass Glass app and backend component: hal Hardware Abstraction Layer component: ntcore NetworkTables library component: sysid SysId app component: wpilibc WPILib C++ component: wpilibj WPILib Java component: wpimath Math library component: wpinet WPI networking library component: wpiunits Java units library component: wpiutil WPI utility library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants