-
Notifications
You must be signed in to change notification settings - Fork 50
feat(scan): forward socket.json build-tool config into reachability (1.1.120, Coana 15.4.1) #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jeppe Fredsgaard Blaabjerg (jfblaa)
merged 7 commits into
v1.x
from
jfblaa/rea-549-socket-cli-map-socketjson-build-tool-config-into-coanas-auto
Jun 16, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fe8f076
feat(scan): forward socket.json build-tool config into reachability
jfblaa 478fb22
chore(release): 1.1.120 — Coana 15.4.1 and socket.json build-tool con…
jfblaa 7e4cd7a
fix(scan): gate --auto-manifest-config on Coana version support
jfblaa 9cdf594
Merge branch 'v1.x' into jfblaa/rea-549-socket-cli-map-socketjson-bui…
jfblaa a89812a
fix(scan): drop Coana version gate, clean up config temp file in finally
jfblaa 2f2d3c1
fix changelog entry
jfblaa 259d5b0
bump coana to 15.4.5
jfblaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| import type { SocketJson } from './socket-json.mts' | ||
|
|
||
| // Per-ecosystem build-tool options handed off to the Coana CLI — used both when | ||
| // generating manifests (`coana manifest <ecosystem>`) and, in socket mode, for | ||
| // reach-time dependency resolution (`coana run`). This mirrors the Coana-side | ||
| // `--auto-manifest-config` shape: socket-cli owns mapping `socket.json` onto it, | ||
| // so Coana stays uncoupled from `socket.json`'s schema. Keeping the | ||
| // per-ecosystem options namespaced (rather than as flat CLI flags) avoids the | ||
| // ambiguity of a bare `--bin`/`--include-configs` when a repo has more than one | ||
| // build tool. | ||
| export type BuildToolOptions = { | ||
| // Build-tool executable override (e.g. `./gradlew`, `atlas-mvn`). | ||
| bin?: string | undefined | ||
| // Comma-separated config-name globs to skip. | ||
| excludeConfigs?: string | undefined | ||
| // `socket.json`'s per-ecosystem `ignoreUnresolved` (warn vs fail on unresolved | ||
| // dependencies), forwarded verbatim. NOTE: this is NOT the reach-time | ||
| // fail-closed switch — that's the run-wide `failOnBuildToolError` below. | ||
| ignoreUnresolved?: boolean | undefined | ||
| // Comma-separated config-name globs to resolve. | ||
| includeConfigs?: string | undefined | ||
| // Extra build-tool options, pre-split into argv. Coana maps these straight to | ||
| // the tool's opts (no splitting on its side). Mapped from `socket.json`'s | ||
| // `gradleOpts`/`sbtOpts` string. | ||
| opts?: string[] | undefined | ||
| } | ||
|
|
||
| // The Coana hand-off config. `failOnBuildToolError` is run-wide (top level) | ||
| // because `--auto-manifest` is a single CLI mode, not a per-package-manager | ||
| // setting. The per-ecosystem entries are present only for ecosystems configured | ||
| // (and not disabled) in `socket.json`; absent ecosystems fall to Coana's own | ||
| // defaults. | ||
| export type AutoManifestConfig = { | ||
| // Run-wide fail-closed switch. When true, Coana treats a build-tool step | ||
| // failure as fatal rather than tolerating it. socket-cli sets it true under | ||
| // `--auto-manifest`; left unset on plain `--reach` (permissive — Coana's | ||
| // default best-effort behaviour). | ||
| failOnBuildToolError?: boolean | undefined | ||
| gradle?: BuildToolOptions | undefined | ||
| sbt?: BuildToolOptions | undefined | ||
| } | ||
|
|
||
| // Splits a `socket.json` opts string (`gradleOpts`/`sbtOpts`) into argv, matching | ||
| // how the standalone `socket manifest` path splits it. Returns undefined when | ||
| // there's nothing to pass so the field is omitted from the config. | ||
| function parseOpts(value: string | undefined): string[] | undefined { | ||
| if (!value) { | ||
| return undefined | ||
| } | ||
| const parts = value | ||
| .split(' ') | ||
| .map(s => s.trim()) | ||
| .filter(Boolean) | ||
| return parts.length ? parts : undefined | ||
| } | ||
|
|
||
| // Maps `socket.json`'s `defaults.manifest.<ecosystem>` build-tool options onto | ||
| // the Coana hand-off config. | ||
| // | ||
| // `autoManifest` reflects whether the run is `--auto-manifest` (fail-closed: | ||
| // `failOnBuildToolError=true`) vs plain `--reach` (permissive: | ||
| // `failOnBuildToolError` left unset so Coana's default applies). Per-ecosystem | ||
| // options are forwarded verbatim from `socket.json`; disabled ecosystems are | ||
| // omitted so they fall back to Coana's defaults. | ||
| export function buildAutoManifestConfig( | ||
| sockJson: SocketJson, | ||
| { autoManifest }: { autoManifest: boolean }, | ||
| ): AutoManifestConfig { | ||
| const manifest = sockJson.defaults?.manifest | ||
| const config: AutoManifestConfig = {} | ||
|
|
||
| // `--auto-manifest` expects every build-tool command to succeed, so a | ||
| // build-tool step failure should be fatal rather than tolerated. | ||
| if (autoManifest) { | ||
| config.failOnBuildToolError = true | ||
| } | ||
|
|
||
| const gradle = manifest?.gradle | ||
| if (gradle && !gradle.disabled) { | ||
| config.gradle = { | ||
| bin: gradle.bin, | ||
| excludeConfigs: gradle.excludeConfigs, | ||
| ignoreUnresolved: gradle.ignoreUnresolved, | ||
| includeConfigs: gradle.includeConfigs, | ||
| opts: parseOpts(gradle.gradleOpts), | ||
| } | ||
| } | ||
|
|
||
| const sbt = manifest?.sbt | ||
| if (sbt && !sbt.disabled) { | ||
| config.sbt = { | ||
| bin: sbt.bin, | ||
| excludeConfigs: sbt.excludeConfigs, | ||
| ignoreUnresolved: sbt.ignoreUnresolved, | ||
| includeConfigs: sbt.includeConfigs, | ||
| opts: parseOpts(sbt.sbtOpts), | ||
| } | ||
| } | ||
|
|
||
| return config | ||
| } | ||
|
|
||
| // True when there's nothing to hand to Coana: no per-ecosystem options and the | ||
| // run mode is left at Coana's permissive default. When true, the | ||
| // `--auto-manifest-config` option should be omitted entirely. | ||
| export function isAutoManifestConfigEmpty(config: AutoManifestConfig): boolean { | ||
| return ( | ||
| !config.gradle && !config.sbt && config.failOnBuildToolError === undefined | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.