[llvm] [bazel] Use rules_python load statements (PR #113213)
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 13:18:25 PDT 2024
https://github.com/keith created https://github.com/llvm/llvm-project/pull/113213
With bazel 8.x these are strongly encouraged, and this disambiguates
which version of these rules we get for older versions. Specifically the
native.py_test was using the wrong version of py_test.
>From 4afff1566cc8726243d3c692e44c78b73d65c41d Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Mon, 21 Oct 2024 20:14:51 +0000
Subject: [PATCH] [bazel] Use rules_python load statements
With bazel 8.x these are strongly encouraged, and this disambiguates
which version of these rules we get for older versions. Specifically the
native.py_test was using the wrong version of py_test.
---
utils/bazel/llvm-project-overlay/clang/BUILD.bazel | 1 +
utils/bazel/llvm-project-overlay/lldb/BUILD.bazel | 1 +
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 1 +
utils/bazel/llvm-project-overlay/llvm/lit_test.bzl | 4 ++--
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
index d52dd4870f16e7..1facb31bb3f4fa 100644
--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -2,6 +2,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+load("@rules_python//python:defs.bzl", "py_binary")
load(
"//:vars.bzl",
"LLVM_VERSION_MAJOR",
diff --git a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
index 3ed4f552290da4..9dba2efc34f613 100644
--- a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
@@ -6,6 +6,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@build_bazel_apple_support//rules:apple_genrule.bzl", "apple_genrule")
+load("@rules_python//python:defs.bzl", "py_binary")
load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH", "LLVM_VERSION_SUFFIX", "PACKAGE_VERSION")
load("//lldb/source/Plugins:plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index cea80ce57027df..af381ac378f83a 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4,6 +4,7 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+load("@rules_python//python:defs.bzl", "py_binary")
load("//mlir:tblgen.bzl", "td_library")
load(":binary_alias.bzl", "binary_alias")
load(":config.bzl", "llvm_config_defines")
diff --git a/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl b/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl
index af7ae560768d6f..0af12a635855df 100644
--- a/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl
@@ -4,6 +4,7 @@
"""Rules for running lit tests."""
load("@bazel_skylib//lib:paths.bzl", "paths")
+load("@rules_python//python:defs.bzl", "py_test")
def lit_test(
name,
@@ -29,8 +30,7 @@ def lit_test(
args = args or []
data = data or []
deps = deps or []
-
- native.py_test(
+ py_test(
name = name,
srcs = [Label("//llvm:lit")],
main = Label("//llvm:utils/lit/lit.py"),
More information about the llvm-commits
mailing list