-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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"]) + [ | ||||||||||||||||||
Comment on lines
+1
to
5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused Rule Import in Python ExampleThe 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
Standards
|
||||||||||||||||||
|
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") | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
sh_binary( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
Comment on lines
+18
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
load("@rules_shell//shell:sh_test.bzl", "sh_test") | ||
|
||
LINKABLE_MORE_THAN_ONCE = "LINKABLE_MORE_THAN_ONCE" | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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')"); | ||||||
|
||||||
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion MODULE.bazel likely needs a module() declaration Overwriting MODULE.bazel with only a 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Module Declaration in Python TestMODULE.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
Standards
|
||||||
writeHelloWorldFiles(); | ||||||
|
||||||
BuilderRunner bazel = context().bazel(); | ||||||
|
@@ -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)); | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency and to reduce boilerplate, you can combine these two
load
statements into a single one from@rules_python//python:defs.bzl
.