From 480da243c49eddc8065ce59a33b43835f0714b72 Mon Sep 17 00:00:00 2001 From: John Cater Date: Wed, 2 Sep 2020 09:39:16 -0400 Subject: [PATCH] Update Python rules to use the toolchain transition. This is phase 2 of of the switch to toolchain transitions. See #11584 for details. --- .../build/lib/bazel/rules/python/BazelPyRuleClasses.java | 1 + .../devtools/build/lib/rules/python/PythonToolchainTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java index f91f4709f91f61..7f0e4bfafcdcd1 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java @@ -236,6 +236,7 @@ responsible for creating (possibly empty) __init__.py files and adding them to t attr("$py_toolchain_type", NODEP_LABEL) .value(env.getToolsLabel("//tools/python:toolchain_type"))) .addRequiredToolchains(env.getToolsLabel("//tools/python:toolchain_type")) + .useToolchainTransition(true) .build(); } diff --git a/src/test/java/com/google/devtools/build/lib/rules/python/PythonToolchainTest.java b/src/test/java/com/google/devtools/build/lib/rules/python/PythonToolchainTest.java index 4883a0c8825378..d499803d98dfcf 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/python/PythonToolchainTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/python/PythonToolchainTest.java @@ -73,6 +73,7 @@ public void userDefinedConsumerUsingToolchainResolution() throws Exception { "myrule = rule(", " implementation = _myrule_impl,", " toolchains = ['" + TOOLCHAIN_TYPE + "'],", + " incompatible_use_toolchain_transition = True,", ")"); // A toolchain implementation and an instance of the rule that will use it. scratch.file(