Skip to content
Closed
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
160 changes: 154 additions & 6 deletions Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "c6702817f7343cbaf7065db00a7e1f82a0887efa615b84fc3cc5cf60af1d649b",
"checksum": "9b94dcc361d52365bb16da08360f0b244992e84035534bfad3f1a7e545b064ba",
"crates": {
"addr2line 0.24.2": {
"name": "addr2line",
Expand Down Expand Up @@ -2427,16 +2427,79 @@
"id": "jobserver 0.1.32",
"target": "jobserver"
},
{
"id": "libc 0.2.176",
"target": "libc"
},
{
"id": "shlex 1.3.0",
"target": "shlex"
}
],
"selects": {}
"selects": {
"aarch64-apple-darwin": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"aarch64-unknown-linux-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"aarch64-unknown-nixos-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"arm-unknown-linux-gnueabi": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"i686-unknown-linux-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"powerpc-unknown-linux-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"s390x-unknown-linux-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"x86_64-apple-darwin": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"x86_64-unknown-freebsd": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"x86_64-unknown-linux-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"x86_64-unknown-nixos-gnu": [
{
"id": "libc 0.2.176",
"target": "libc"
}
]
}
},
"edition": "2018",
"version": "1.1.31"
Expand Down Expand Up @@ -4289,6 +4352,86 @@
],
"license_file": "LICENSE-APACHE"
},
"file-lock 2.1.11": {
"name": "file-lock",
"version": "2.1.11",
"package_url": "https://github.com/alfiedotwtf/file-lock",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/file-lock/2.1.11/download",
"sha256": "040b48f80a749da50292d0f47a1e2d5bf1d772f52836c07f64bfccc62ba6e664"
}
},
"targets": [
{
"Library": {
"crate_name": "file_lock",
"crate_root": "src/lib.rs",
"srcs": {
"allow_empty": true,
"include": [
"**/*.rs"
]
}
}
},
{
"BuildScript": {
"crate_name": "build_script_build",
"crate_root": "build.rs",
"srcs": {
"allow_empty": true,
"include": [
"**/*.rs"
]
}
}
}
],
"library_target_name": "file_lock",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "file-lock 2.1.11",
"target": "build_script_build"
},
{
"id": "libc 0.2.176",
"target": "libc"
}
],
"selects": {}
},
"edition": "2021",
"version": "2.1.11"
},
"build_script_attrs": {
"compile_data_glob": [
"**"
],
"data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "cc 1.1.31",
"target": "cc"
}
],
"selects": {}
}
},
"license": "MIT",
"license_ids": [
"MIT"
],
"license_file": null
},
"filetime 0.2.25": {
"name": "filetime",
"version": "0.2.25",
Expand Down Expand Up @@ -10970,6 +11113,10 @@
],
"deps": {
"common": [
{
"id": "file-lock 2.1.11",
"target": "file_lock"
},
{
"id": "itertools 0.13.0",
"target": "itertools"
Expand Down Expand Up @@ -28540,6 +28687,7 @@
},
"direct_deps": [
"clap 4.5.20",
"file-lock 2.1.11",
"itertools 0.13.0",
"miette 7.2.0",
"pathdiff 0.2.3",
Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions e2e/concurrent_venv/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Under Bazel 7 or later, this flag is ignored as the PyRuntimeInfo gives this information.
common --@aspect_rules_py//py:interpreter_version=3.9.18
7 changes: 7 additions & 0 deletions e2e/concurrent_venv/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
7.4.0
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
#
# Note that you should also run integration_tests against other Bazel
# versions you support.
22 changes: 22 additions & 0 deletions e2e/concurrent_venv/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""E2E test for concurrent venv creation race condition fix.

This test verifies that multiple processes can safely use the same py_binary
target simultaneously without encountering race conditions during venv creation.
"""

load("@aspect_rules_py//py:defs.bzl", "py_binary", "py_test")

py_binary(
name = "hello",
srcs = ["hello.py"],
)

py_test(
name = "test",
srcs = ["test_concurrent.py"],
data = [":hello"],
tags = [
"e2e",
"requires-network", # May need to download packages during venv creation
],
)
30 changes: 30 additions & 0 deletions e2e/concurrent_venv/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_py", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_py",
path = "../..",
)

# Because we use a prerelease of rules_py, we must compile the rust tools from source.
bazel_dep(name = "rules_rust", version = "0.53.0")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
versions = ["1.81.0"],
)
use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")

#---SNIP--- Below here is re-used in the snippet published on releases
# Minimum version needs:
# feat: add interpreter_version_info to py_runtime by @mattem in #1671
bazel_dep(name = "rules_python", version = "0.29.0", dev_dependency = True)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.11",
)
72 changes: 72 additions & 0 deletions e2e/concurrent_venv/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Override http_archive for local testing
local_repository(
name = "aspect_rules_py",
path = "../..",
)

# We test a prerelease of rules_py, so we must setup rules_rust.
# Sadly there are too many separate load/init steps here for rules_py to expose a repository macro
# that could make this look like one line - but we expect few WORKSPACE users as bzlmod is GA now.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_rust",
integrity = "sha256-heIBNyerJvsiq9/+SyrAwnotW2KWFnumPY9uExQPUfk=",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.53.0/rules_rust-v0.53.0.tar.gz"],
)

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()

rust_register_toolchains(
edition = "2021",
versions = ["1.81.0"],
)

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

crate_universe_dependencies()

load("@rules_rust//crate_universe:defs.bzl", "crates_repository")

crates_repository(
name = "crate_index",
cargo_lockfile = "@aspect_rules_py//:Cargo.lock",
manifests = [
"@aspect_rules_py//:Cargo.toml",
"@aspect_rules_py//py/tools/py:Cargo.toml",
"@aspect_rules_py//py/tools/runfiles:Cargo.toml",
"@aspect_rules_py//py/tools/unpack_bin:Cargo.toml",
"@aspect_rules_py//py/tools/venv_bin:Cargo.toml",
"@aspect_rules_py//py/tools/venv_shim:Cargo.toml",
],
)

load("@crate_index//:defs.bzl", "crate_repositories")

crate_repositories()

#---SNIP--- Below here is re-used in the snippet published on releases
# Fetches the rules_py dependencies.
# If you want to have a different version of some dependency,
# you should fetch it *before* calling this.
# Alternatively, you can skip calling this function, so long as you've
# already fetched all the dependencies.
load("@aspect_rules_py//py:repositories.bzl", "rules_py_dependencies")

rules_py_dependencies()

load("@aspect_rules_py//py:toolchains.bzl", "rules_py_toolchains")

rules_py_toolchains()

# "Installation" for rules_python
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")

python_register_toolchains(
name = "python_toolchain",
python_version = "3.9",
)

py_repositories()
2 changes: 2 additions & 0 deletions e2e/concurrent_venv/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Simple script for concurrent venv testing."""
print("hello")
Loading