[JExtract] Confused by generated output
Closed this issue · 4 comments
Hi, I was trying to use jextract on a package. After repeatedly crashing on something, I decided to try it on one of the samples in this repo - namely JExtractJNISampleApp. Invocation:
swift run swift-java jextract --mode jni --swift-module MySwiftLibrary --input-swift /path/to/Samples/JExtractJNISampleApp/ --java-package com.swift.test --output-java /some/output/directory --output-swift /another/output/directory
After convincing jextract to in fact use jni mode (it got lost somewhere along the way, so that in SwiftToJava.run, the value was nil, which defaulted to ffm), The tool failed on a fatalError in JavaType.jniTypeSignature (There is no type signature for 'void'). I replaced that with an empty string just to see if I could get some output. I finally got it. More than i was expecting, in fact.
The java output boasts 1151 files that add up to 12.3 MB. The swift output has 1237 files, adding up to 15.8 MB. Among the files I see things like VisitorTests.java, ColorOptions.java and OptionGroup.java. This all for a package that consists of... 7 simple Swift files that don't seem to have anything to do with the files I mentioned. Is this expected? Did I make a mistake somewhere?
Should have tried looking a bit longer - I guess it's because I set --input-swift to the whole JExtractJNISampleApp, which includes .build, which has swift-syntax, swift-argument-parser and swift-system... that would explain where those seemingly unrelated files came from 😅
Seems like tool misuse as you just noted.
What is this issue about that is actionable? Otherwise I’ll have to close it, issues are not forums, they need to have some potential resolution.
Where did you see the option being dropped an how can we reproduce this. Do you have a fix perhaps?
Sorry, feel free to close. I'll create a PR once I debug it further.
Sounds even better, thank you! :)
Or make an issue to explain the actionable bit of the issue, though just a PR would also be fine. thanks!