Skip to content

Jextract CLI doesn't have a way to pass .swiftinterface files #484

Closed

Description

@timofeys1

The jextract CLI doesn't allow passing .swiftinterface files. I built the CLI with swift build --product swift-java, produced the .swiftinterface with:

xcodebuild clean build -workspace Samples/SwiftJavaExtractFFMSampleApp/ -scheme SwiftJavaExtractFFMSampleApp -destination generic/platform=macOS -derivedDataPath dd SWIFT_EMIT_MODULE_INTERFACE=YES ARCHS=arm64

And tried importing it with:

./.build/arm64-apple-macosx/debug/swift-java jextract --swift-module MySwiftLibrary --input-swift dd/Build/Products/Debug/MySwiftLibrary.swiftmodule/arm64-apple-macos.swiftinterface --java-package com.example.swift --output-swift S1 --output-java J1

This capability seems to be intended from the sources. With a minor tweak here, I was able to get jextract to accept the .swiftinterface file, and it produced a Java API similar to the API it makes from sources.

Activity

  1. ktoso commented on Dec 11, 2025

    @ktoso
    Collaborator

    We originally were driving everything from interfaces and then moved to swift files, but yes, it is intended to allow either!

    Would you want to submit your small tweak

    let allFiles = collectAllFiles(suffix: ".swift", in: inputPaths, log: translator.log)

    here as a PR please? We can also add some test-case for this in Samples probably ... best discussed in a PR and I can help out finish it up

  2. added theissue type on Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:jextractIssues related to jextract-swift

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions