Skip to content

jextract: Move Foundation support into a common package with code generation#687

Open
sidepelican wants to merge 20 commits intoswiftlang:mainfrom
sidepelican:swiftkit_foundation_codegen
Open

jextract: Move Foundation support into a common package with code generation#687
sidepelican wants to merge 20 commits intoswiftlang:mainfrom
sidepelican:swiftkit_foundation_codegen

Conversation

@sidepelican
Copy link
Copy Markdown
Contributor

This is an alternative implementation of #684.

For Foundation types, this PR uses jextract generated code instead of manual implementation.
This approach continues to use printSpecificTypeHelpers in the code generator.

@sidepelican sidepelican requested a review from ktoso as a code owner April 8, 2026 07:51
Comment on lines +98 to +100
if !group.value.allSatisfy({ $0.value.swiftNominal.moduleName == "SwiftRuntimeFunctions" }) {
printer.print("import SwiftRuntimeFunctions")
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A workaround to ensure the generated code doesn't import its own package

return renderFoundationDataThunks(nominal)
default:
return []
if nominal.swiftNominal.moduleName == "SwiftRuntimeFunctions" {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foundation types are now imported using the swift-java package name. This is the concern I raised in #684 (comment)

@sidepelican
Copy link
Copy Markdown
Contributor Author

The license check is showing an error for the generated code, but why SwiftJavaError+SwiftJava.swift avoiding the license headers check?

@sidepelican
Copy link
Copy Markdown
Contributor Author

I found .licenseignore 😁

@ktoso
Copy link
Copy Markdown
Collaborator

ktoso commented Apr 8, 2026

I'm reviewing this but need more time, probably tomorrow. Thanks for poking at this

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.

2 participants