diff --git a/Sources/Java2Swift/JavaToSwift.swift b/Sources/Java2Swift/JavaToSwift.swift index 1fd25ca9..1b67cc9f 100644 --- a/Sources/Java2Swift/JavaToSwift.swift +++ b/Sources/Java2Swift/JavaToSwift.swift @@ -41,7 +41,7 @@ struct JavaToSwift: ParsableCommand { help: "Specifies that the input is a Jar file whose public classes will be loaded. The output of Java2Swift will be a configuration file (Java2Swift.config) that can be used as input to a subsequent Java2Swift invocation to generate wrappers for those public classes." ) - var jarFile: Bool = false + var jar: Bool = false @Option( name: [.customLong("cp"), .customLong("classpath")], @@ -54,7 +54,7 @@ struct JavaToSwift: ParsableCommand { @Argument( help: - "The input file, which is either a Java2Swift configuration file or (if '-jar-file' was specified) a Jar file." + "The input file, which is either a Java2Swift configuration file or (if '-jar' was specified) a Jar file." ) var input: String @@ -72,7 +72,7 @@ struct JavaToSwift: ParsableCommand { mutating func run() throws { // Determine the mode in which we'll execute. let generationMode: GenerationMode - if jarFile { + if jar { generationMode = .configuration(jarFile: input) } else { let config = try JavaTranslator.readConfiguration(from: URL(fileURLWithPath: input)) @@ -100,7 +100,7 @@ struct JavaToSwift: ParsableCommand { var classPathPieces: [String] = classpath switch generationMode { case .configuration(jarFile: let jarFile): - // * Jar file (in `-jar-file` mode) + // * Jar file (in `-jar` mode) classPathPieces.append(jarFile) case .classWrappers(let config): // * Class path specified in the configuration file (if any) diff --git a/USER_GUIDE.md b/USER_GUIDE.md index 92de4a23..b35e0ff7 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -297,11 +297,11 @@ swift run Java2Swift to produce help output like the following: ``` -USAGE: Java2Swift --module-name [--depends-on ...] [--jar-file] [--cp ...] [--output-directory ] +USAGE: Java2Swift --module-name [--depends-on ...] [--jar] [--cp ...] [--output-directory ] ARGUMENTS: The input file, which is either a Java2Swift - configuration file or (if '-jar-file' was specified) + configuration file or (if '-jar' was specified) a Jar file. OPTIONS: @@ -315,7 +315,7 @@ OPTIONS: There should be one of these options for each Swift module that this module depends on (transitively) that contains wrapped Java sources. - --jar-file Specifies that the input is a Jar file whose public + --jar Specifies that the input is a Jar file whose public classes will be loaded. The output of Java2Swift will be a configuration file (Java2Swift.config) that can be used as input to a subsequent Java2Swift @@ -354,7 +354,7 @@ warning: Unable to translate 'java.util.jar.JarInputStream' method 'transferTo': The result of such warnings is that certain information won't be statically available in Swift, e.g., the superclass won't be known (so we will assume it is `JavaObject`), or the specified constructors or methods won't be translated. If you don't need these APIs, the warnings can be safely ignored. The APIs can still be called dynamically via JNI. -The `--jar-file` option changes the operation of `Java2Swift`. Instead of wrapping Java classes in Swift, it scans the given input Jar file to find all public classes and outputs a configuration file `Java2Swift.config` mapping all of the Java classes in the Jar file to Swift types. The `--jar-file` mode is expected to be used to help import a Java library into Swift wholesale, after which Java2Swift should invoked again given the generated configuration file. +The `--jar` option changes the operation of `Java2Swift`. Instead of wrapping Java classes in Swift, it scans the given input Jar file to find all public classes and outputs a configuration file `Java2Swift.config` mapping all of the Java classes in the Jar file to Swift types. The `--jar` mode is expected to be used to help import a Java library into Swift wholesale, after which Java2Swift should invoked again given the generated configuration file. ### Under construction: Create a Java class to wrap the Swift library