Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ disclosure timeline.
See [CONTRIBUTING.md](CONTRIBUTING.md)

[![Build status](https://badge.buildkite.com/1fd282f8ad98c3fb10758a821e5313576356709dd7d11e9618.svg?status=master)](https://buildkite.com/bazel/bazel-bazel)

Binary file added chair.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/py/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
load("@rules_python//python:py_binary.bzl", "py_binary")
load("@rules_python//python:py_library.bzl", "py_library")

py_library(
name = "lib",
srcs = ["lib.py"],
Expand Down
4 changes: 4 additions & 0 deletions examples/py_native/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
load("@rules_python//python:py_binary.bzl", "py_binary")
load("@rules_python//python:py_library.bzl", "py_library")
load("@rules_python//python:py_test.bzl", "py_test")

filegroup(
name = "srcs",
srcs = glob(["*.py"]) + [
Expand Down
2 changes: 2 additions & 0 deletions examples/py_native/fibonacci/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_python//python:py_library.bzl", "py_library")

filegroup(
name = "srcs",
srcs = glob(["*.py"]) + [
Expand Down
4 changes: 4 additions & 0 deletions examples/shell/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
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")

package(default_visibility = ["//visibility:public"])

sh_binary(
Expand Down
1 change: 1 addition & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load("@bazel_pip_dev_deps//:requirements.bzl", "requirement")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_java//java:java_binary.bzl", "java_binary")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//src:build_defs.bzl", "transition_java_language_8_archive")
load("//src:release_archive.bzl", "release_archive")
load(":embedded_tools.bzl", "srcsfile")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public final class BuildLanguageOptions extends OptionsBase {

@Option(
name = "incompatible_disable_autoloads_in_main_repo",
defaultValue = "false",
defaultValue = "true",
Copy link

@refacto-test refacto-test bot Sep 18, 2025

Choose a reason for hiding this comment

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

Default Flag Mismatch

The incompatible_disable_autoloads_in_main_repo flag's default value is changed from false to true, but the flag name still has the 'incompatible_' prefix. This creates inconsistent behavior as incompatible flags are typically temporary and meant to be removed after migration.

    @Option(
        name = "disable_autoloads_in_main_repo",
        defaultValue = "true",
Commitable Suggestion
Suggested change
defaultValue = "true",
@Option(
name = "disable_autoloads_in_main_repo",
defaultValue = "true",
Standards
  • ISO-IEC-25010-Reliability-Maturity
  • ISO-IEC-25010-Functional-Correctness-Appropriateness

documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
Expand Down Expand Up @@ -950,7 +950,7 @@ public StarlarkSemantics toStarlarkSemantics() {
public static final String INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES =
"-incompatible_stop_exporting_language_modules";
public static final String INCOMPATIBLE_DISABLE_AUTOLOADS_IN_MAIN_REPO =
"-incompatible_disable_autoloads_in_main_repo";
"+incompatible_disable_autoloads_in_main_repo";
Copy link

Choose a reason for hiding this comment

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

Flag Reference Inconsistency

The flag reference is changed from negative to positive prefix, but the flag name itself still contains 'incompatible_'. This creates inconsistent behavior between the flag's default value and its reference pattern, potentially causing configuration errors.

Commitable Suggestion
Suggested change
"+incompatible_disable_autoloads_in_main_repo";
public static final String DISABLE_AUTOLOADS_IN_MAIN_REPO =
"-disable_autoloads_in_main_repo";
Standards
  • ISO-IEC-25010-Reliability-Maturity
  • ISO-IEC-25010-Functional-Correctness-Appropriateness

Copy link

Choose a reason for hiding this comment

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

Flag Name Inconsistency

The flag name prefix is changed from minus to plus, indicating a change in the default behavior. This should be documented with a comment explaining the semantic change and its impact on build configurations.

Standards
  • Clean-Code-Comments
  • Maintainability-Quality-Documentation

public static final String INCOMPATIBLE_ALLOW_TAGS_PROPAGATION =
"+incompatible_allow_tags_propagation";
public static final String EXPERIMENTAL_BUILTINS_DUMMY = "-experimental_builtins_dummy";
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/skyframe/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_library")
load("//tools/build_rules:utilities.bzl", "java_library_srcs")
Expand Down
1 change: 1 addition & 0 deletions src/main/starlark/tests/builtins_bzl/builtin_test_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function setup_tests() {
add_bazel_skylib "MODULE.bazel"
add_rules_python "MODULE.bazel"
add_platforms "MODULE.bazel"
add_rules_shell "MODULE.bazel"
src=$(get_runfiles_dir $1)
dest="${2:-$1}"
if [ ! -e "$src" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ load(
"runfiles_test",
"wrapped_cc_lib",
)
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")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

LINKABLE_MORE_THAN_ONCE = "LINKABLE_MORE_THAN_ONCE"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load(":starlark_tests.bzl", "analysis_test_suite")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_import.bzl", "cc_import")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

cc_static_library(
name = "static",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')");

writeHelloWorldFiles();

BuilderRunner bazel = context().bazel();
Expand All @@ -51,7 +53,11 @@ public void testCompileAndRunHelloWorldStub() throws Exception {
}

private void writeHelloWorldFiles() throws IOException {
context().write("python/hello/BUILD", "py_binary(name = 'hello', srcs = ['hello.py'])");
context()
.write(
"python/hello/BUILD",
"load('@rules_python//python:py_binary.bzl', 'py_binary')",
"py_binary(name = 'hello', srcs = ['hello.py'])");
context().write("python/hello/hello.py", String.format("print ('%s')", HELLO));
}
}
65 changes: 30 additions & 35 deletions src/test/py/bazel/bazel_external_repository_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,20 @@ def tearDown(self):
def testNewHttpArchive(self):
ip, port = self._http_server.server_address
rule_definition = [
(
'http_archive ='
' use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl",'
' "http_archive")'
),
'bazel_dep(name = "rules_python", version = "0.40.0")',
'http_archive = use_repo_rule(',
' "@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")',
'http_archive(',
' name = "hello_archive",',
' urls = ["http://%s:%s/hello-1.0.0.tar.gz"],' % (ip, port),
(
' sha256 = '
'"154740b327bcfee5669ef2ce0a04bf0904227a3bfe0fee08a5aaca96ea5a601a",'
),
' sha256 = ',
' "154740b327bcfee5669ef2ce0a04bf0904227a3bfe0fee08a5aaca96ea5a601a",',
' strip_prefix = "hello-1.0.0",',
' build_file = "@//third_party:hello.BUILD",',
')',
]
build_file = [
'load("@rules_python//python:py_library.bzl", "py_library")',
'py_library(',
' name = "hello",',
' srcs = ["hello.py"],',
Expand Down Expand Up @@ -189,20 +186,16 @@ def testNewHttpTarWithSparseFile(self):

ip, port = self._http_server.server_address
rule_definition = [
(
'http_archive ='
' use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl",'
' "http_archive")'
),
'bazel_dep(name = "rules_python", version = "0.40.0")',
'http_archive = use_repo_rule(',
' "@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")',
'http_archive(',
' name = "sparse_archive",',
' urls = ["http://%s:%s/sparse_archive.tar"],' % (ip, port),
' build_file = "@//:sparse_archive.BUILD",',
' sha256 = ',
(
' "a1a2b2ce4acd51a8cc1ab80adce6f134ac73e885219911a960a42000e312bb65",'
')'
),
' "a1a2b2ce4acd51a8cc1ab80adce6f134ac73e885219911a960a42000e312bb65",',
')',
]
self.ScratchFile('MODULE.bazel', rule_definition)
self.ScratchFile(
Expand All @@ -224,13 +217,12 @@ def testNewHttpTarWithSparseFile(self):
self.ScratchFile(
'BUILD',
[
'load("@rules_python//python:py_test.bzl", "py_test")',
'py_test(',
' name = "test",',
' srcs = ["test.py"],',
(
' args = ["$(rlocationpath @sparse_archive//:sparse_file)"],'
' data = ['
),
' args = ["$(rlocationpath @sparse_archive//:sparse_file)"],',
' data = [',
' "@sparse_archive//:sparse_file",',
' "@bazel_tools//tools/python/runfiles",',
' ],)',
Expand Down Expand Up @@ -260,10 +252,11 @@ def _CreatePyWritingStarlarkRule(self, print_string):
def testNewLocalRepositoryNoticesFileChangeInRepoRoot(self):
"""Regression test for https://github.com/bazelbuild/bazel/issues/7063."""
rule_definition = [
'bazel_dep(name = "rules_python", version = "0.40.0")',
'new_local_repository = use_repo_rule(',
(
'new_local_repository ='
' use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl",'
' "new_local_repository")'
' "@bazel_tools//tools/build_defs/repo:local.bzl",'
' "new_local_repository")'
),
'new_local_repository(',
' name = "r",',
Expand All @@ -273,11 +266,15 @@ def testNewLocalRepositoryNoticesFileChangeInRepoRoot(self):
]
self.ScratchFile('MODULE.bazel', rule_definition)
self._CreatePyWritingStarlarkRule('hello!')
self.ScratchFile('BUILD', [
'load("@r//:foo.bzl", "gen_py")',
'gen_py(name = "gen")',
'py_binary(name = "bin", srcs = [":gen"], main = "gen.py")',
])
self.ScratchFile(
'BUILD',
[
'load("@r//:foo.bzl", "gen_py")',
'load("@rules_python//python:py_binary.bzl", "py_binary")',
'gen_py(name = "gen")',
'py_binary(name = "bin", srcs = [":gen"], main = "gen.py")',
],
)

_, stdout, _ = self.RunBazel(['run', '//:bin'])
self.assertIn('hello!', os.linesep.join(stdout))
Expand All @@ -294,11 +291,9 @@ def setUpOtherRepoMyRepo(self):
self.ScratchFile(
'my_repo/MODULE.bazel',
[
(
'local_repository ='
' use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl",'
' "local_repository")'
),
'local_repository = use_repo_rule(',
' "@bazel_tools//tools/build_defs/repo:local.bzl",',
' "local_repository")',
'local_repository(name = "other_repo", path="../other_repo")',
],
)
Expand Down
Loading