Skip to content

Commit 5356343

Browse files
committed
only run extra build phases if mode is enabled
1 parent 04116aa commit 5356343

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Plugins/JExtractSwiftPlugin/JExtractSwiftPlugin.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ struct JExtractSwiftBuildToolPlugin: SwiftJavaPluginProtocol, BuildToolPlugin {
2626
func createBuildCommands(context: PluginContext, target: Target) throws -> [Command] {
2727
let toolURL = try context.tool(named: "SwiftJavaTool").url
2828

29-
// The URL of the compiled Java sources
30-
let javaClassFileURL = context.pluginWorkDirectoryURL
31-
.appending(path: "compiled-java-output")
32-
3329
var commands: [Command] = []
3430

3531
guard let sourceModule = target.sourceModule else { return [] }
@@ -148,6 +144,15 @@ struct JExtractSwiftBuildToolPlugin: SwiftJavaPluginProtocol, BuildToolPlugin {
148144
)
149145
]
150146

147+
// If we do not need Java callbacks, we can skip the remaining steps.
148+
guard configuration?.enableJavaCallbacks ?? false else {
149+
return commands
150+
}
151+
152+
// The URL of the compiled Java sources
153+
let javaClassFileURL = context.pluginWorkDirectoryURL
154+
.appending(path: "compiled-java-output")
155+
151156
// Build SwiftKitCore and get the classpath
152157
// as the jextracted sources will depend on that
153158

0 commit comments

Comments
 (0)