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
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module(
# =========================================

bazel_dep(name = "abseil-cpp", version = "20250814.1")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "blake3", version = "1.5.1.bcr.1")
bazel_dep(name = "googleapis-grpc-java", version = "1.0.0")
bazel_dep(name = "googleapis-java", version = "1.0.0")
Expand All @@ -29,7 +29,7 @@ bazel_dep(name = "rules_java", version = "8.16.1")
bazel_dep(name = "rules_jvm_external", version = "6.6")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.6.0")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_testing", version = "0.6.0")
bazel_dep(name = "stardoc", version = "0.7.2", repo_name = "io_bazel_skydoc")
Expand Down
245 changes: 241 additions & 4 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/MODULE.tools
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use_repo(buildozer_binary, "buildozer_binary")
bazel_dep(name = "protobuf", version = "33.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_java", version = "8.16.1")
bazel_dep(name = "rules_cc", version = "0.2.13")
bazel_dep(name = "rules_python", version = "1.6.0")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "apple_support", version = "1.24.2") # xcode_configure needs it
bazel_dep(name = "rules_apple", version = "4.1.0", repo_name = None) # version bump, older versions contribute lockfile entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,69 +132,6 @@ private void defineToolchains() throws Exception {
")");
}

@Test
public void runtimeObtainedFromToolchain() throws Exception {
defineToolchains();
scratch.file(
"pkg/BUILD",
getPyLoad("py_binary"),
"""
py_binary(
name = "py3_bin",
srcs = ["py3_bin.py"],
python_version = "PY3",
)
""");
useConfiguration("--extra_toolchains=//toolchains:py_toolchain");

ConfiguredTarget py3 = getConfiguredTarget("//pkg:py3_bin");

String py3Path = getInterpreterPathFromStub(py3);
assertThat(py3Path).isEqualTo("/system/python3");

String py3Shebang = getShebangFromStub(py3);
assertThat(py3Shebang).isEqualTo("#!/usr/bin/env python3");
}

@Test
public void toolchainCanOmitUnusedRuntimeVersion() throws Exception {
defineToolchains();
scratch.file(
"pkg/BUILD",
getPyLoad("py_binary"),
"""
py_binary(
name = "py3_bin",
srcs = ["py3_bin.py"],
python_version = "PY3",
)
""");
useConfiguration("--extra_toolchains=//toolchains:py_toolchain_for_py3_only");

String path = getInterpreterPathFromStub(getConfiguredTarget("//pkg:py3_bin"));
assertThat(path).isEqualTo("/system/python3");
}

@Test
public void toolchainTakesPrecedenceOverLegacyFlags() throws Exception {
defineToolchains();
scratch.file(
"pkg/BUILD",
getPyLoad("py_binary"),
"""
py_binary(
name = "py3_bin",
srcs = ["py3_bin.py"],
python_version = "PY3",
)
""");
useConfiguration(
"--extra_toolchains=//toolchains:py_toolchain", "--python_path=/better/not/be/this/one");

String path = getInterpreterPathFromStub(getConfiguredTarget("//pkg:py3_bin"));
assertThat(path).isEqualTo("/system/python3");
}

/**
* Creates a custom toolchain at //toolchains:custom that has the given lines in its rule
* implementation function.
Expand Down
16 changes: 0 additions & 16 deletions src/test/java/com/google/devtools/build/lib/buildtool/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,6 @@ java_test(
],
)

java_test(
name = "CompileOneDependencyIntegrationTest",
srcs = ["CompileOneDependencyIntegrationTest.java"],
tags = [
"no_windows",
],
deps = [
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/test/java/com/google/devtools/build/lib/buildtool/util",
"//src/test/java/com/google/devtools/build/lib/rules/python:PythonTestUtils",
"//third_party:junit4",
"//third_party:truth",
],
)

java_test(
name = "ContextProviderInitializationTest",
srcs = ["ContextProviderInitializationTest.java"],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void setup(MockToolsConfig config) throws IOException {
config.overwrite("rules_python_workspace/python/private/common/BUILD");
config.overwrite(
"rules_python_workspace/python/config_settings/BUILD.bazel",
"load('@bazel_skylib//rules:common_settings.bzl', 'string_flag')",
"load('@bazel_skylib//rules:common_settings.bzl', 'string_flag', 'bool_flag')",
"load('@rules_python//python/private:flags.bzl', rp_string_flag = 'string_flag')",
"string_flag(name = 'python_version', build_setting_default = '3.11')",
"string_flag(name = 'precompile', build_setting_default = 'auto')",
Expand All @@ -115,10 +115,24 @@ public void setup(MockToolsConfig config) throws IOException {
"rp_string_flag(name = 'bootstrap_impl', build_setting_default = 'system_python', ",
" values = ['system_python'])",
"string_flag(name = 'venvs_use_declare_symlink', build_setting_default = 'yes')",
"string_flag(name = 'precompile_add_to_runfiles', build_setting_default = 'always')");
"string_flag(name = 'precompile_add_to_runfiles', build_setting_default = 'always')",
"string_flag(name = 'exec_tools_toolchain', build_setting_default = 'yes')",
"label_flag(name = 'pip_env_marker_config', build_setting_default = ':_pip_env_marker_default_config')",
"string_flag(name = 'pip_whl', build_setting_default = 'auto')",
"string_flag(name = 'pip_whl_glibc_version', build_setting_default = '')",
"string_flag(name = 'pip_whl_muslc_version', build_setting_default = '')",
"string_flag(name = 'pip_whl_osx_arch', build_setting_default = '')",
"string_flag(name = 'pip_whl_osx_version', build_setting_default = '')",
"string_flag(name = 'py_linux_libc', build_setting_default = '')",
"string_flag(name = 'venvs_site_packages', build_setting_default = 'no')",
"bool_flag(name = 'experimental_python_import_all_repositories', build_setting_default = True)",
"bool_flag(name = 'build_python_zip', build_setting_default = False)",
"bool_flag(name = 'incompatible_default_to_explicit_init_py', build_setting_default = True)",
"string_flag(name = 'python_path', build_setting_default = 'python')");
config.overwrite("rules_python_workspace/python/private/python_bootstrap_template.txt");
config.overwrite("rules_python_workspace/tools/build_defs/python/private/BUILD");
config.overwrite("rules_python_workspace/tools/launcher/BUILD", "filegroup(name = 'launcher')");
config.overwrite("rules_python_workspace/python/bin/BUILD", "label_flag(name = 'python_src', build_setting_default = '//python:none')");

config.create(
"rules_python_internal_workspace/MODULE.bazel", "module(name = 'rules_python_internal')");
Expand All @@ -132,6 +146,9 @@ public void setup(MockToolsConfig config) throws IOException {
"load('@rules_python//tools/build_defs/python/private:py_internal_renamed.bzl',"
+ " 'py_internal_renamed')",
"py_internal_impl = py_internal_renamed");
config.create(
"rules_python_internal_workspace/extra_transition_settings.bzl",
"EXTRA_TRANSITION_SETTINGS = []");
}

@Override
Expand Down
Loading
Loading