Skip to content

Commit 95899e7

Browse files
committed
test(manifest): resolve the JVM compat fixtures' deps from generated stub artifacts
The maven-compat smoke fixture declared commons-io, junit and hamcrest as real artifacts from Maven Central purely to get a graph shape: an external prod dep, a test-scope dep and its transitive. No fixture code imports them, so they were never compiled against or executed - but they still aged into GHSA-78wr-2p64-hpwj, a Dependabot alert, and a version bump. gradle-compat already solved this: make-localrepo.sh generated a tiny file-based Maven repo of empty-jar stubs at test time. That generator moves up a directory to test/make-stub-repo.sh, gains the ability to give a stub its own dependency, and now serves all three fixtures. maven-compat resolves demo.ext:tool (prod), demo.ext:harness (test) and its transitive demo.ext:harness-core through a <repository> whose URL smoke-test.sh passes as -Dstub.repo.url; sbt-compat resolves demo.ext:tool and demo.ext:harness the same way. The suites also stop using the developer's home caches. compat-cache.sh resolves one cache root under the temp dir, overridable by SOCKET_COMPAT_CACHE, and each tool is pointed at it: Maven by -Dmaven.repo.local, Gradle by -g, sbt by -Dsbt.ivy.home and COURSIER_CACHE. The root is stable so each tool's own closure is downloaded once, but the stub artifacts are evicted before every run, so a run can never pass on a stale copy of the thing under test. Nothing is read from or written to ~/.m2, ~/.gradle or ~/.ivy2, and records.tsv no longer embeds a path under the developer's home. Assertions prove exactly what they proved before, still matching on groupId:artifactId with no version written in any test, and still keying on the .jar suffix rather than any path. The transitive check is now unconditional: with a stub graph it is deterministic, so its absence is a defect rather than a junit-version detail. Each build tool still fetches its own closure from Central - Maven's plugins pull commons-io themselves - so this is not a fully offline fixture. It declares no third-party dependency of its own.
1 parent 3dcaae0 commit 95899e7

272 files changed

Lines changed: 262 additions & 94 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/commands/manifest/scripts/test/README.md

Lines changed: 32 additions & 0 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
# Shared cache root for the JVM compat suites: the downloaded build-tool distributions plus each
3+
# tool's dependency cache. Keeping the caches here rather than in ~/.m2, ~/.gradle and ~/.ivy2 means
4+
# a run can't pass off a warm home cache, can't write a home path into the records it emits, and
5+
# can't leave anything behind in the developer's own caches. Point SOCKET_COMPAT_CACHE at a fresh
6+
# `mktemp -d` for a cold run.
7+
SOCKET_COMPAT_CACHE="${SOCKET_COMPAT_CACHE:-${TMPDIR:-/tmp}/socket-manifest-compat}"
8+
mkdir -p "$SOCKET_COMPAT_CACHE"

src/commands/manifest/scripts/test/gradle-compat/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ project/records.tsv
44
project/.socket.facts.json
55
project/.gradle/
66
project/build/
7-
.gradle-home/
87
.populate-for.txt

src/commands/manifest/scripts/test/gradle-compat/.gradle-home/caches/8.14/dependencies-accessors/gc.properties

Whitespace-only changes.

src/commands/manifest/scripts/test/gradle-compat/.gradle-home/caches/8.14/gc.properties

Whitespace-only changes.

0 commit comments

Comments
 (0)