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
31 changes: 25 additions & 6 deletions .github/workflows/bazel-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Bazel patch compatibility (NuGet)
# The NuGet flows of the real-Bazel tests (`nuget::` in `e2e_bazel_build`):
# hosted mode for a package that rules_csharp's `nuget.from_lock` reads from
# `packages.lock.json` and `nuget.config`, and for a tag that names no
# `nuget_config`, on each Bazel release below.
# `nuget_config`, and vendored mode for the same package, through the block
# it keeps in `MODULE.bazel`, on each Bazel release below.
# bazel-compatibility.yml holds the legs and what every ecosystem shares;
# this file says when the NuGet legs run and on which releases.
#
Expand Down Expand Up @@ -39,9 +40,14 @@ on:
# `rollback`, and the hosted scan's check of that folder. Then what
# reads the tag in `MODULE.bazel`: the reader of the workspace files,
# which every ecosystem's flow shares (bazel/mod.rs, starlark.rs and
# workspace.rs), and what hosted mode makes of the tag (bazel/nuget.rs).
# vendor/nuget_feed.rs is the vendored backend; it is here for the
# version and folder helpers that every one of those files calls.
# workspace.rs), and what hosted and vendored mode make of the tag
# (bazel/nuget.rs). vendor/nuget_feed.rs is the vendored backend, which
# the vendored flow runs; every one of those files calls its version
# and folder helpers. The vendored flow also runs through the block of
# `MODULE.bazel` (bazel/block.rs), what bazel/maven.rs shares with it
# (the label of a `use_extension` and the release of a ruleset), what
# names the Bazel release and the rc files (bazel/rc.rs), and the
# dispatch of the refusals of vendored mode (vendor/refusals.rs).
# Nothing else that another ecosystem's flow owns is here, so any other
# change to one ecosystem starts that ecosystem's legs only.
#
Expand Down Expand Up @@ -70,8 +76,12 @@ on:
- 'crates/socket-patch-core/src/vex/discover/nuget.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/nuget.rs'
- 'crates/socket-patch-cli/src/commands/scan/hosted/nuget.rs'
- 'crates/socket-patch-core/src/vendor/refusals.rs'
- 'crates/socket-patch-core/src/bazel/block.rs'
- 'crates/socket-patch-core/src/bazel/maven.rs'
- 'crates/socket-patch-core/src/bazel/mod.rs'
- 'crates/socket-patch-core/src/bazel/nuget.rs'
- 'crates/socket-patch-core/src/bazel/rc.rs'
- 'crates/socket-patch-core/src/bazel/starlark.rs'
- 'crates/socket-patch-core/src/bazel/workspace.rs'
push:
Expand All @@ -80,8 +90,11 @@ on:
# root of the test target (it changes when an ecosystem's module is
# added; ci.yml builds the target and runs its hermetic tests on every
# pull request), the shared engine code and test helpers the flow runs
# through, `vex`, whose verdicts the flow asserts, and the toolchain
# files. A main push outside this list waits for the nightly run below.
# through, `vex`, whose verdicts the flow asserts, the ledger and the
# artifact paths of vendored mode (vendor/state.rs and vendor/path.rs,
# which every ecosystem shares: they hold the record of the block and
# the place of a hub's package), and the toolchain files. A main push
# outside this list waits for the nightly run below.
paths:
- '.github/workflows/bazel-nuget.yml'
- '.github/workflows/bazel-compatibility.yml'
Expand All @@ -97,14 +110,20 @@ on:
- 'crates/socket-patch-core/src/vex/discover/nuget.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/nuget.rs'
- 'crates/socket-patch-cli/src/commands/scan/hosted/nuget.rs'
- 'crates/socket-patch-core/src/vendor/refusals.rs'
- 'crates/socket-patch-core/src/bazel/block.rs'
- 'crates/socket-patch-core/src/bazel/maven.rs'
- 'crates/socket-patch-core/src/bazel/mod.rs'
- 'crates/socket-patch-core/src/bazel/nuget.rs'
- 'crates/socket-patch-core/src/bazel/rc.rs'
- 'crates/socket-patch-core/src/bazel/starlark.rs'
- 'crates/socket-patch-core/src/bazel/workspace.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/main.rs'
- 'crates/socket-patch-core/src/patch/redirect/**'
- 'crates/socket-patch-core/src/hosted/**'
- 'crates/socket-patch-core/src/vex/**'
- 'crates/socket-patch-core/src/vendor/path.rs'
- 'crates/socket-patch-core/src/vendor/state.rs'
- 'crates/socket-patch-cli/src/commands/**'
- 'crates/socket-patch-cli/tests/common/**'
- 'crates/socket-patch-cli/tests/hosted_memory_common/**'
Expand Down
7 changes: 4 additions & 3 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions crates/socket-patch-cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,14 @@ pub struct GlobalArgs {
/// Vendored mode (`vendor`, `scan`/`get --mode vendored`): write for a
/// package although the project is in a Bazel workspace, where the
/// build may not find the vendored copy. Vendored mode declines such
/// a package by default; today that is a Composer package
/// a package by default: a Composer package
/// (`vendor_composer_bazel_workspace`), whose lock names the copy by a
/// path that a Bazel rule running `composer install` in another
/// directory does not find. Pass it when the build does find the
/// copy. Other subcommands accept it silently.
/// directory does not find, and a NuGet package of a rules_csharp hub
/// where the `MODULE.bazel` block that makes the hub take the copy
/// cannot be shown to work (`vendor_nuget_bazel_workspace`). Pass it
/// when the build does find the copy, or does not build the project.
/// Other subcommands accept it silently.
#[arg(
help_heading = GLOBAL_OPTIONS,
long = "allow-vendored-in-bazel",
Expand Down
15 changes: 15 additions & 0 deletions crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,21 @@ impl Cell {
self.downloads = Some(rules.to_vec());
}

/// Take the file whose sha256 is `sha256` out of the repository cache,
/// which the tests of a leg and every twin share: whether it was
/// there. Bazel then has to fetch that file again from where its URLs
/// lead, as on a machine that never had it.
pub fn uncache(&self, sha256: &str) -> bool {
let cache = &self.scratch.repository_cache;
let entry = cache.join("content_addressable/sha256").join(sha256);
let held = entry.join("file").is_file();
if held {
std::fs::remove_dir_all(&entry)
.unwrap_or_else(|e| panic!("remove {}: {e}", entry.display()));
}
held
}

/// Whether the repository cache of this cell, which its twins share,
/// holds a download with the sha256 `sha256`: what Bazel's downloader
/// keeps of a file it fetched under a checksum.
Expand Down
Loading
Loading