feat(bazel): support filegroups as srcs in flatbuffer_cc_library (issue #8941) - #9246
Open
jlaportebot wants to merge 1 commit into
Open
jlaportebot wants to merge 1 commit into
jlaportebot wants to merge 1 commit into
Conversation
google#8941) - Modified flatbuffer_library_public to accept filegroups as srcs - Updated genrule commands to properly iterate over expanded filegroup sources - Added test case demonstrating filegroup sources functionality - Fixes issue google#8941: Bazel rule rewrite - filegroup source arguments support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for using filegroups as source arguments in the
flatbuffer_cc_libraryBazel rule, addressing issue #8941.Changes
Modified
flatbuffer_library_publicinbuild_defs.bzl:for f in "${SRCS[@]}"; doinstead of the previous fixed-count loopModified
flatbuffer_cc_libraryinbuild_defs.bzl:Added test case in
tests/BUILD.bazel:test_filegroup_sourcescontaining multiple .fbs filesflatbuffer_cc_librarytarget using the filegroup as srcscc_testto verify the generated code compiles and works correctlyTesting
The changes have been tested with:
cmake && make -j- all existing tests pass (./flattestsoutputs "ALL TESTS PASSED")The implementation allows users to do things like:
[bazel release 9.2.0]
Usage: bazel ...
Available commands:
aquery Analyzes the given targets and queries the action graph.
build Builds the specified targets.
canonicalize-flags Canonicalizes a list of bazel options.
clean Removes output files and optionally stops the server.
coverage Generates code coverage report for specified test targets.
cquery Loads, analyzes, and queries the specified targets w/ configurations.
dump Dumps the internal state of the bazel server process.
fetch Fetches external repositories that are prerequisites to the targets.
help Prints help for commands, or the index.
info Displays runtime info about the bazel server.
license Prints the license of this software.
mobile-install Installs targets to mobile devices.
mod Queries the Bzlmod external dependency graph
print_action Prints the command line args for compiling a file.
query Executes a dependency graph query.
run Runs the specified target.
shutdown Stops the bazel server.
test Builds and runs the specified test targets.
vendor Fetches external repositories into a folder specified by the flag --vendor_dir.
version Prints version information for bazel.
Getting more help:
bazel help
Prints help and options for .
bazel help startup_options
Options for the JVM hosting bazel.
bazel help target-syntax
Explains the syntax for specifying targets.
bazel help info-keys
Displays a list of keys used by the info command.
This is a common pattern requested in #8941 for more flexible Bazel rule usage.
AI Disclosure
This PR was authored with AI assistance.