Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Sources/SwiftJavaTool/Commands/WrapJavaCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ extension SwiftJava {
@Option(help: "Cache directory for intermediate results and other outputs between runs")
var cacheDirectory: String?

@Option(help: "Match java package directory structure with generated Swift files")
var swiftMatchPackageDirectoryStructure: Bool = false

@Argument(help: "Path to .jar file whose Java classes should be wrapped using Swift bindings")
var input: String
}
Expand Down Expand Up @@ -229,11 +232,16 @@ extension SwiftJava.WrapJavaCommand {

"""

var generatedFileOutputDir = self.actualOutputDirectory
if self.swiftMatchPackageDirectoryStructure {
generatedFileOutputDir?.append(path: javaClass.getPackageName().replacing(".", with: "/"))
}

let swiftFileName = try! translator.getSwiftTypeName(javaClass, preferValueTypes: false)
.swiftName.replacing(".", with: "+") + ".swift"
try writeContents(
swiftFileText,
outputDirectory: self.actualOutputDirectory,
outputDirectory: generatedFileOutputDir,
to: swiftFileName,
description: "Java class '\(javaClass.getName())' translation"
)
Expand Down
Loading