File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Sources/SwiftJavaTool/Commands Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ extension SwiftJava {
5252 @Option ( help: " Cache directory for intermediate results and other outputs between runs " )
5353 var cacheDirectory : String ?
5454
55+ @Option ( help: " Match java package directory structure with generated Swift files " )
56+ var swiftMatchPackageDirectoryStructure : Bool = false
57+
5558 @Argument ( help: " Path to .jar file whose Java classes should be wrapped using Swift bindings " )
5659 var input : String
5760 }
@@ -229,11 +232,16 @@ extension SwiftJava.WrapJavaCommand {
229232
230233 """
231234
235+ var generatedFileOutputDir = self . actualOutputDirectory
236+ if self . swiftMatchPackageDirectoryStructure {
237+ generatedFileOutputDir? . append ( path: javaClass. getPackageName ( ) . replacing ( " . " , with: " / " ) )
238+ }
239+
232240 let swiftFileName = try ! translator. getSwiftTypeName ( javaClass, preferValueTypes: false )
233241 . swiftName. replacing ( " . " , with: " + " ) + " .swift "
234242 try writeContents (
235243 swiftFileText,
236- outputDirectory: self . actualOutputDirectory ,
244+ outputDirectory: generatedFileOutputDir ,
237245 to: swiftFileName,
238246 description: " Java class ' \( javaClass. getName ( ) ) ' translation "
239247 )
You can’t perform that action at this time.
0 commit comments