swiftlang/swift-java

[JExtract] Support multiple types in the same file or filename not equal to type name

Closed this issue · 3 comments

Currently we generate a Swift thunk for each imported type Type+SwiftJava.swift. The problem is that we need to tell the SwiftPM build plugin the output file names, where we currently pass in filename+SwiftJava.swift.

That means that the following code does not work in Types.swift:

public class Class1 {}
public class Class2 {}

We should change this behaviour, by perhaps generating a Swift file per imported file instead.

ktoso commented

Sadly this can't quite work as "swift file name" -> "same name".java because public java types must be contained in a file of the same name... so we have to search the swift files to find out all public types, and then use them as the base names...

because the plugin at that phase cannot use swift syntax, we'll have to do some nasty "grep for public class|enum|struct|actor" basically...

We'll have to do it though

ktoso commented

Disregard the above, this is about the Swift thunk files; they totally can be filename based.

ktoso commented

This is now solved by #403