Skip to content

[bazel] Create better static libraries and add basic packaging for eventual publishing. #8029

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

Open
wants to merge 4 commits into
base: 2027
Choose a base branch
from

Conversation

pjreiniger
Copy link
Contributor

This is a watered down version of a combo of #8025 and #7971. Austins PR will have some work to do to get it working on windows, and my publishing PR should be superseded by his (unpublished) work with the rules_jvm_external.

Since a large portion of his PR is library renames for easier publishing, and adding the smarter static libraries, this rips out just those relevant bits while the windows shared library problem can be worked on. separately

@pjreiniger pjreiniger marked this pull request as ready for review June 17, 2025 01:29
@pjreiniger pjreiniger requested review from PeterJohnson and a team as code owners June 17, 2025 01:29
@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 component: wpiunits Java units library component: epilogue Annotation-based logging library 2027 2027 target labels Jun 17, 2025
linker_inputs = []
for linker_input in dependency_linker_inputs:
for lib in linker_input.libraries:
for o in lib.objects + lib.pic_objects:
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, with -c opt on Linux, I think this needs to be one or the other. I've seen both populated. Happy to be wrong if you've dug deeper and know what I saw.

output_file = ctx.actions.declare_file(ctx.attr.static_lib_name)
else:
folder, lib = _folder_prefix(ctx.label.name)
output_file = ctx.actions.declare_file(folder + "/lib" + lib + ".a")
Copy link
Contributor

Choose a reason for hiding this comment

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

Mind putting a TODO here on .lib vs .a?

feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features + ["force_no_whole_archive"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Mind a quick comment on what force_no_whole_archive does for us here?

@AustinSchuh
Copy link
Contributor

I'm happy with TODOs for some of these things too. I mostly don't want to lose the open threads.

Thanks for doing this!

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: epilogue Annotation-based logging library 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.

2 participants