The Swift Package Manager Plugin provides tasks to build swift packages, generate Java bridgings and assembling final products.
The projects consists of two plugins: the spm-gradle
for the integration into standard Java/Kotlin Gradle builds and the spm-gradle-android
when building for the Android platform.
To apply one of the plugins, add the plugin's id into the plugins block in the build file build.gradle.kts
:
spm-gradle
plugins {
id("io.scade.gradle.plugins.swiftpm") version "1.0.3"
}
spm-gradle-android
plugins {
id("io.scade.gradle.plugins.android.swiftpm") version "1.0.3"
}
For both plugins add the following configuration section to the build file build.gradle.kts
:
swiftpm {
// Path to the folder containing Package.swift
path = file("<PACKAGE LOCATION>")
// Name of the package's product
product = "<PRODUCT NAME>"
// OPTIONAL PROPERTIES
// Java version (8, 9, 11, ...) used for the generated code compatibility
// Example: set compatibility with Java 8
javaVersion = 8 // (default: Java 11)
// Platform configuration including custom toolchain path
// Example: a custom path to the Android toolchain
platforms = listOf(
TargetPlatform.Android(file("<PATH TO THE TOOLCHAIN LOCATION>"))
)
// Configuration for the Scade Build Tool (scd)
// Custom binary location
scd = file("<SCD BINARY LOCATION>")
// Auto-update for the scd build tool
scdAutoUpdate = true
}
Note: both plugins only support dynamic library products
Both plugins can be published into the local Maven repository by executing
./gradlew publishAllToMavenLocal
In order to use locally installed plugins in your applications,
add the local Maven repository to the plugin management section in the Gradle settings file settings.gradle.kts
:
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
This project is licensed under the Apache 2.0 License - see the LICENSE file for details