Skip to content
Merged
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
7 changes: 5 additions & 2 deletions crates/socket-patch-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ layout: `npm`, `pnpm` (isolated `.pnpm` store with symlinks), `yarn-classic`,
`vlt` (`.vlt` store), `pip` (hash-pinned `requirements.txt`), `uv`, `pylock`
(PEP 751), `poetry`, `pipenv`, `pdm`, `hatch` (lockless: `hatch.toml`
environment pins, rewritten in place), `bundler`, `composer`, `cargo`,
`golang`, `nuget`, `maven` and `gradle` (`gradle.lockfile`, Gradle's
`modules-2/files-2.1` cache; hosted mode wires the build through
`golang`, `nuget` (a restored project: `packages.lock.json` plus
`obj/project.assets.json`, so the crawl looks the restore's packages up
in `~/.nuget/packages` instead of walking it), `maven` and `gradle`
(`gradle.lockfile`, Gradle's `modules-2/files-2.1` cache; hosted mode
wires the build through
`.socket/gradle/`). Deno has no hosted rewrite and is not benchmarked
separately.

Expand Down
31 changes: 31 additions & 0 deletions crates/socket-patch-bench/src/fixtures/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,37 @@ pub fn build_nuget(t: &mut Tree, size: Size) -> std::io::Result<Fixture> {
"project/Program.cs",
"System.Console.WriteLine(\"bench\");\n",
)?;
// A restored project has `obj/project.assets.json`; with it the crawl
// looks the restore's libraries up in the global folder instead of
// walking it. `packageFolders` is left out: the fixture's absolute
// path is not known here, and the crawl already reads `~/.nuget`.
let libraries: serde_json::Map<_, _> = pkgs
.iter()
.map(|p| {
(
format!("{}/{}", p.name, p.version),
json!({
"sha512": gen::sri_sha512(&format!("nupkg:{}", p.name))[7..],
"type": "package",
"path": format!("{}/{}", p.name.to_ascii_lowercase(), p.version),
"files": [format!("lib/net8.0/{}.dll", p.name)],
}),
)
})
.collect();
let assets = json!({
"version": 3,
"targets": { "net8.0": {} },
"libraries": libraries,
"project": {
"version": "1.0.0",
"restore": { "projectName": "Bench.App", "projectStyle": "PackageReference" },
},
});
t.write(
"project/obj/project.assets.json",
serde_json::to_string_pretty(&assets).unwrap(),
)?;
for p in &pkgs {
let id = p.name.to_ascii_lowercase();
let dir = format!("home/.nuget/packages/{id}/{}", p.version);
Expand Down
Loading