Skip to content

Flip incompatible_disable_autoloads_in_main_repo #28

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: master
Choose a base branch
from

Conversation

arvi18
Copy link

@arvi18 arvi18 commented Aug 9, 2025

The flag flip forces loads in main repository when using Bazel@HEAD. Flipping it now, so that we can disable autoloads by release of Bazel 9.

PiperOrigin-RevId: 745526309
Change-Id: I7204470c08a66a15b28bc0b0c48f41d69e1694c8

Summary by CodeRabbit

  • Style
    • BUILD and test files now include explicit load statements for language and tool rules (Java, Python, Shell, C++) from their respective external repositories.
    • Test scripts and setup functions have been updated to declare dependencies in MODULE.bazel files for relevant rule sets.
    • Formatting of BUILD file contents and test setup has been standardized for clarity and consistency.
  • Bug Fixes
    • Ensured that all build and test environments correctly load and reference external rule definitions, reducing ambiguity and potential errors.
  • New Features
    • Default behavior for a build language option was updated to enhance rule loading control.
  • Chores
    • Improved test and example reliability by making rule loading explicit across all scenarios.

The flag flip forces loads in main repository when using Bazel@HEAD. Flipping it now, so that we can disable autoloads by release of Bazel 9.

PiperOrigin-RevId: 745526309
Change-Id: I7204470c08a66a15b28bc0b0c48f41d69e1694c8
Copy link

coderabbitai bot commented Aug 9, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • chair.jpeg is excluded by !**/*.jpeg

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change set systematically updates BUILD files, test scripts, and test data across the codebase to explicitly load Bazel rule definitions from their respective external repositories (such as rules_python, rules_java, rules_cc, and rules_shell) before using those rules. Additionally, test scripts and test data are updated to declare module dependencies in MODULE.bazel files, ensuring explicit and consistent rule usage throughout the project. No core logic or control flow is altered.

Changes

Cohort / File(s) Change Summary
Python Rule Loads in Examples
examples/py/BUILD, examples/py_native/BUILD, examples/py_native/fibonacci/BUILD
Added explicit load statements for py_binary, py_library, and py_test from @rules_python at the top of BUILD files.
Shell Rule Loads in Examples
examples/shell/BUILD
Added explicit load statements for sh_binary, sh_library, and sh_test from @rules_shell at the top of the BUILD file.
Shell Rule Loads in Source
src/BUILD
Added a load statement for sh_binary from @rules_shell//shell:sh_binary.bzl.
Java Proto Rule Loads
src/main/java/com/google/devtools/build/skyframe/BUILD
Added a load statement for java_proto_library from @com_google_protobuf//bazel:java_proto_library.bzl.
BuildLanguageOptions Default Change
src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java
Changed the default value of incompatible_disable_autoloads_in_main_repo from false to true; updated its key prefix from negative to positive in the constant.
Test Setup: Add Rules to MODULE.bazel
src/main/starlark/tests/builtins_bzl/builtin_test_setup.sh, src/test/shell/bazel/bazel_example_test.sh, src/test/shell/bazel/bazel_hermetic_sandboxing_test.sh, src/test/shell/bazel/bazel_symlink_test.sh
Added calls to add_rules_python, add_rules_shell, or add_rules_java in setup functions to ensure rules are included in MODULE.bazel.
Explicit Rule Loads in Test BUILD Files
src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test/BUILD.builtin_test, src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test/BUILD.builtin_test, src/main/java/com/google/devtools/build/skyframe/BUILD
Added explicit load statements for C++ and shell rules at the top of BUILD files.
Test Shell Scripts: Add Rule Loads and Setup
src/test/shell/bazel/bazel_build_event_stream_test.sh, src/test/shell/bazel/bazel_coverage_cc_test_gcc.sh, src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh, src/test/shell/bazel/bazel_coverage_java_test.sh, src/test/shell/bazel/bazel_java_test.sh, src/test/shell/bazel/bazel_java_test_defaults.sh, src/test/shell/bazel/bazel_localtest_test.sh, src/test/shell/bazel/bazel_proto_library_test.sh, src/test/shell/bazel/bazel_random_characters_test.sh, src/test/shell/bazel/bazel_rules_java_override_test.sh, src/test/shell/bazel/bazel_rules_java_test.sh, src/test/shell/bazel/bazel_rules_test.sh, src/test/shell/bazel/bazel_sandboxing_test.sh, src/test/shell/bazel/bazel_test_test.sh, src/test/shell/bazel/remote/remote_build_event_uploader_test.sh, src/test/shell/bazel/remote/remote_execution_http_test.sh, src/test/shell/bazel/remote/remote_execution_test.sh, src/test/shell/testenv.sh
Added explicit load statements for relevant rules in BUILD files generated within test scripts; added calls to helper functions to add rules to MODULE.bazel in setups; reformatted or standardized test data and helper code.
Python Test Data and Helpers
src/test/py/bazel/py_test.py, src/test/py/bazel/query_test.py, src/test/py/bazel/runfiles_test.py, src/test/py/bazel/launcher_test.py, src/test/py/bazel/bazel_external_repository_test.py, src/test/java/com/google/devtools/build/lib/blackbox/tests/PythonBlackBoxTest.java
Updated test data and helpers to add explicit load statements for Python rules and to create MODULE.bazel files with rules_python dependencies.
Java Test Data and Helpers
src/test/py/bazel/launcher_test.py, src/test/py/bazel/runfiles_test.py
Updated test data and helpers to add explicit load statements for Java rules and to create MODULE.bazel files with rules_java dependencies.
Other Minor Additions
src/test/shell/testenv.sh
Added a load statement for java_import from @rules_java in a helper function.
Documentation
README.md
Added a trailing newline at the end of the file.

Sequence Diagram(s)

sequenceDiagram
    participant TestScript
    participant MODULE.bazel
    participant BUILD
    participant BazelRulesRepo

    TestScript->>MODULE.bazel: Add bazel_dep for rules_python/rules_java/rules_shell
    TestScript->>BUILD: Insert load("@rules_xxx//...", "rule_name")
    BUILD->>BazelRulesRepo: Reference rule implementation
    BazelRulesRepo-->>BUILD: Provide rule
    BUILD->>TestScript: Rule available for target definition
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit hops from file to file,
Loading rules with a tidy smile.
Python, Java, Shell, and C++,
Each now loaded, clean and true.
MODULE.bazel gets its due,
Explicit, clear—no more guess!
Review is light; the code is less of a mess.
🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clone-flip-main-autoloads

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

Summary of Changes

Hello @arvi18, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've flipped the incompatible_disable_autoloads_in_main_repo flag to true as a preparatory step for Bazel 9, which will disable implicit rule loading. This change necessitates explicit load statements for all rules in BUILD files, and I've updated numerous examples and test setups to reflect this new requirement. The goal is to ensure that all necessary rules are explicitly declared, preventing build failures once autoloads are fully deprecated.

Highlights

  • Incompatible Flag Flip: The core change in this pull request is the flipping of the incompatible_disable_autoloads_in_main_repo flag's default value from false to true within BuildLanguageOptions.java. This is a significant step towards Bazel 9, where autoloads will be disabled, requiring explicit load statements for all rules.
  • Widespread Explicit Rule Loading: As a direct consequence of disabling autoloads, numerous BUILD files across various examples and source directories have been updated. This includes adding explicit load statements for commonly used rules such as py_binary, py_library, py_test, sh_binary, sh_library, sh_test, java_binary, java_library, java_import, java_plugin, cc_library, cc_binary, cc_import, cc_test, proto_library, and java_proto_library where they were previously implicitly available.
  • Comprehensive Test Infrastructure Updates: The pull request also includes extensive updates to Python and shell test infrastructure. This involves modifying test scripts to ensure that bazel_dep entries for rulesets like rules_python, rules_shell, rules_java, and rules_cc are correctly added to MODULE.bazel files, and that load statements are explicitly present in BUILD files generated within tests. These changes are crucial for maintaining test functionality under the new autoloading behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

refacto-test bot commented Aug 9, 2025

🤖 Refacto.AI: PR Summary & Reviewer Guide

🎯 1. The Goal (Why was this PR raised?)

This PR aims to enable the incompatible_disable_autoloads_in_main_repo flag by default, which prevents automatic loading of rule definitions in the main repository. The change requires explicit loading of rules in BUILD files across the codebase.

🗺️ 2. The Changes (What was implemented?)

This section provides a walkthrough of the changes, connecting them to the PR's goals.

File Name Implementation Details Goal / Requirement Addressed
src/test/py/bazel/launcher_test.py (Modified) Added explicit load statements for rules_java, rules_shell, and rules_python in various test BUILD files Explicit rule loading
src/test/py/bazel/py_test.py (Modified) Added explicit load statements for rules_python and added MODULE.bazel with rules_python dependency Explicit rule loading
src/test/py/bazel/bazel_external_repository_test.py (Modified) Added explicit load statements for rules_python and reformatted repository rule definitions Explicit rule loading
src/test/py/bazel/runfiles_test.py (Modified) Added explicit load statements for rules_python, rules_shell, and reformatted repository rule definitions Explicit rule loading
src/test/shell/bazel/bazel_java_test.sh (Modified) Added explicit load statements for rules_java, rules_cc, and rules_shell Explicit rule loading
src/test/shell/bazel/bazel_test_test.sh (Modified) Added explicit load statements for rules_shell and added MODULE.bazel with rules_shell dependency Explicit rule loading
src/test/shell/bazel/launcher_test.py (Modified) Added explicit load statements for rules_java, rules_shell, and rules_python Explicit rule loading
src/test/shell/bazel/bazel_coverage_cc_test_gcc.sh (Modified) Added explicit load statements for rules_cc and added setup function to include rules_cc Explicit rule loading
src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh (Modified) Added explicit load statements for rules_cc and rules_java, and added setup function Explicit rule loading
src/test/shell/bazel/bazel_coverage_java_test.sh (Modified) Added explicit load statements for rules_java, rules_cc, and added setup function Explicit rule loading
src/test/shell/bazel/bazel_java_test_defaults.sh (Modified) Added explicit load statements for rules_java and rules_cc Explicit rule loading
src/test/shell/bazel/bazel_proto_library_test.sh (Modified) Added explicit load statements for protobuf rules, rules_java, and rules_shell Explicit rule loading
src/test/shell/bazel/bazel_rules_test.sh (Modified) Added explicit load statements for rules_shell, rules_java, rules_cc, and rules_python Explicit rule loading
src/test/py/bazel/query_test.py (Modified) Added explicit load for rules_python and added MODULE.bazel with rules_python dependency Explicit rule loading
src/test/shell/bazel/bazel_build_event_stream_test.sh (Modified) Added explicit load statements for rules_shell Explicit rule loading
src/test/shell/bazel/bazel_sandboxing_test.sh (Modified) Added explicit load statements for rules_python, rules_shell, and rules_cc Explicit rule loading
src/test/shell/bazel/remote/remote_execution_test.sh (Modified) Added explicit load statements for rules_cc, rules_python, and rules_shell Explicit rule loading
src/test/shell/bazel/remote/remote_execution_http_test.sh (Modified) Added explicit load statements for rules_cc and rules_shell Explicit rule loading
src/test/java/com/google/devtools/build/lib/blackbox/tests/PythonBlackBoxTest.java (Modified) Added explicit load for rules_python and added MODULE.bazel with rules_python dependency Explicit rule loading
examples/py/BUILD (Modified) Added explicit load statements for rules_python Explicit rule loading
examples/py_native/BUILD (Modified) Added explicit load statements for rules_python Explicit rule loading
examples/shell/BUILD (Modified) Added explicit load statements for rules_shell Explicit rule loading
src/BUILD (Modified) Added explicit load for rules_shell Explicit rule loading
examples/py_native/fibonacci/BUILD (Modified) Added explicit load statements for rules_python Explicit rule loading
src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java (Modified) Changed default value of incompatible_disable_autoloads_in_main_repo from false to true, and changed flag prefix from - to + Enable flag by default
src/main/java/com/google/devtools/build/skyframe/BUILD (Modified) Added explicit load for java_proto_library Explicit rule loading
src/test/shell/bazel/BUILD (Modified) Added explicit load statements for rules_shell Explicit rule loading
src/test/shell/bazel/bazel_example_test.sh (Modified) Added rules_python and rules_shell to MODULE.bazel Explicit rule loading
src/test/shell/bazel/bazel_hermetic_sandboxing_test.sh (Modified) Added rules_python to MODULE.bazel and explicit load for rules_python Explicit rule loading
src/test/shell/bazel/bazel_localtest_test.sh (Modified) Added rules_shell to MODULE.bazel and explicit load for rules_shell Explicit rule loading
src/test/shell/bazel/bazel_random_characters_test.sh (Modified) Added rules_java to MODULE.bazel and explicit load for rules_java Explicit rule loading
src/test/shell/bazel/bazel_rules_java_override_test.sh (Modified) Added explicit load for rules_java and added rules_java to MODULE.bazel Explicit rule loading
src/test/shell/bazel/bazel_rules_java_test.sh (Modified) Added explicit load for JavaInfo Explicit rule loading
src/test/shell/bazel/bazel_symlink_test.sh (Modified) Added rules_python to MODULE.bazel and explicit load for rules_python Explicit rule loading
src/test/shell/testenv.sh (Modified) Added explicit load for rules_java Explicit rule loading
src/main/starlark/tests/builtins_bzl/builtin_test_setup.sh (Modified) Added rules_shell to MODULE.bazel Explicit rule loading
src/test/shell/bazel/remote/remote_build_event_uploader_test.sh (Modified) Added explicit load statements for rules_shell Explicit rule loading
src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test/BUILD.builtin_test (Modified) Added explicit load statements for rules_cc and rules_shell Explicit rule loading
src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test/BUILD.builtin_test (Modified) Added explicit load statements for rules_cc and rules_shell Explicit rule loading

🤔 3. Key Areas for Human Review

Here are the most important areas to focus your review on, including specific testing instructions.

Area of Concern: Core Flag Change

  • File: src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java (Lines 149-155, 950-956)
  • Why: This is the core change that flips the default value of the incompatible_disable_autoloads_in_main_repo flag from false to true, affecting how rules are loaded across the codebase.
  • Testing Instruction: Verify that the default value is correctly changed to true and that the flag prefix is changed from - to +. Test a simple build with the new default to ensure it requires explicit loading of rules.

Area of Concern: Test Coverage

  • File: Multiple test files (bazel_java_test.sh, py_test.py, etc.)
  • Why: The changes affect numerous test files across the codebase. Missing or incorrect load statements could cause tests to fail.
  • Testing Instruction: Run the full test suite to ensure all tests pass with the new flag enabled by default. Pay special attention to tests that might not have been updated but still rely on auto-loading of rules.

Area of Concern: Example Code

  • Files: examples/py/BUILD, examples/py_native/BUILD, examples/shell/BUILD
  • Why: These are example files that users might reference. They need to demonstrate the correct way to load rules.
  • Testing Instruction: Build the example targets to ensure they work correctly with the new flag enabled. Verify that the load statements are correct and follow best practices.

Area of Concern: Module Dependencies

  • Files: Various MODULE.bazel files added or modified
  • Why: The changes add explicit dependencies on rules_java, rules_python, and rules_shell in MODULE.bazel files. Incorrect versions or missing dependencies could cause build failures.
  • Testing Instruction: Verify that the specified versions of rules_java (8.11.0), rules_python (0.40.0), and rules_shell (0.3.0) are compatible with the current Bazel version and that all necessary dependencies are included.

@arvi18
Copy link
Author

arvi18 commented Aug 9, 2025

/refacto-test

Copy link

refacto-test bot commented Aug 9, 2025

Refacto is reviewing this PR. Please wait for the review comments to be posted.

Copy link

refacto-test bot commented Aug 9, 2025

Code Review: Autoload Disabling in Bazel

👍 Well Done
Module System Migration

Proper load statements added for rules across test files improve build predictability and performance

Secure Default Configuration

Enabling autoload disabling by default improves security posture by requiring explicit dependencies

📝 Additional Comments
src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java (1)
Default Flag Change Without Documentation

Flag default changed but no migration plan documented. Changing default behavior without clear documentation risks breaking existing builds that rely on autoloads.

    @Option(
        name = "incompatible_disable_autoloads_in_main_repo",
        defaultValue = "true",
        documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
        effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
        help = "When enabled, disables automatic loading of rules in the main repository. " +
        "Users must explicitly load rules with load() statements. This improves build reliability."

Standards:

  • ISO-IEC-25010-Reliability-Maturity
  • ISO-IEC-25010-Functional-Appropriateness
  • SRE-Change-Management
src/test/py/bazel/launcher_test.py (1)
Batch Module Loading Opportunity

Multiple separate MODULE.bazel file creations with individual dependencies could be consolidated to reduce file I/O operations during tests, improving test execution time.

def add_test_dependencies(self):
    self.ScratchFile(
        'MODULE.bazel',
        [
            'bazel_dep(name = "rules_java", version = "8.11.0")',
            'bazel_dep(name = "rules_python", version = "0.40.0")',
            'bazel_dep(name = "rules_shell", version = "0.3.0")',
        ],
    )

Standards:

  • ISO-IEC-25010-Performance-Resource-Utilization
  • Google-Performance-Best-Practices

Comment on lines +240 to +242
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
)
Copy link

Choose a reason for hiding this comment

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

Missing Rules Dependencies in Launcher Test

Missing rules_shell dependency in MODULE.bazel while using shell rules. Without proper dependency declaration, builds will fail when incompatible_disable_autoloads_in_main_repo is enabled, creating potential build failures.

Suggested change
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
)
self.ScratchFile(
'MODULE.bazel', [
'bazel_dep(name = "rules_java", version = "8.11.0")',
'bazel_dep(name = "rules_shell", version = "0.3.0")'
]
)
Standards
  • CWE-1104
  • OWASP-A05

Comment on lines +52 to +54
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_python", version = "0.40.0")']
)
Copy link

Choose a reason for hiding this comment

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

Incomplete Module Configuration in Python Test

Missing rules_shell dependency in MODULE.bazel while shell rules are used elsewhere in the test. When incompatible_disable_autoloads_in_main_repo is enabled, builds will fail without explicit dependencies.

Suggested change
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_python", version = "0.40.0")']
)
self.ScratchFile(
'MODULE.bazel', [
'bazel_dep(name = "rules_python", version = "0.40.0")',
'bazel_dep(name = "rules_shell", version = "0.3.0")'
]
)
Standards
  • CWE-1104
  • OWASP-A05

Comment on lines 55 to +59
module(name="io_bazel")
EOF
add_rules_java "MODULE.bazel"
add_rules_python "MODULE.bazel"
add_rules_shell "MODULE.bazel"
Copy link

Choose a reason for hiding this comment

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

Missing Rules Dependencies in Example Test

Rules dependencies are added but not complete in the test setup. Missing rules_cc dependency causes potential build failures when cc rules are used in the examples and incompatible_disable_autoloads_in_main_repo is enabled.

Suggested change
module(name="io_bazel")
EOF
add_rules_java "MODULE.bazel"
add_rules_python "MODULE.bazel"
add_rules_shell "MODULE.bazel"
module(name="io_bazel")
EOF
add_rules_java "MODULE.bazel"
add_rules_python "MODULE.bazel"
add_rules_shell "MODULE.bazel"
add_rules_cc "MODULE.bazel"
Standards
  • ISO-IEC-25010-Reliability-Maturity
  • ISO-IEC-25010-Functional-Correctness-Appropriateness

Comment on lines +1 to 5
load("@rules_python//python:py_library.bzl", "py_library")

filegroup(
name = "srcs",
srcs = glob(["*.py"]) + [
Copy link

Choose a reason for hiding this comment

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

Unused Rule Import in Python Example

The py_library rule is loaded but not used in the file. Unused imports create maintenance burden and potential confusion. This can lead to reliability issues when dependencies change.

Suggested change
load("@rules_python//python:py_library.bzl", "py_library")
filegroup(
name = "srcs",
srcs = glob(["*.py"]) + [
filegroup(
name = "srcs",
srcs = glob(["*.py"]) + [
Standards
  • ISO-IEC-25010-Reliability-Maturity
  • ISO-IEC-25010-Functional-Correctness-Appropriateness

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 flips the incompatible_disable_autoloads_in_main_repo flag, which is a significant step towards modernizing Bazel's build language by requiring explicit load() statements. The changes are extensive and mostly correct. My review includes suggestions to improve maintainability by combining load statements, and fixes for a few test setups where dependencies were missing or code was malformed. Overall, this is a solid contribution.

')',
])
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']

Choose a reason for hiding this comment

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

high

This test uses sh_binary, which requires a dependency on rules_shell. Please add bazel_dep(name = "rules_shell", version = "0.3.0") to the MODULE.bazel file for this test to ensure it has all necessary dependencies.

Suggested change
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")', 'bazel_dep(name = "rules_shell", version = "0.3.0")']

@@ -617,9 +693,15 @@
def testWindowsNativeLauncherInLongPath(self):
if not self.IsWindows():
return
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']

Choose a reason for hiding this comment

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

high

This test uses sh_binary and py_binary, which require dependencies on rules_shell and rules_python. Please add bazel_dep entries for them in the MODULE.bazel file for this test.

Suggested change
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")', 'bazel_dep(name = "rules_shell", version = "0.3.0")', 'bazel_dep(name = "rules_python", version = "0.40.0")']

@@ -713,9 +795,15 @@
def testWindowsNativeLauncherInvalidArgv0(self):
if not self.IsWindows():
return
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']

Choose a reason for hiding this comment

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

high

This test uses sh_binary and py_binary, which require dependencies on rules_shell and rules_python. Please add bazel_dep entries for them in the MODULE.bazel file for this test.

Suggested change
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")', 'bazel_dep(name = "rules_shell", version = "0.3.0")', 'bazel_dep(name = "rules_python", version = "0.40.0")']

Comment on lines +142 to +147
"'# .v1 shouldn't be treated as extension and removed accidentally",
'py_binary(',
' name = "bin.v1",',
' srcs = ["bin.py"],',
' main = "bin.py",',
')',

Choose a reason for hiding this comment

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

high

This line appears to be a string literal containing a comment, which is likely a mistake. It should be a real comment inside the py_binary call to improve clarity and correctness.

Suggested change
"'# .v1 shouldn't be treated as extension and removed accidentally",
'py_binary(',
' name = "bin.v1",',
' srcs = ["bin.py"],',
' main = "bin.py",',
')',
'py_binary(',
' name = "bin.v1", # .v1 shouldn\'t be treated as extension and removed accidentally',
' srcs = ["bin.py"],',
' main = "bin.py",',
')',

Comment on lines +1 to +2
load("@rules_python//python:py_binary.bzl", "py_binary")
load("@rules_python//python:py_library.bzl", "py_library")

Choose a reason for hiding this comment

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

medium

For consistency and to reduce boilerplate, you can combine these two load statements into a single one from @rules_python//python:defs.bzl.

load("@rules_python//python:defs.bzl", "py_binary", "py_library")

Comment on lines +1 to +3
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("@rules_shell//shell:sh_library.bzl", "sh_library")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

Choose a reason for hiding this comment

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

medium

These load statements can be combined into a single one from @rules_shell//shell:shell.bzl for better readability and conciseness.

load("@rules_shell//shell:shell.bzl", "sh_binary", "sh_library", "sh_test")

Comment on lines +18 to +20
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_import.bzl", "cc_import")

Choose a reason for hiding this comment

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

medium

These load statements from @rules_cc can be combined into a single one from defs.bzl for better maintainability.

load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary", "cc_import")

Comment on lines +213 to +214
'load("@rules_python//python:py_library.bzl", "py_library")',
'load("@rules_python//python:py_test.bzl", "py_test")',

Choose a reason for hiding this comment

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

medium

These load statements can be combined into a single one from @rules_python//python:defs.bzl for better readability and conciseness.

Suggested change
'load("@rules_python//python:py_library.bzl", "py_library")',
'load("@rules_python//python:py_test.bzl", "py_test")',
'load("@rules_python//python:defs.bzl", "py_library", "py_test"),'

Comment on lines +259 to +261
'load("@rules_python//python:py_library.bzl", "py_library")',
'load("@rules_python//python:py_binary.bzl", "py_binary")',
'load("@rules_python//python:py_test.bzl", "py_test")',

Choose a reason for hiding this comment

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

medium

These load statements can be combined into a single one from @rules_python//python:defs.bzl for better readability and conciseness.

Suggested change
'load("@rules_python//python:py_library.bzl", "py_library")',
'load("@rules_python//python:py_binary.bzl", "py_binary")',
'load("@rules_python//python:py_test.bzl", "py_test")',
'load("@rules_python//python:defs.bzl", "py_library", "py_binary", "py_test"),'

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (4)
src/test/shell/testenv.sh (1)

476-489: Ensure explicit load for java_import even when junit4 target already exists

When third_party/BUILD already declares name = "junit4" (from a legacy setup), the current guard skips appending the block—and thus never adds the required load("@rules_java//java:java_import.bzl", "java_import"). With autoloads disabled, this will break the BUILD file.

Suggested patch:

 function setup_javatest_support() {
   setup_javatest_common
-  grep -q 'name = "junit4"' third_party/BUILD \
-    || cat <<EOF >>third_party/BUILD
- load("@rules_java//java:java_import.bzl", "java_import")
-
- java_import(
-     name = "junit4",
-     jars = [
-         "junit.jar",
-         "hamcrest.jar",
-     ],
- )
- EOF
+  # Append junit4 target + load if missing entirely
+  grep -q 'name = "junit4"' third_party/BUILD \
+    || cat <<EOF >>third_party/BUILD
+load("@rules_java//java:java_import.bzl", "java_import")
+
+java_import(
+    name = "junit4",
+    jars = [
+        "junit.jar",
+        "hamcrest.jar",
+    ],
+)
+EOF
+
+  # If junit4 exists but the load is not present, prepend it
+  if grep -q 'name = "junit4"' third_party/BUILD \
+     && ! grep -q '@rules_java//java:java_import.bzl' third_party/BUILD; then
+    tmp="$(mktemp)"
+    {
+      echo 'load("@rules_java//java:java_import.bzl", "java_import")'
+      cat third_party/BUILD
+    } > "$tmp" && mv "$tmp" third_party/BUILD
+  fi
 }
  • This guarantees the load statement is present regardless of how junit4 was first added.
  • No other files are affected.
src/test/shell/bazel/bazel_proto_library_test.sh (2)

54-61: String-comparison bug – -eq is for integers, not strings

if [ "${include_macro}" -eq "" ]; then will raise
“integer expression expected” whenever ${include_macro} is non-empty.
Use string operators instead:

-if [ "${include_macro}" -eq "" ]; then
+if [ -z "${include_macro}" ]; then

282-286: Broken quote in generated BUILD file

export_files(["proto_library_macro.bzl]) is missing the closing
quotation mark and will yield a syntax error when the file is parsed.

-export_files(["proto_library_macro.bzl])
+export_files(["proto_library_macro.bzl"])
src/test/shell/bazel/bazel_coverage_cc_test_gcc.sh (1)

536-538: Unquoted argument – will split and break on spaces

add_rules_cc MODULE.bazel is missing quotes; the shell passes two
separate arguments when the path contains spaces, breaking the helper.

-add_rules_cc MODULE.bazel
+add_rules_cc "MODULE.bazel"
♻️ Duplicate comments (1)
src/test/shell/bazel/remote/remote_build_event_uploader_test.sh (1)

456-456: Same initialization suggestion applies here.

See the earlier comment about moving add_rules_shell "MODULE.bazel" into set_up().

🧹 Nitpick comments (15)
src/test/shell/bazel/bazel_random_characters_test.sh (1)

52-52: Quote the MODULE.bazel argument for robustness.

While unquoted works here, quoting avoids surprises and matches the rest of the repo.

-  add_rules_java MODULE.bazel
+  add_rules_java "MODULE.bazel"
src/test/shell/bazel/remote/remote_build_event_uploader_test.sh (1)

428-428: Initialize rules in set_up() once to avoid duplication.

Calling add_rules_shell per test works if it's idempotent, but moving it to set_up() reduces repetition and the risk of duplicating MODULE content.

Example adjustment (outside current hunk):

function set_up() {
  add_rules_shell "MODULE.bazel"
  start_worker
}

Then remove add_rules_shell "MODULE.bazel" from individual tests.

src/test/shell/bazel/bazel_rules_java_override_test.sh (2)

77-78: Declare rules_java module before use — good

add_rules_java "MODULE.bazel" before generating the BUILD is the right ordering.

If multiple tests in this file need rules_java, consider moving add_rules_java into a file-level set_up() to avoid duplication.


91-92: Redundant per-test add_rules_java

This mirrors the earlier test. Works as-is. Optionally factor into set_up() for dedup.

src/test/shell/bazel/bazel_sandboxing_test.sh (1)

332-336: C++ rules declared and loaded before usage — good

  • add_rules_cc "MODULE.bazel"
  • load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

If many tests in this file need rules_cc, consider adding add_rules_cc in the existing set_up() to reduce repetition.

src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java (1)

150-160: Flip default to true — OK; fix help string spacing/grammar

  • Default value for incompatible_disable_autoloads_in_main_repo is correctly flipped to "true".
  • Minor nit: the help string concatenation misses a space between "in the" and "main repository", yielding "inthemain". Also consider a comma after "When enabled".

Apply this diff:

-          "Controls if the autoloads (set by --incompatible_autoload_externally) are enabled in the"
-              + "main repository. When enabled the rules (or other symbols) that were previously "
+          "Controls if the autoloads (set by --incompatible_autoload_externally) are enabled in the "
+              + "main repository. When enabled, the rules (or other symbols) that were previously "
src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh (2)

32-35: Initialize rules_cc in set_up — good

Declaring rules_cc once per test via set_up is the right approach.

Given set_up handles rules_cc, consider removing redundant add_rules_cc in setup_external_cc_target to avoid double-appends to MODULE.bazel if add_rules_cc isn't idempotent.


280-284: External repo setup: add_rules_cc and loads — mostly good

  • Adding rules_cc in MODULE.bazel here is fine, but may be redundant with set_up().
  • Optional future-proofing: other_repo/BUILD relies on autoloading for cc_library/cc_test. Consider adding explicit loads there too to avoid relying on autoloads outside main in future flips.

Example change to other_repo/BUILD:

+load("@rules_cc//cc:cc_library.bzl", "cc_library")
+load("@rules_cc//cc:cc_test.bzl", "cc_test")
 
 cc_library(
   name = "a",
   ...
 )
 
 cc_test(
   name = "t",
   ...
 )
src/test/shell/bazel/bazel_java_test.sh (1)

91-91: Minor nit: unify quoting of MODULE.bazel

Some calls use add_rules_java MODULE.bazel (no quotes) while others use "MODULE.bazel". Consider standardizing for consistency.

Also applies to: 2214-2214

src/test/shell/bazel/bazel_java_test_defaults.sh (1)

58-58: Nit: unify quoting of MODULE.bazel parameter

You mix add_rules_java MODULE.bazel and add_rules_java "MODULE.bazel". Consider picking one for consistency across the file.

Also applies to: 136-136, 317-317, 343-343, 369-369, 426-426, 460-460

src/test/shell/bazel/bazel_rules_test.sh (1)

827-827: Minor path fix: chmod targets the wrong file

The chmod here points to pkg/library.sh but this section just authored other_repo/pkg/library2.sh. For clarity, chmod the file you just created.

Apply this diff:

-  chmod +x pkg/library.sh
+  chmod +x other_repo/pkg/library2.sh
src/test/py/bazel/launcher_test.py (1)

239-254: Hard-coded rule versions – consider stanza reuse

Each test amputates and rewrites a standalone MODULE.bazel, hard-coding
rules_java / shell / python versions multiple times. This inflates
CI time and diverges versions across tests. Extract a small helper that
writes the module only once per language and re-use it across test
cases.

src/test/shell/bazel/bazel_test_test.sh (1)

331-337: LOAD statements now duplicated

load("@rules_shell//shell:sh_test.bzl", "sh_test") is injected in many
BUILD snippets that are already under load() earlier in the same file,
producing duplicate symbols and a style warning. Remove the redundant
load() in templates that are appended multiple times.

src/test/py/bazel/runfiles_test.py (2)

488-488: Heads-up: rules_python dep missing for disabled wrapped py_binary

This test is disabled, but if you re-enable it, add a rules_python bazel_dep in MODULE.bazel (and keep the existing py_binary load) to avoid autoload failures.


545-554: Include wrapper executable in DefaultInfo.files

For completeness (e.g., queries on files, providers), include the symlinked executable in DefaultInfo.files, not just the wrapped target’s files.

Apply this diff within the wrapper’s DefaultInfo:

-        DefaultInfo(
-            executable = executable,
-            files = target[DefaultInfo].files,
-            data_runfiles = data_runfiles,
-            default_runfiles = default_runfiles,
-        ),
+        DefaultInfo(
+            executable = executable,
+            files = depset([executable], transitive = [target[DefaultInfo].files]),
+            data_runfiles = data_runfiles,
+            default_runfiles = default_runfiles,
+        ),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0c98a2 and bb1337a.

📒 Files selected for processing (38)
  • examples/py/BUILD (1 hunks)
  • examples/py_native/BUILD (1 hunks)
  • examples/py_native/fibonacci/BUILD (1 hunks)
  • examples/shell/BUILD (1 hunks)
  • src/BUILD (1 hunks)
  • src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java (2 hunks)
  • src/main/java/com/google/devtools/build/skyframe/BUILD (1 hunks)
  • src/main/starlark/tests/builtins_bzl/builtin_test_setup.sh (1 hunks)
  • src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test/BUILD.builtin_test (1 hunks)
  • src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test/BUILD.builtin_test (1 hunks)
  • src/test/java/com/google/devtools/build/lib/blackbox/tests/PythonBlackBoxTest.java (2 hunks)
  • src/test/py/bazel/bazel_external_repository_test.py (6 hunks)
  • src/test/py/bazel/launcher_test.py (15 hunks)
  • src/test/py/bazel/py_test.py (8 hunks)
  • src/test/py/bazel/query_test.py (1 hunks)
  • src/test/py/bazel/runfiles_test.py (7 hunks)
  • src/test/shell/bazel/BUILD (1 hunks)
  • src/test/shell/bazel/bazel_build_event_stream_test.sh (4 hunks)
  • src/test/shell/bazel/bazel_coverage_cc_test_gcc.sh (10 hunks)
  • src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh (6 hunks)
  • src/test/shell/bazel/bazel_coverage_java_test.sh (17 hunks)
  • src/test/shell/bazel/bazel_example_test.sh (1 hunks)
  • src/test/shell/bazel/bazel_hermetic_sandboxing_test.sh (2 hunks)
  • src/test/shell/bazel/bazel_java_test.sh (42 hunks)
  • src/test/shell/bazel/bazel_java_test_defaults.sh (10 hunks)
  • src/test/shell/bazel/bazel_localtest_test.sh (2 hunks)
  • src/test/shell/bazel/bazel_proto_library_test.sh (11 hunks)
  • src/test/shell/bazel/bazel_random_characters_test.sh (1 hunks)
  • src/test/shell/bazel/bazel_rules_java_override_test.sh (3 hunks)
  • src/test/shell/bazel/bazel_rules_java_test.sh (1 hunks)
  • src/test/shell/bazel/bazel_rules_test.sh (16 hunks)
  • src/test/shell/bazel/bazel_sandboxing_test.sh (5 hunks)
  • src/test/shell/bazel/bazel_symlink_test.sh (2 hunks)
  • src/test/shell/bazel/bazel_test_test.sh (42 hunks)
  • src/test/shell/bazel/remote/remote_build_event_uploader_test.sh (2 hunks)
  • src/test/shell/bazel/remote/remote_execution_http_test.sh (4 hunks)
  • src/test/shell/bazel/remote/remote_execution_test.sh (31 hunks)
  • src/test/shell/testenv.sh (1 hunks)
🔇 Additional comments (84)
src/BUILD (1)

7-7: Confirmed rules_shell declared in MODULE.bazel

Root MODULE.bazel (line 36) and src/MODULE.tools (line 44) both include

bazel_dep(name = "rules_shell", version = "0.3.0")

so the explicit

load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

is valid with autoloads disabled. No further action required.

examples/shell/BUILD (1)

1-3: Explicit shell rule loads are correct and complete.

All used rules (sh_binary, sh_library, sh_test) are now explicitly loaded; this is exactly what we need with autoloads off.

examples/py_native/fibonacci/BUILD (1)

1-1: Correct explicit load for py_library.

Matches the rule usage and the repo-wide style of rule-specific loads from rules_python.

src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test/BUILD.builtin_test (1)

2-4: No explicit cc_test load needed here
In builtins_bzl tests, both cc_test and cc_static_library are injected into the Starlark environment via the common exports (src/main/starlark/builtins_bzl/common/exports.bzl), so you don’t need to add an explicit

load("@rules_cc//cc:cc_test.bzl", "cc_test")

The current loads for cc_library, cc_import, and sh_test are sufficient.

Likely an incorrect or invalid review comment.

src/main/starlark/tests/builtins_bzl/builtin_test_setup.sh (1)

26-26: Nice—ensures @rules_shell is available in test MODULEs.

This complements the new sh_* loads in test BUILD files and avoids missing repo errors under disabled autoloads.

examples/py/BUILD (1)

1-2: Explicitly loading py rules from rules_python looks correct.

Paths and symbols match rules_python’s split .bzl files. No further changes needed.

src/test/shell/bazel/BUILD (1)

2-3: Good: sh rules are explicitly loaded from rules_shell.

This aligns with the added usages of sh_library/sh_test and the dependency on @rules_shell//shell/runfiles.

examples/py_native/BUILD (1)

1-3: Correct explicit loads for py_binary/py_library/py_test.

Matches the rules_python layout and the targets defined below.

src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test/BUILD.builtin_test (1)

18-21: Explicitly load cc_shared_library

The test at src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test/BUILD.builtin_test invokes cc_shared_library repeatedly (e.g. line 75) but only loads cc_library, cc_binary, cc_import, and sh_test. If you’ve disabled the built-in injection of cc_shared_library under your new flag, add an explicit load:

• Between the existing cc_import and sh_test loads:

 load("@rules_cc//cc:cc_import.bzl", "cc_import")
+load("@rules_cc//cc:cc_shared_library.bzl", "cc_shared_library")
 load("@rules_shell//shell:sh_test.bzl", "sh_test")

• Or consolidate via defs.bzl if preferred:

-load("@rules_cc//cc:cc_import.bzl", "cc_import")
+load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary", "cc_import", "cc_shared_library")

Please verify whether cc_shared_library is still provided by the built-in injection in your current setup, and update this load accordingly.

src/test/shell/bazel/bazel_example_test.sh (1)

58-60: Setup now declares rules_python and rules_shell in MODULE.bazel — good.

This matches later uses of Python and Shell examples/tests in this script and reduces reliance on autoloads.

src/main/java/com/google/devtools/build/skyframe/BUILD (1)

1-1: Explicitly loading java_proto_library is correct and future-proof.

This aligns with disabling autoloads and makes the dependency explicit. No issues spotted.

src/test/shell/bazel/bazel_random_characters_test.sh (1)

58-58: Ignore rules_java load path suggestion; test scripts uniformly use java_library.bzl
The shell tests in src/test/shell/bazel/ all load @rules_java//java:java_library.bzl (including the file under review at line 58), so switching this one to defs.bzl would break consistency within the test suite. Leave the existing load as-is.

Likely an incorrect or invalid review comment.

src/test/shell/bazel/remote/remote_build_event_uploader_test.sh (2)

431-431: Explicitly loading sh_test is correct.

This is necessary with autoloads disabled. Looks good.


459-459: Explicit sh_test load is correct here too.

Consistent with the previous test case. No issues.

src/test/py/bazel/query_test.py (2)

46-51: Good: declare rules_python in MODULE.bazel.

This makes the test independent of autoloads. No issues found.


55-55: Explicitly loading py_binary is appropriate.

Matches the declared rules_python dependency. LGTM.

src/test/shell/bazel/bazel_localtest_test.sh (2)

25-25: Good: initialize shell rules in MODULE.bazel.

This ensures sh_test is available when autoloads are disabled.


41-41: Correct: load sh_test from @rules_shell.

Required with autoloads disabled; looks good.

src/test/shell/testenv.sh (1)

479-480: Explicit java_import load is correct and necessary

Adding load("@rules_java//java:java_import.bzl", "java_import") ensures parsing works when autoloads are disabled. Good alignment with the PR’s objective.

src/test/shell/bazel/bazel_symlink_test.sh (2)

102-102: Explicitly loading py_binary is correct

load("@rules_python//python:py_binary.bzl", "py_binary") is required with autoloads off. Looks good.


73-73: Confirmed: rules_python present in default lock

The default lock file at src/test/tools/bzlmod/MODULE.bazel.lock includes multiple rules_python entries (lines 114–121), so version resolution will succeed. No further changes required.

src/test/shell/bazel/bazel_hermetic_sandboxing_test.sh (2)

66-66: Good: add rules_python to MODULE.bazel

Ensures Python rules are available explicitly in the hermetic sandbox tests.


99-99: Good: explicit py_test load

load("@rules_python//python:py_test.bzl", "py_test") avoids reliance on autoloads. Consistent with the PR’s goal.

src/test/shell/bazel/bazel_rules_java_test.sh (1)

71-72: Required JavaInfo load added — LGTM

This prevents an undefined symbol error at parse time and matches current rules_java layout.

src/test/java/com/google/devtools/build/lib/blackbox/tests/PythonBlackBoxTest.java (1)

56-61: Explicit py_binary load in BUILD — correct

load('@rules_python//python:py_binary.bzl', 'py_binary') is required with autoloads disabled. Good change.

src/test/shell/bazel/bazel_rules_java_override_test.sh (1)

54-55: Explicit java_library load from @rules_java looks correct

Path and symbol are correct for rules_java after autoloads are disabled in main repo.

src/test/shell/bazel/bazel_sandboxing_test.sh (3)

135-142: Enable Python rules explicitly — correct

  • add_rules_python "MODULE.bazel" precedes BUILD creation.
  • load("@rules_python//python:py_test.bzl", "py_test") matches symbol path.

184-186: Shell rules added and loaded explicitly — correct

  • add_rules_shell "MODULE.bazel" added before Starlark definitions.
  • load("@rules_shell//shell:sh_test.bzl", "sh_test") loads the right rule.

Also applies to: 223-224


716-722: Shell rules for hermetic tmp test

Explicit sh_binary load is correct and aligns with flipped autoloads.

src/test/shell/bazel/bazel_build_event_stream_test.sh (4)

188-196: sh_binary test: explicit module and load — good

  • add_rules_shell "MODULE.bazel" is added before BUILD.
  • load("@rules_shell//shell:sh_binary.bzl", "sh_binary") matches symbol path.

Also applies to: 191-196


226-234: Second sh_binary test mirrors the first — good

Same pattern; consistent and correct.

Also applies to: 229-234


268-276: sh_test test: explicit module and load — good

  • add_rules_shell "MODULE.bazel" first.
  • load("@rules_shell//shell:sh_test.bzl", "sh_test") is correct.

Also applies to: 271-276


306-314: Second sh_test case — consistent

Pattern and ordering are correct.

Also applies to: 309-314

src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java (1)

953-954: Semantics key prefix updated to match flipped default — good

Changing to "+incompatible_disable_autoloads_in_main_repo" is consistent with the new default.

Ensure any internal docs and migration notes referencing the default are updated accordingly (e.g., site/docs/skylark/backward-compatibility.md).

src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh (4)

74-77: Add explicit cc_library/cc_test loads — correct

The load paths match rules_cc’s structure. Good ordering prior to rule usage.


211-217: Java target uses explicit rules — correct

  • add_rules_java "MODULE.bazel"
  • load("@rules_java//java:java_binary.bzl", "java_binary")
  • cc loads remain explicit.

442-444: Loads for //foo/tmp BUILD — correct

Explicit rules_cc loads are present before usage.


515-517: Loads for header coverage BUILD — correct

Explicit cc_library and cc_test loads are correctly added.

src/test/shell/bazel/remote/remote_execution_http_test.sh (1)

76-76: Explicit rule deps and loads for cc and shell — LGTM

Making loads explicit and adding rules_cc/rules_shell via MODULE.bazel aligns the tests with disabled autoloads.

Also applies to: 79-79, 111-111, 114-114, 147-147, 178-178

src/test/shell/bazel/bazel_java_test.sh (1)

91-92: Broad consistency pass: explicit loads and module deps — LGTM

Across these hunks you consistently:

  • add add_rules_java/add_rules_shell/add_rules_cc to MODULE.bazel before usage, and
  • load rules from @rules_java, @rules_shell, and @rules_cc in BUILD snippets.

This is the right approach for disabling autoloads. No issues spotted.

Also applies to: 97-97, 118-118, 149-150, 388-389, 433-434, 682-684, 709-710, 825-827, 889-892, 945-947, 1599-1600, 1632-1640, 1689-1696, 1730-1731, 1794-1796, 1904-1907, 1991-1994, 2091-2092, 2127-2128, 2145-2147, 2175-2176, 2214-2214, 2237-2238, 2261-2267, 2311-2316, 2335-2336, 2352-2353, 2414-2415, 2445-2446

src/test/py/bazel/py_test.py (1)

29-33: Explicit Python rule loads + MODULE.bazel setup — LGTM

  • BUILD fragments correctly load py_binary, py_library, and py_test from @rules_python.
  • setUp adds rules_python to MODULE.bazel before use.
    No functional changes beyond rule loading. Looks good.

Also applies to: 50-54, 79-84, 87-96, 139-149, 176-181, 189-197, 211-225, 256-287, 310-312

src/test/shell/bazel/bazel_java_test_defaults.sh (1)

58-63: Java rule loads and module deps made explicit — LGTM

These hunks correctly:

  • declare rules_java/rules_cc in MODULE.bazel before usage, and
  • load java_* and cc_* rules explicitly in BUILD snippets.

Matches the goal of disabling autoloads.

Also applies to: 98-102, 135-140, 257-265, 318-321, 344-347, 370-373, 400-400, 429-430, 463-464

src/test/shell/bazel/bazel_rules_test.sh (2)

63-67: Shell/Java/C++ rule explicitness — LGTM

The tests now:

  • add rules_shell/rules_java/rules_cc to MODULE.bazel before use, and
  • load sh_*, java_*, and cc_* rules explicitly in BUILD files.

This is consistent with autoload disabling. No functional issues spotted.

Also applies to: 101-103, 150-152, 189-191, 217-220, 235-235, 241-243, 344-349, 682-685, 779-782, 1039-1044, 1089-1090, 1144-1145, 1161-1162, 1219-1220


63-64: Correct and rerun the duplicate-deps check

The previous awk pattern was malformed (unescaped parentheses), so it never matched anything. After running your bazel-rules tests locally (to regenerate MODULE.bazel), please execute:

#!/bin/bash
# After running tests, check for duplicate deps in MODULE.bazel
grep -E '^bazel_dep\(name = "rules_(shell|java|cc|python)"\)' MODULE.bazel | sort | uniq -c

If any line is reported with a count > 1, update the corresponding add_rules_* helper to guard against inserting the same rule twice.

src/test/shell/bazel/bazel_coverage_java_test.sh (18)

45-47: Good: centralized module setup for Java rules

Adding set_up() with add_rules_java ensures MODULE.bazel is prepared before BUILD generation across tests.


52-53: Explicit java_test/java_library loads

BUILD content now correctly loads rules from @rules_java before usage.


148-150: LGTM: explicit loads in combined report test

Explicitly loading java_library and java_test aligns with autoloads disabled policy.


240-243: LGTM: explicit loads for java_import scenario

java_test/java_import/java_library are loaded from @rules_java as required.


335-336: LGTM: load java_binary in producer BUILD

Ensures java_binary is available from rules_java for Cov jar generation.


359-359: LGTM: load java_test in consumer BUILD

Explicit java_test load is correct.


428-430: LGTM: explicit loads for java_binary/java_library

Runtime-deps test now correctly sources rules from @rules_java.


469-469: LGTM: explicit load for java_test

Consistent with the rest of the file.


502-502: LGTM: explicit load for java_binary

Required for deploy jar tests.


543-543: LGTM: explicit load for java_test

Matches the rules_java migration pattern.


650-652: LGTM: explicit loads for classpath-jar coverage

java_library/java_test loads from @rules_java are correct.


717-720: Verify rules_java attribute compatibility (use_launcher, deploy_manifest_lines)

This BUILD uses java_binary attributes commonly provided by native rules: deploy_manifest_lines and use_launcher. Confirm that the pinned rules_java version in add_rules_java supports these attributes with the same semantics.

If needed, run the affected test in isolation to catch attribute mismatches early.


819-821: LGTM: explicit loads in string-switch coverage test

java_test/java_library loads are correct.


914-916: LGTM: explicit loads in finally-block coverage test

Consistent with explicit-loading policy.


1122-1125: Cross-language coverage setup looks good; verify java_test's use_testrunner

  • add_rules_cc prepares MODULE.bazel; explicit java_test load added.
  • test uses java_test(use_testrunner = False). Ensure rules_java's java_test supports use_testrunner.

Consider running just this test to ensure rules_java’s java_test accepts use_testrunner and that the expected deploy/run artifacts exist.


1147-1149: LGTM: explicit loads for cc_binary/cc_library

Correctly loads from @rules_cc in the example C++ BUILD.


1274-1275: LGTM: explicit load for java_library in main repo target

Keeps main repo BUILD compatible with disabled autoloads.


1299-1301: LGTM: explicit loads in external repo BUILD

Ensures @other_repo can resolve java_library/java_test from rules_java.

src/test/py/bazel/bazel_external_repository_test.py (7)

69-77: LGTM: MODULE.bazel declares rules_python and defines http_archive repo rule

Explicit rules_python dependency and clearer use_repo_rule formatting are correct.


82-82: LGTM: explicit load of py_library

BUILD file properly loads py_library from @rules_python.


189-199: LGTM: MODULE.bazel declares rules_python and http_archive for sparse tar test

Explicit module dependency and repo rule definition look correct.


220-229: LGTM: explicit load of py_test and use of rlocationpath

  • py_test is correctly loaded from @rules_python.
  • args uses $(rlocationpath …) and data includes the referenced target.

255-260: LGTM: MODULE.bazel declares rules_python and new_local_repository use_repo_rule

Consistent with disabling autoloads; formatting is clearer and explicit.


269-277: LGTM: BUILD now loads py_binary and custom Starlark rule

Explicit loading ensures @r//:foo.bzl and rules_python are available.


294-297: LGTM: local_repository use_repo_rule formatting

Consistent and explicit definition in MODULE.bazel for my_repo setup.

src/test/py/bazel/runfiles_test.py (9)

266-274: LGTM: MODULE.bazel declares rules_python and local_repository use_repo_rule

Sets up module deps explicitly; correct ordering and syntax.


276-293: LGTM: py_binary explicitly loaded and configured

  • py_binary loaded from @rules_python.
  • deps include @bazel_tools//tools/python/runfiles to make import available.

309-311: LGTM: MODULE.bazel declares rules_shell for sh_test

Prepares the module for shell rules usage.


315-315: LGTM: explicit load of sh_test

Keeps BUILD compatible with disabled autoloads.


435-436: LGTM: MODULE.bazel declares rules_shell for no-runfiles test

Matches usage of sh_test below.


440-440: LGTM: explicit load of sh_test

Consistent with the overall change.


456-457: LGTM: MODULE.bazel declares rules_shell for wrapped sh_binary

Required for sh_binary load below.


461-461: LGTM: explicit load of sh_binary

Correct rule source for shell binaries.


509-515: LGTM: MODULE.bazel declares rules_java and BUILD loads java_binary

Explicit Java rule usage aligns with the PR objective.

src/test/shell/bazel/remote/remote_execution_test.sh (6)

310-310: Explicitly declaring rules_cc module usage looks correct.

add_rules_cc "MODULE.bazel" is consistently added before using cc_* rules. This aligns with disabling autoloads and should prevent implicit rule resolution.

Also applies to: 339-339, 363-363, 387-387, 415-415, 441-441, 631-631, 2449-2449, 2588-2588, 3072-3072, 3240-3240


313-313: rules_cc loads are correct and complete.

All BUILD fragments now explicitly load the needed Bazel rules from @rules_cc (cc_binary, cc_test, cc_library, cc_import). No missing or incorrect symbols observed.

Also applies to: 342-342, 366-366, 390-390, 418-418, 444-444, 635-635, 2454-2454, 2456-2456, 2593-2593, 2595-2595, 2596-2596, 3080-3080, 3100-3100, 3248-3248, 3250-3250, 3277-3277


688-688: Python rule wiring is sound.

add_rules_python "MODULE.bazel" precedes usage and the BUILD files load py_test from @rules_python. This should work with autoloads disabled.

Also applies to: 712-712, 752-752, 692-692, 716-716, 756-756


817-817: Shell rules are explicitly declared and loaded.

Consistent use of add_rules_shell "MODULE.bazel" and corresponding load()s for sh_test/sh_binary from @rules_shell. Covers all affected tests.

Also applies to: 821-821, 853-853, 857-857, 1251-1251, 1260-1260, 2075-2075, 2082-2082, 2728-2728, 2731-2731, 2813-2813, 2816-2816, 3336-3336, 3338-3338, 3364-3364, 3366-3366, 3619-3619, 3660-3660


2158-2158: Java rules: explicit deps and loads look correct.

add_rules_java "MODULE.bazel" added and both java_library and java_test are properly loaded from @rules_java in the BUILD file.

Also applies to: 2167-2169


3248-3250: External repo scenarios also correctly load rules_cc.

Loads for cc_binary/cc_import within other_repo ensure external BUILD files don’t rely on autoloads. Good coverage for cross-repo cases.

Also applies to: 3277-3277

Comment on lines +41 to +42
context().write(MODULE_DOT_BAZEL, "bazel_dep(name = 'rules_python', version = '0.40.0')");

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

MODULE.bazel likely needs a module() declaration

Overwriting MODULE.bazel with only a bazel_dep(...) may fail if the underlying test harness doesn’t pre-populate module(...). Safer to include it here.

Apply:

-    context().write(MODULE_DOT_BAZEL, "bazel_dep(name = 'rules_python', version = '0.40.0')");
+    context().write(
+        MODULE_DOT_BAZEL,
+        "module(name = 'test')",
+        "bazel_dep(name = 'rules_python', version = '0.40.0')"
+    );

Optionally, consider sourcing the version from a shared location to avoid drift.

🤖 Prompt for AI Agents
In
src/test/java/com/google/devtools/build/lib/blackbox/tests/PythonBlackBoxTest.java
at lines 41-42, the MODULE.bazel file is overwritten with only a bazel_dep
declaration, which may cause failures if the test harness expects a module()
declaration. Fix this by adding a module() declaration before the bazel_dep line
in the write call. Optionally, refactor the version string to be sourced from a
shared constant or configuration to prevent version drift.

Comment on lines +50 to +54
def setUp(self):
test_base.TestBase.setUp(self)
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_python", version = "0.40.0")']
)
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Ensure a single, consistent rules_python version across tests

You pin rules_python to 0.40.0 in several places. Verify the entire repo uses the same version to avoid drift.

Run this script to check for inconsistencies:

Also applies to: 79-84, 176-181, 248-253


🏁 Script executed:

#!/bin/bash
# Find all rules_python version pins.
rg -n $'bazel_dep\\(name\\s*=\\s*"rules_python",\\s*version\\s*=\\s*"[0-9][^"]*"\\)'

Length of output: 2018


Unify rules_python Version Pins Across All Tests

Several test files pin different versions of rules_python. To avoid drift, choose a single version (e.g., 0.40.0) and update all occurrences accordingly:

  • src/test/shell/bazel/python_version_test.sh:162,229 currently use 0.19.0
  • src/test/shell/bazel/bazel_coverage_hermetic_py_test.sh:27 currently uses 0.36.0
  • All other test files and MODULE.bazel (root) / src/MODULE.tools use 0.40.0

Please consolidate these to the agreed-upon version.

🤖 Prompt for AI Agents
In src/test/py/bazel/py_test.py around lines 50 to 54, the version of
rules_python is set to 0.40.0, but other test files use different versions
causing inconsistency. To fix this, ensure that all test files and related
MODULE.bazel files use the unified version 0.40.0 for rules_python by updating
any occurrences of older versions like 0.19.0 or 0.36.0 to 0.40.0.

Comment on lines +32 to +34
function set_up() {
add_rules_cc "MODULE.bazel"
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

set_up helper is never invoked

A new set_up() adds add_rules_cc, but the test runner for these
scripts only calls the global setup() (no underscore) hook. Either
rename the function to setup() or invoke set_up explicitly from the
top-level. Without this call, rules_cc will not be added and every
test depending on it will fetch from the network.

🤖 Prompt for AI Agents
In src/test/shell/bazel/bazel_coverage_cc_test_gcc.sh around lines 32 to 34, the
function set_up() is defined but never called, causing add_rules_cc not to be
executed and tests to fetch dependencies from the network. Rename the function
from set_up() to setup() so the test runner invokes it automatically, or
alternatively, explicitly call set_up() from the top-level script to ensure
add_rules_cc is added properly.

@arvi18
Copy link
Author

arvi18 commented Aug 10, 2025

/refacto-test

Copy link

refacto-test bot commented Aug 10, 2025

PR already reviewed at the latest commit: bb1337a.
Please try again with new changes.

@arvi18
Copy link
Author

arvi18 commented Aug 10, 2025

/refacto-test

Copy link

refacto-test bot commented Aug 10, 2025

Refacto is reviewing this PR. Please wait for the review comments to be posted.

Copy link

refacto-test bot commented Aug 10, 2025

Code Review: Bazel Autoloads Configuration

👍 Well Done
Comprehensive Rule Dependencies

Added explicit load statements and dependencies across test files to prepare for incompatible_disable_autoloads_in_main_repo being enabled

Consistent Implementation Pattern

Applied a systematic approach using helper functions like add_rules_java and add_rules_cc for dependency management in shell tests

📌 Files Processed
  • src/test/py/bazel/launcher_test.py
  • src/test/py/bazel/py_test.py
  • src/test/py/bazel/bazel_external_repository_test.py
  • src/test/py/bazel/runfiles_test.py
  • src/test/shell/bazel/bazel_java_test.sh
  • src/test/shell/bazel/bazel_test_test.sh
  • src/test/shell/bazel/remote/remote_execution_test.sh
  • src/test/shell/bazel/bazel_coverage_cc_test_gcc.sh
  • src/test/shell/bazel/bazel_coverage_cc_test_llvm.sh
  • src/test/shell/bazel/bazel_coverage_java_test.sh
  • src/test/shell/bazel/bazel_java_test_defaults.sh
  • src/test/shell/bazel/bazel_proto_library_test.sh
  • src/test/shell/bazel/bazel_rules_test.sh
  • src/test/py/bazel/query_test.py
  • src/test/shell/bazel/bazel_build_event_stream_test.sh
  • src/test/shell/bazel/bazel_sandboxing_test.sh
  • src/test/shell/bazel/remote/remote_execution_http_test.sh
  • src/test/java/com/google/devtools/build/lib/blackbox/tests/PythonBlackBoxTest.java
  • examples/py/BUILD
  • examples/py_native/BUILD
  • examples/shell/BUILD
  • src/BUILD
  • README.md
  • examples/py_native/fibonacci/BUILD
  • src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java
  • src/main/java/com/google/devtools/build/skyframe/BUILD
  • src/test/shell/bazel/BUILD
  • src/test/shell/bazel/bazel_example_test.sh
  • src/test/shell/bazel/bazel_hermetic_sandboxing_test.sh
  • src/test/shell/bazel/bazel_localtest_test.sh
  • src/test/shell/bazel/bazel_random_characters_test.sh
  • src/test/shell/bazel/bazel_rules_java_override_test.sh
  • src/test/shell/bazel/bazel_rules_java_test.sh
  • src/test/shell/bazel/bazel_symlink_test.sh
  • src/test/shell/testenv.sh
  • src/main/starlark/tests/builtins_bzl/builtin_test_setup.sh
  • src/test/shell/bazel/remote/remote_build_event_uploader_test.sh
  • src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test/BUILD.builtin_test
  • src/main/starlark/tests/builtins_bzl/cc/cc_static_library/test/BUILD.builtin_test

Comment on lines +33 to +35
add_rules_cc "MODULE.bazel"
}

Copy link

Choose a reason for hiding this comment

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

Unused set_up Function in Coverage Test

The set_up() function that adds rules_cc dependency is defined but never called, causing tests to fetch dependencies from the network instead of using local declarations.

Suggested change
add_rules_cc "MODULE.bazel"
}
setup() {
add_rules_cc "MODULE.bazel"
}
Standards
  • Bazel Test Framework Conventions

Comment on lines +33 to +35
add_rules_cc "MODULE.bazel"
}

Copy link

Choose a reason for hiding this comment

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

Unused set_up Function in LLVM Coverage Test

The set_up() function that adds rules_cc dependency is defined but never called, causing tests to fetch dependencies from the network instead of using local declarations.

Suggested change
add_rules_cc "MODULE.bazel"
}
setup() {
add_rules_cc "MODULE.bazel"
}
Standards
  • Bazel Test Framework Conventions

Comment on lines +46 to +48
add_rules_java "MODULE.bazel"
}

Copy link

Choose a reason for hiding this comment

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

Unused set_up Function in Java Coverage Test

The set_up() function that adds rules_java dependency is defined but never called, causing tests to fetch dependencies from the network instead of using local declarations.

Suggested change
add_rules_java "MODULE.bazel"
}
setup() {
add_rules_java "MODULE.bazel"
}
Standards
  • Bazel Test Framework Conventions

@@ -38,6 +38,8 @@ protected ImmutableList<ToolsSetup> getAdditionalTools() {

@Test
public void testCompileAndRunHelloWorldStub() throws Exception {
context().write(MODULE_DOT_BAZEL, "bazel_dep(name = 'rules_python', version = '0.40.0')");

Copy link

Choose a reason for hiding this comment

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

Missing Module Declaration in Python Test

MODULE.bazel is overwritten with only a bazel_dep declaration without a module() declaration, which will cause failures if the test harness expects a module() declaration.

Suggested change
context().write(MODULE_DOT_BAZEL, "module(name = 'test')", "bazel_dep(name = 'rules_python', version = '0.40.0')");
Standards
  • Bazel Module System Requirements

@@ -617,9 +693,15 @@ def testWindowsNativeLauncherInNonEnglishPath(self):
def testWindowsNativeLauncherInLongPath(self):
if not self.IsWindows():
return
self.ScratchFile(
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
Copy link

Choose a reason for hiding this comment

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

Missing Shell and Python Dependencies in Launcher Test

Test adds only rules_java dependency but uses shell and python rules, which will cause build failures when incompatible_disable_autoloads_in_main_repo is enabled.

Suggested change
'MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")']
self.ScratchFile('MODULE.bazel', ['bazel_dep(name = "rules_java", version = "8.11.0")',
'bazel_dep(name = "rules_shell", version = "0.3.0")',
'bazel_dep(name = "rules_python", version = "0.40.0")'])
Standards
  • Bazel Module System Requirements

Comment on lines +59 to 61
add_rules_shell "MODULE.bazel"
}

Copy link

Choose a reason for hiding this comment

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

Missing CC Rules Dependency in Example Test

Test adds Java, Python, and Shell rule dependencies but is missing CC rules dependency, which will cause build failures for C++ examples when incompatible_disable_autoloads_in_main_repo is enabled.

Suggested change
add_rules_shell "MODULE.bazel"
}
add_rules_java "MODULE.bazel"
add_rules_python "MODULE.bazel"
add_rules_shell "MODULE.bazel"
add_rules_cc "MODULE.bazel"
Standards
  • Bazel Module System Requirements

@arvi18
Copy link
Author

arvi18 commented Aug 10, 2025

/refacto-test

Copy link

refacto-test bot commented Aug 10, 2025

PR already reviewed at the latest commit: 25c484c.
Please try again with new changes.

@arvi18
Copy link
Author

arvi18 commented Aug 10, 2025

/refacto-test

Copy link

refacto-test bot commented Aug 10, 2025

PR already reviewed at the latest commit: 25c484c.
Please try again with new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants