Skip to content

Commit 7f1353f

Browse files
committed
format
1 parent 08baa6d commit 7f1353f

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

Plugins/JExtractSwiftPlugin/JExtractSwiftPlugin.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct JExtractSwiftBuildToolPlugin: SwiftJavaPluginProtocol, BuildToolPlugin {
152152
executable: toolURL,
153153
arguments: arguments,
154154
inputFiles: [configFile] + swiftFiles,
155-
outputFiles: jextractOutputFiles
155+
outputFiles: jextractOutputFiles,
156156
)
157157
]
158158

@@ -193,7 +193,8 @@ struct JExtractSwiftBuildToolPlugin: SwiftJavaPluginProtocol, BuildToolPlugin {
193193
log("Detected 'gradle' executable (or gradlew fallback): \(gradleExecutable)")
194194

195195
let javaHome = URL(filePath: findJavaHome())
196-
let javacPath = javaHome
196+
let javacPath =
197+
javaHome
197198
.appending(path: "bin")
198199
.appending(path: self.javacName)
199200

@@ -232,7 +233,7 @@ struct JExtractSwiftBuildToolPlugin: SwiftJavaPluginProtocol, BuildToolPlugin {
232233
executable: toolURL,
233234
arguments: javaCallbacksArguments,
234235
inputFiles: outputSwiftFiles + [swiftJavaDirectory],
235-
outputFiles: [javaCallbacksSwiftOutput]
236+
outputFiles: [javaCallbacksSwiftOutput],
236237
)
237238
]
238239

Sources/SwiftJavaTool/Commands/JavaCallbacksBuildCommand.swift

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extension SwiftJava {
4040
commandName: "java-callbacks-build",
4141
abstract:
4242
"Build SwiftKitCore, compile Java callbacks, and generate Swift wrappers (for use by JExtractSwiftPlugin)",
43-
shouldDisplay: false
43+
shouldDisplay: false,
4444
)
4545

4646
// MARK: Gradle options
@@ -78,7 +78,7 @@ extension SwiftJava {
7878

7979
@Option(
8080
name: .customLong("output-directory"),
81-
help: "Directory where generated Swift files should be written"
81+
help: "Directory where generated Swift files should be written",
8282
)
8383
var outputDirectory: String
8484

@@ -109,22 +109,25 @@ extension SwiftJava {
109109
"--no-daemon",
110110
],
111111
environment: .inherit.updating(["GRADLE_USER_HOME": gradleUserHome]),
112-
errorMessage: "gradle :SwiftKitCore:build"
112+
errorMessage: "gradle :SwiftKitCore:build",
113113
)
114114

115115
// If the sources list does not exist, jextract produced no Java callbacks.
116116
// Write an empty placeholder Swift file and return early.
117117
guard FileManager.default.fileExists(atPath: javaSourcesList) else {
118118
try FileManager.default.createDirectory(at: outputDir, withIntermediateDirectories: true)
119119
try "// No Java callbacks generated\n".write(
120-
to: outputFile, atomically: true, encoding: .utf8)
120+
to: outputFile,
121+
atomically: true,
122+
encoding: .utf8,
123+
)
121124
return
122125
}
123126

124127
// 2. Compile Java sources with javac.
125128
try FileManager.default.createDirectory(
126129
atPath: javaOutputDirectory,
127-
withIntermediateDirectories: true
130+
withIntermediateDirectories: true,
128131
)
129132

130133
try await runSubprocess(
@@ -135,7 +138,7 @@ extension SwiftJava {
135138
"-parameters",
136139
"-classpath", swiftKitCoreClasspath,
137140
],
138-
errorMessage: "javac"
141+
errorMessage: "javac",
139142
)
140143

141144
// 3. Generate swift-java.config from compiled classes.
@@ -154,7 +157,7 @@ extension SwiftJava {
154157
try await runSubprocess(
155158
executable: swiftJavaTool,
156159
arguments: configureArgs,
157-
errorMessage: "swift-java configure"
160+
errorMessage: "swift-java configure",
158161
)
159162

160163
// 4. Generate Swift wrappers using wrap-java.
@@ -174,7 +177,7 @@ extension SwiftJava {
174177
try await runSubprocess(
175178
executable: swiftJavaTool,
176179
arguments: wrapJavaArgs,
177-
errorMessage: "swift-java wrap-java"
180+
errorMessage: "swift-java wrap-java",
178181
)
179182
}
180183
}
@@ -186,14 +189,14 @@ private func runSubprocess(
186189
executable: String,
187190
arguments: [String],
188191
environment: Subprocess.Environment = .inherit,
189-
errorMessage: String
192+
errorMessage: String,
190193
) async throws {
191194
let result = try await Subprocess.run(
192195
.path(FilePath(executable)),
193196
arguments: .init(arguments),
194197
environment: environment,
195198
output: .standardOutput,
196-
error: .standardError
199+
error: .standardError,
197200
)
198201
guard result.terminationStatus.isSuccess else {
199202
throw JavaCallbacksBuildError(

0 commit comments

Comments
 (0)