Tasks
When you apply the plugin, it automatically registers the following tasks in your Gradle project. You do not declare these tasks yourself — they are created and configured based on the swiftpm { } block and, on Android, one set per build variant.
resolveScdTool
Section titled “resolveScdTool”Resolves the scd binary before any build task runs. Checks the configured or default path, and if scdAutoUpdate is enabled, downloads a newer version when available and runs scd toolchain install-latest to update the Swift for Android toolchain.
This task runs automatically as a dependency of the assemble and bridging tasks. You do not normally need to invoke it directly.
Inputs: scd path (optional), scdAutoUpdate flag
Output: resolved path to the scd binary
generateBridging
Section titled “generateBridging”Generates Kotlin/Java proxy classes from @jvm-annotated Swift types by invoking swift package plugin generate-java-bridging.
The output directory is automatically added to the main Java source set (base plugin) or to each Android variant’s source set (Android plugin), so the generated classes compile as part of your normal build without any extra configuration.
Inputs: path, product, javaVersion
Output: build/plugins/generate-java-bridging/outputs/<product>/main/java/
On Android, the plugin also passes --generate-android-viewmodels to generate ViewModel wrappers for @Observable types.
assembleSwiftPackage / assemble{Variant}SwiftPackage
Section titled “assembleSwiftPackage / assemble{Variant}SwiftPackage”Builds the Swift package as a dynamic library by invoking scd archive.
- Base plugin: registers a single
assembleSwiftPackagetask. When theapplicationplugin is also applied, setsjava.library.pathto the output directory so the library is found at runtime. - Android plugin: registers one task per build variant —
assembleDebugSwiftPackage,assembleReleaseSwiftPackage, etc. Each task builds in the matching configuration (Debug/Release).
Inputs: path, product, platforms, scdOptions, resolved dependencies
Output: build/lib/<platform>/
On Android, the output directory is registered as a JNI libs folder for the variant so the native library is packaged into the APK automatically.
cleanSwiftBuildDir / clean{Variant}SwiftBuildDir
Section titled “cleanSwiftBuildDir / clean{Variant}SwiftBuildDir”Deletes the Swift incremental build directory (build/swiftpm/<package-name>). Automatically wired as a dependency of the standard clean task.
Run explicitly to force a clean Swift rebuild:
./gradlew cleanSwiftBuildDir