Skip to content

Commit 234c301

Browse files
authored
Merge pull request #93 from DougGregor/jar-file-option-rename
Java2Swift: Rename `-jar-file` option to `-jar`
2 parents 9823301 + a954107 commit 234c301

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/Java2Swift/JavaToSwift.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct JavaToSwift: ParsableCommand {
4141
help:
4242
"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."
4343
)
44-
var jarFile: Bool = false
44+
var jar: Bool = false
4545

4646
@Option(
4747
name: [.customLong("cp"), .customLong("classpath")],
@@ -54,7 +54,7 @@ struct JavaToSwift: ParsableCommand {
5454

5555
@Argument(
5656
help:
57-
"The input file, which is either a Java2Swift configuration file or (if '-jar-file' was specified) a Jar file."
57+
"The input file, which is either a Java2Swift configuration file or (if '-jar' was specified) a Jar file."
5858
)
5959
var input: String
6060

@@ -72,7 +72,7 @@ struct JavaToSwift: ParsableCommand {
7272
mutating func run() throws {
7373
// Determine the mode in which we'll execute.
7474
let generationMode: GenerationMode
75-
if jarFile {
75+
if jar {
7676
generationMode = .configuration(jarFile: input)
7777
} else {
7878
let config = try JavaTranslator.readConfiguration(from: URL(fileURLWithPath: input))
@@ -100,7 +100,7 @@ struct JavaToSwift: ParsableCommand {
100100
var classPathPieces: [String] = classpath
101101
switch generationMode {
102102
case .configuration(jarFile: let jarFile):
103-
// * Jar file (in `-jar-file` mode)
103+
// * Jar file (in `-jar` mode)
104104
classPathPieces.append(jarFile)
105105
case .classWrappers(let config):
106106
// * Class path specified in the configuration file (if any)

USER_GUIDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ swift run Java2Swift
297297
to produce help output like the following:
298298

299299
```
300-
USAGE: Java2Swift --module-name <module-name> [--depends-on <depends-on> ...] [--jar-file] [--cp <cp> ...] [--output-directory <output-directory>] <input>
300+
USAGE: Java2Swift --module-name <module-name> [--depends-on <depends-on> ...] [--jar] [--cp <cp> ...] [--output-directory <output-directory>] <input>
301301
302302
ARGUMENTS:
303303
<input> The input file, which is either a Java2Swift
304-
configuration file or (if '-jar-file' was specified)
304+
configuration file or (if '-jar' was specified)
305305
a Jar file.
306306
307307
OPTIONS:
@@ -315,7 +315,7 @@ OPTIONS:
315315
There should be one of these options for each Swift
316316
module that this module depends on (transitively)
317317
that contains wrapped Java sources.
318-
--jar-file Specifies that the input is a Jar file whose public
318+
--jar Specifies that the input is a Jar file whose public
319319
classes will be loaded. The output of Java2Swift will
320320
be a configuration file (Java2Swift.config) that can
321321
be used as input to a subsequent Java2Swift
@@ -354,7 +354,7 @@ warning: Unable to translate 'java.util.jar.JarInputStream' method 'transferTo':
354354

355355
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.
356356

357-
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.
357+
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.
358358

359359
### Under construction: Create a Java class to wrap the Swift library
360360

0 commit comments

Comments
 (0)