From 5ab007ad0cd423b8bd138b51b53ae6f067376dca Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Thu, 12 Dec 2024 17:31:31 +0100 Subject: [PATCH] refactor: Load rules_python content from proper locations Loading all public symbols from `/defs.bzl` is a deprecated approach for language rules. More fine grained loading prevents Bazel analyzing things unrelated to what one actually is interested in. We do this now to be consistent to how we use `rules_cc`. --- scripts/BUILD | 2 +- scripts/test/BUILD | 2 +- src/analyze_includes/BUILD | 3 ++- src/analyze_includes/test/BUILD | 2 +- src/apply_fixes/BUILD | 3 ++- src/apply_fixes/test/BUILD | 2 +- src/aspect/BUILD | 2 +- test/aspect/tree_artifact/BUILD | 2 +- third_party/pcpp/pcpp.BUILD | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/BUILD b/scripts/BUILD index 1ced800b..e85f5dcd 100644 --- a/scripts/BUILD +++ b/scripts/BUILD @@ -1,4 +1,4 @@ -load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_python//python:py_binary.bzl", "py_binary") py_binary( name = "extract_std_headers", diff --git a/scripts/test/BUILD b/scripts/test/BUILD index 8ce0da9e..4d1c1801 100644 --- a/scripts/test/BUILD +++ b/scripts/test/BUILD @@ -1,4 +1,4 @@ -load("@rules_python//python:defs.bzl", "py_test") +load("@rules_python//python:py_test.bzl", "py_test") py_test( name = "extract_std_headers_test", diff --git a/src/analyze_includes/BUILD b/src/analyze_includes/BUILD index 112a29ab..d20f0a3a 100644 --- a/src/analyze_includes/BUILD +++ b/src/analyze_includes/BUILD @@ -1,4 +1,5 @@ -load("@rules_python//python:defs.bzl", "py_binary", "py_library") +load("@rules_python//python:py_binary.bzl", "py_binary") +load("@rules_python//python:py_library.bzl", "py_library") py_library( name = "lib", diff --git a/src/analyze_includes/test/BUILD b/src/analyze_includes/test/BUILD index 18a7fb81..1a9ec3cd 100644 --- a/src/analyze_includes/test/BUILD +++ b/src/analyze_includes/test/BUILD @@ -1,4 +1,4 @@ -load("@rules_python//python:defs.bzl", "py_test") +load("@rules_python//python:py_test.bzl", "py_test") py_test( name = "evaluate_includes_test", diff --git a/src/apply_fixes/BUILD b/src/apply_fixes/BUILD index 3f233803..e88a7457 100644 --- a/src/apply_fixes/BUILD +++ b/src/apply_fixes/BUILD @@ -1,4 +1,5 @@ -load("@rules_python//python:defs.bzl", "py_binary", "py_library") +load("@rules_python//python:py_binary.bzl", "py_binary") +load("@rules_python//python:py_library.bzl", "py_library") py_library( name = "lib", diff --git a/src/apply_fixes/test/BUILD b/src/apply_fixes/test/BUILD index 4b2beb1e..74b8b4b7 100644 --- a/src/apply_fixes/test/BUILD +++ b/src/apply_fixes/test/BUILD @@ -1,4 +1,4 @@ -load("@rules_python//python:defs.bzl", "py_test") +load("@rules_python//python:py_test.bzl", "py_test") py_test( name = "bazel_query_test", diff --git a/src/aspect/BUILD b/src/aspect/BUILD index 8eb89cfd..86e04605 100644 --- a/src/aspect/BUILD +++ b/src/aspect/BUILD @@ -1,5 +1,5 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_python//python:py_binary.bzl", "py_binary") py_binary( name = "process_target", diff --git a/test/aspect/tree_artifact/BUILD b/test/aspect/tree_artifact/BUILD index 690b03d0..07675325 100644 --- a/test/aspect/tree_artifact/BUILD +++ b/test/aspect/tree_artifact/BUILD @@ -1,4 +1,4 @@ -load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_python//python:py_binary.bzl", "py_binary") load(":create_tree_artifact.bzl", "create_tree_artifacts") py_binary( diff --git a/third_party/pcpp/pcpp.BUILD b/third_party/pcpp/pcpp.BUILD index c0491c58..5ff1d41a 100644 --- a/third_party/pcpp/pcpp.BUILD +++ b/third_party/pcpp/pcpp.BUILD @@ -1,4 +1,4 @@ -load("@rules_python//python:defs.bzl", "py_library") +load("@rules_python//python:py_library.bzl", "py_library") py_library( name = "pcpp",