Skip to content

scalasem: read jar coordinates from Ivy and Gradle cache paths - #32

Merged
prabhu merged 1 commit into
mainfrom
fix/scalasem-ivy-gradle-jar-coordinates
Oct 30, 2026
Merged

prabhu merged 1 commit into
mainfrom
fix/scalasem-ivy-gradle-jar-coordinates

Conversation

@prabhu

@prabhu prabhu commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

The report records each module's dependency classpath with Maven coordinates, and jarCoordinate could read those coordinates only from a Maven repository layout. A jar that sbt resolved from anywhere else had no group, artifact and version, and the report drops classpath entries without them. After #31, atom's classpath includes the chen modules it gets through publishLocal, at paths such as ~/.ivy2/local/io.appthreat/c2cpg_3/4.0.0/jars/c2cpg_3.jar, but the report still left every one of them out. cdxgen relies on this classpath to decide which component a symbol belongs to, so atom's imports of io.shiftleft.codepropertygraph and io.shiftleft.semanticcpg could not be attributed to cpg2 or semanticcpg.

jarCoordinate now also reads the layouts in which the group is a single dotted directory:

  • the Ivy local repository, <org>/<artifact>/<version>/jars/<artifact>.jar, including the scala_<v>/sbt_<v> directories sbt plugins add before the version
  • the Ivy cache that sbt 0.13 to 1.2 use, <org>/<artifact>/jars/<artifact>-<version>.jar, and its bundles directory
  • the Gradle cache, files-2.1/<group>/<artifact>/<version>/<sha1>/<file>.jar

Unmanaged jars, such as the lib/org.eclipse.cdt.core jar in atom, have no coordinates, so they stay out of the report.

Results:

  • atom at b66128a: the report's classpath grows from 79 to 96 entries. The new entries include the chen modules at 4.0.0 with group io.appthreat, the cpg2 jars at 3.0.10 and the odb2 jars at 3.0.9. Facts and diagnostics are unchanged.
  • chen at 3b1595a1: 525 files and 644 classpath entries, with identical facts.
  • cdxgen over atom with this build: cdxgen -t scala --evidence --profile research finds 1856 occurrences, up from 636. cpg2 and semanticcpg get their occurrences, and all 22 call stacks resolve to the component they end in.

The new cases in test-fixtures/scalasem-engine.js cover each layout. npm test and npm run test:scala pass, and Prettier reports no changes.

This change goes out with 1.10.6, the version main already carries; it has not been tagged yet.

jarCoordinate understood only the Maven repository layout, so the report's module classpath left out jars sbt resolved from the Ivy local repository, such as publishLocal dependencies, along with jars from the Ivy and Gradle caches. Unmanaged jars carry no coordinate and stay out, as the report schema requires group, artifact and version.
@prabhu prabhu added bug Something isn't working ai-auto A person set the task, and AI agents carried it through to completion labels Oct 30, 2026
@prabhu
prabhu enabled auto-merge October 30, 2026 04:07
@prabhu
prabhu added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 1d9d882 Oct 30, 2026
3 checks passed
@prabhu
prabhu deleted the fix/scalasem-ivy-gradle-jar-coordinates branch October 30, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-auto A person set the task, and AI agents carried it through to completion bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant