You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(manifest): gradle --facts works with configuration cache + adds --configs/--ignore-unresolved (REA-484) (#1338)
* fix(manifest): gradle --facts works with configuration cache + adds --configs/--ignore-unresolved (REA-484)
The init script reached into `Task.project` from a `doLast` action, which
Gradle 7+ forbids when the configuration cache is on. Disable the cache for
the facts run via `-Dorg.gradle.configuration-cache=false` (silently ignored
on pre-6.6 Gradle, so we stay compatible with old versions) and hoist
`findProperty`/`projectDir` reads to configuration time as defensive cleanup.
Also bring `socket manifest gradle --facts` (and its `kotlin` alias) up to
sbt-parity on resolution knobs: `--configs=<comma-separated suffixes>` for
case-insensitive configuration-name filtering, and `--ignore-unresolved` to
opt out of the new default of failing the run when a dep can't resolve.
Both options also honored from `socket.json` and via the auto-manifest path.
Verified end-to-end on OpenTelemetry's Java SDK (CC + parallel CC, Gradle
9.5.1): default emits 419 components, `--configs=compileClasspath,
runtimeClasspath` drops to 335 with 0 tooling-tagged. Unresolved-dep fixture
fails with exit 1 by default; `--ignore-unresolved` flips to exit 0 with
the unresolvable surfaced as a `direct` entry.
* refactor(manifest): gradle --facts --configs uses glob patterns instead of suffix match
Suffix matching was arbitrary — `--configs=compileClasspath` silently
matched every variant (testCompileClasspath, jvmMainCompileClasspath, ...).
Switch to explicit glob patterns (`*` and `?` wildcards), case-insensitive.
The old suffix behavior is now expressed as `*CompileClasspath`; bare names
match exactly.
Verified on OpenTelemetry's Java SDK: `*CompileClasspath,*RuntimeClasspath`
preserves the 335-component / 0-tooling outcome; bare `runtimeClasspath`
narrows to 215 (the standalone configs only); `*test*` matches every
test-related config (345 components, all dev-tagged).
* refactor(manifest): gradle --configs glob matching is case-sensitive
When a user types a glob, they almost always mean what they typed. Silent
lower-casing makes `*compileclasspath` and `*CompileClasspath` behave the
same — convenient until it isn't, and surprising when matching a custom
config whose canonical name has unusual casing. Drop the case-insensitive
flag.
* refactor(manifest): sbt --configs accepts glob patterns too
Mirror the gradle command's `--configs` semantics so a user who learned
one wildcard syntax gets the same behavior on the other. The sbt plugin
replaces its prior set-membership check with a glob matcher (`*` and `?`,
case-sensitive); bare names — the existing comma-separated-names form —
keep working unchanged because no wildcards = literal-name match.
Verified end-to-end on a fresh sbt 1.10 fixture: default emits 20
components (5-name DefaultConfs unchanged), `*test*` matches `test`
giving the same 20, capitalized `*Test*` matches nothing (skips with
"no resolvable dependencies") confirming case-sensitivity, and bare
`compile` resolves only the compile-scope deps (2 components).
* docs(manifest): clarify --ignore-unresolved description (PR review)
The flag was described as "skip dependencies that fail to resolve", but
in gradle/kotlin the implementation still emits unresolved deps as
`direct` entries with their declared coordinates — the flag only controls
whether the build aborts. Reword to match what actually happens, on
mtorp's PR feedback.
The sbt variant is reworded too (its `isEmittable` filter does drop
unresolved deps from the output, so the wording there reflects that).
* fix(manifest): gradle --facts no longer emits unresolved deps as nodes
The gradle init script was upserting unresolved deps into the components
output with their selector-only coordinates (no classifier, no ext,
possibly empty version), so a `.socket.facts.json` from `--ignore-
unresolved` carried half-formed entries that downstream tools (coana's
`mvn dependency:get`) would attempt to resolve against Maven Central
and 404 on. The sbt plugin's `isEmittable` filter already drops these
the same way — this aligns gradle to match.
`--ignore-unresolved` now means the same thing on both commands:
unresolved deps drive the abort-vs-warn decision but never reach the
emitted facts file. Flag descriptions and help text reworded to match.
Per mtorp's PR feedback.
-**`socket manifest gradle --facts [beta]`** (and its `kotlin` alias) gained `--configs` and `--ignore-unresolved`, matching `socket manifest scala --facts`. `--configs` takes comma-separated glob patterns (e.g. `*CompileClasspath,*RuntimeClasspath`) to restrict resolution to matching Gradle configurations; unresolved dependencies are now a fatal error by default — pass `--ignore-unresolved` for the previous lenient behavior.
19
+
-**`socket manifest scala --facts --configs`** now accepts glob patterns too (e.g. `*Test*`) for consistency with the gradle command. Bare names (no `*`/`?`) keep working as exact-name filters, so existing usages are unchanged.
20
+
21
+
### Fixed
22
+
-**`socket manifest gradle --facts`** now works on Gradle builds with the configuration cache enabled (default on Gradle 9), which previously failed with `Task.project at execution time` errors.
--bin Location of gradlew binary to use, default: CWD/gradlew
27
+
--configs With --facts: comma-separated glob patterns matched against Gradle configuration names (case-sensitive, \`*\` and \`?\` wildcards). e.g. \`*CompileClasspath,*RuntimeClasspath\` to skip tooling configs. Default: every resolvable configuration except AGP instrumented-test classpaths
27
28
--facts Emit a Socket facts JSON file (\`.socket.facts.json\`) describing the resolved dependency graph instead of generating \`pom.xml\` files
28
29
--gradle-opts Additional options to pass on to ./gradlew, see \`./gradlew --help\`
30
+
--ignore-unresolved With --facts: warn on unresolved dependencies instead of failing the run (unresolved deps are not emitted to the facts file)
29
31
--verbose Print debug messages
30
32
31
33
Uses gradle, preferably through your local project \`gradlew\`, to generate a
--bin Location of gradlew binary to use, default: CWD/gradlew
27
+
--configs With --facts: comma-separated glob patterns matched against Gradle configuration names (case-sensitive, \`*\` and \`?\` wildcards). e.g. \`*CompileClasspath,*RuntimeClasspath\` to skip tooling configs. Default: every resolvable configuration except AGP instrumented-test classpaths
27
28
--facts Emit a Socket facts JSON file (\`.socket.facts.json\`) describing the resolved dependency graph instead of generating \`pom.xml\` files
28
29
--gradle-opts Additional options to pass on to ./gradlew, see \`./gradlew --help\`
30
+
--ignore-unresolved With --facts: warn on unresolved dependencies instead of failing the run (unresolved deps are not emitted to the facts file)
29
31
--verbose Print debug messages
30
32
31
33
Uses gradle, preferably through your local project \`gradlew\`, to generate a
'With --facts: comma-separated sbt configurations to resolve (default: compile,optional,provided,runtime,test)',
40
+
'With --facts: comma-separated glob patterns matched against sbt configuration names (case-sensitive, `*` and `?` wildcards). Bare names (no wildcards) act as exact-name filters. Default: compile,optional,provided,runtime,test',
41
41
},
42
42
ignoreUnresolved: {
43
43
type: 'boolean',
44
44
description:
45
-
'With --facts: skip dependencies that fail to resolve instead of failing the run',
45
+
'With --facts: warn on unresolved dependencies instead of failing the run (unresolved deps are not emitted to the facts file)',
--configs With --facts: comma-separated sbt configurations to resolve (default: compile,optional,provided,runtime,test)
27
+
--configs With --facts: comma-separated glob patterns matched against sbt configuration names (case-sensitive, \`*\` and \`?\` wildcards). Bare names (no wildcards) act as exact-name filters. Default: compile,optional,provided,runtime,test
28
28
--facts Emit a Socket facts JSON file (\`.socket.facts.json\`) describing the resolved dependency graph instead of generating \`pom.xml\` files
29
-
--ignore-unresolved With --facts: skip dependencies that fail to resolve instead of failing the run
29
+
--ignore-unresolved With --facts: warn on unresolved dependencies instead of failing the run (unresolved deps are not emitted to the facts file)
30
30
--out Path of output file; where to store the resulting manifest, see also --stdout
31
31
--sbt-opts Additional options to pass on to sbt, as per \`sbt --help\`
32
32
--stdout Print resulting pom.xml to stdout (supersedes --out)
0 commit comments