Skip to content

jextract: resolve cross-module types via --depends-on#766

Merged
ktoso merged 6 commits into
swiftlang:mainfrom
ktoso:ktoso/jextract-cross-module-depends-on
May 26, 2026
Merged

jextract: resolve cross-module types via --depends-on#766
ktoso merged 6 commits into
swiftlang:mainfrom
ktoso:ktoso/jextract-cross-module-depends-on

Conversation

@ktoso
Copy link
Copy Markdown
Collaborator

@ktoso ktoso commented May 25, 2026

Previously --depends-on was used only to map Java packages and look up wrapped Java classes; When using swift-java jextract on modules which extended or used types from another module, we'd not be able to map them unless we manually write stubs for them in the swift-java config.

This was annoying, we can do better than that -- emit --depends-on for jextract such that it is aware of the other modules and can attempt to scan them.

  • SourceDependencies owns dependency modules and known types
  • SwiftSymbolTable.setup gains a dependencies: parameter and builds real symbol tables for each dependent module before falling back to importedModuleStubs

@ktoso ktoso force-pushed the ktoso/jextract-cross-module-depends-on branch 3 times, most recently from 04c9f94 to 52cb189 Compare May 25, 2026 05:32
ktoso added 4 commits May 25, 2026 14:58
Previously --depends-on was used only to map Java packages and look up
wrapped Java classes; When using swift-java jextract on modules which
extended or used types from another module, we'd not be able to map them
unless we manually write stubs for them in the swift-java config.

This was annoying, we can do better than that -- emit --depends-on for
jextract such that it is aware of the other modules and can attempt to
scan them.

- `SourceDependenciesResolver` owns dependent-module source parsing
  and per-module input registration.
- `SwiftSymbolTable.setup` gains a `dependencies:` parameter and
  builds real symbol tables for each dependent module before
  falling back to `importedModuleStubs`
- Failed-import diagnostics upgraded debug -> warning and hint about
  --depends-on
@ktoso ktoso force-pushed the ktoso/jextract-cross-module-depends-on branch from 52cb189 to c520574 Compare May 25, 2026 10:26
@ktoso ktoso force-pushed the ktoso/jextract-cross-module-depends-on branch from 75b263f to 79d016c Compare May 25, 2026 10:44
@ktoso ktoso marked this pull request as ready for review May 25, 2026 10:46
@ktoso ktoso force-pushed the ktoso/jextract-cross-module-depends-on branch 2 times, most recently from 92c6bce to 512633c Compare May 25, 2026 13:54
@ktoso ktoso force-pushed the ktoso/jextract-cross-module-depends-on branch from 512633c to 8293a48 Compare May 26, 2026 01:49
@ktoso ktoso merged commit 060b647 into swiftlang:main May 26, 2026
22 of 73 checks passed
@ktoso ktoso deleted the ktoso/jextract-cross-module-depends-on branch May 26, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant