Skip to content

Commit 327ebe8

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 f6aced9 commit 327ebe8

270 files changed

Lines changed: 252 additions & 90 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.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,14 @@ pnpm-debug.log
294294
/packages/cli/src/commands/manifest/scripts/test/gradle-compat/project/.socket.facts.json
295295
/packages/cli/src/commands/manifest/scripts/test/gradle-compat/project/.gradle/
296296
/packages/cli/src/commands/manifest/scripts/test/gradle-compat/project/build/
297-
/packages/cli/src/commands/manifest/scripts/test/gradle-compat/.gradle-home/
298297
/packages/cli/src/commands/manifest/scripts/test/gradle-compat/.populate-for.txt
298+
/packages/cli/src/commands/manifest/scripts/test/maven-compat/project/localrepo/
299299
/packages/cli/src/commands/manifest/scripts/test/maven-compat/project/records.tsv
300300
/packages/cli/src/commands/manifest/scripts/test/maven-compat/project/target/
301301
/packages/cli/src/commands/manifest/scripts/test/maven-compat/project/*/target/
302302
/packages/cli/src/commands/manifest/scripts/test/sbt-compat/project/target/
303303
/packages/cli/src/commands/manifest/scripts/test/sbt-compat/project/project/target/
304304
/packages/cli/src/commands/manifest/scripts/test/sbt-compat/project/project/build.properties
305305
/packages/cli/src/commands/manifest/scripts/test/sbt-compat/project/scala-version.sbt
306+
/packages/cli/src/commands/manifest/scripts/test/sbt-compat/project/localrepo/
306307
/packages/cli/src/commands/manifest/scripts/test/sbt-compat/project/records.tsv

packages/cli/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"

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

Whitespace-only changes.

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

Whitespace-only changes.

0 commit comments

Comments
 (0)