Skip to content

Conversation

@mering
Copy link
Contributor

@mering mering commented Jan 12, 2026

This has been requested for a long time and many projects have been documenting this downstream (for example Fuchsia).

Documenting this for C++, Go, Python, Shell as these are the languages we are using. Feel free to add additional languages in a follow-up.

I couldn't find a way to embed the example files directly in the documentation to ensure the examples can easily be tested, so I just copied the content in the MDX file.

The dependency to rules_go already existed transitively, so this is not newly added. Consider using a separate MODULE.bazel file for the examples folder in the future.

Fixes #10022.

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Jan 12, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds valuable documentation for the runfiles concept, a long-requested feature. It provides examples for C++, Go, Python, and Shell, along with the necessary build configurations and source files to make them runnable. While the C++ and Go examples are correct, I've found critical errors in the Python and Shell examples that would prevent them from running as-is. The same errors are present in both the documentation and the example files. I've provided suggestions to correct these issues. With these fixes, this will be an excellent contribution.

@mering mering force-pushed the runfiles-docs branch 3 times, most recently from 20c1e78 to 6c4d158 Compare January 12, 2026 18:04
@fmeum fmeum self-requested a review January 12, 2026 22:19
@meisterT meisterT requested a review from lberki January 13, 2026 12:46
Copy link
Contributor

@lberki lberki left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I only have minor stylistic nits.

@mering
Copy link
Contributor Author

mering commented Jan 13, 2026

@lberki thanks for the review! I addressed your comments. PTAL.

@mering
Copy link
Contributor Author

mering commented Jan 13, 2026

@lberki looks like some tests are using an old C++ toolchain without the filesystem include. Can I exclude these tests or specify some additional option to make this available?

@lberki
Copy link
Contributor

lberki commented Jan 14, 2026

Thanks and apologies for that space thing; for some reason, I didn't realize that there are newlines after.

re: #include <filesystem>, can you make do without? It looks like it's not a hard requirement for the example since runfiles.h takes an std::string. My C++ is somewhat rusty so I don't know if there is another officially blessed way to figure it out, but in the worst case #ifdef _WIN32 or hard-wiring a slash is preferable to disabling this test for some platforms.

@mering mering force-pushed the runfiles-docs branch 2 times, most recently from a3e6c31 to 7ed3272 Compare January 14, 2026 18:20
Note that rules_go was already a transitive dependency.
@lberki
Copy link
Contributor

lberki commented Jan 15, 2026

Thanks! I assume this is now ready for review? (before I apply the "ready to merge" label)

@mering
Copy link
Contributor Author

mering commented Jan 15, 2026

Thanks! I assume this is now ready for review? (before I apply the "ready to merge" label)

Yes indeed. I was only waiting for the test results before I planned to ping you again.

@lberki
Copy link
Contributor

lberki commented Jan 15, 2026

Oh sorry, I didn't realize I jumped the gun :) click

@lberki lberki added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jan 15, 2026
@iancha1992
Copy link
Member

iancha1992 commented Jan 15, 2026

@mering Could you please make a change to runfile.py to address the below from our internal review?

Missing module docstring [missing-module-docstring]
//depot/google3/third_party/bazel/examples/py/runfile.py:1:1
Use implicit True/False evaluation [g-explicit-bool-comparison]
//depot/google3/third_party/bazel/examples/py/runfile.py:9:4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document runfiles

3 participants