Skip to content

Commit

Permalink
feat: Config all modules to publish to maven with custom publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sirambd committed Jul 2, 2024
1 parent a0dbc4f commit 21a3bcf
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 51 deletions.
16 changes: 7 additions & 9 deletions Common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.infomaniak.multiplatform_swisstranfer.utils.Versions
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
Expand All @@ -7,15 +8,11 @@ plugins {
alias(libs.plugins.androidLibrary)
}

val sharedMinSdk: Int by rootProject.extra
val sharedCompileSdk: Int by rootProject.extra
val javaVersion: JavaVersion by rootProject.extra

kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(javaVersion.toString()))
jvmTarget.set(JvmTarget.fromTarget(Versions.javaVersion.toString()))
}
}

Expand All @@ -37,6 +34,7 @@ kotlin {
sourceSets {
commonMain.dependencies {
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.datetime)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
Expand All @@ -46,12 +44,12 @@ kotlin {

android {
namespace = "com.infomaniak.multiplatform_swisstransfer.common"
compileSdk = sharedCompileSdk
compileSdk = Versions.compileSdk
defaultConfig {
minSdk = sharedMinSdk
minSdk = Versions.minSdk
}
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}
}
23 changes: 12 additions & 11 deletions Core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import co.touchlab.skie.configuration.DefaultArgumentInterop
import com.infomaniak.multiplatform_swisstranfer.gradle.PublishPlugin
import com.infomaniak.multiplatform_swisstranfer.utils.Versions
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
Expand All @@ -8,18 +10,17 @@ plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.skie)
}

val sharedMinSdk: Int by rootProject.extra
val sharedCompileSdk: Int by rootProject.extra
val javaVersion: JavaVersion by rootProject.extra
val skieMaxArgumentCount: Int by rootProject.extra
apply<PublishPlugin>()

kotlin {
withSourcesJar(publish = false)
androidTarget {
withSourcesJar(publish = true)
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(javaVersion.toString()))
jvmTarget.set(JvmTarget.fromTarget(Versions.javaVersion.toString()))
}
publishLibraryVariants("release")
}

val xcframeworkName = "Core"
Expand Down Expand Up @@ -55,7 +56,7 @@ skie {
features {
group {
DefaultArgumentInterop.Enabled(true)
DefaultArgumentInterop.MaximumDefaultArgumentCount(skieMaxArgumentCount)
DefaultArgumentInterop.MaximumDefaultArgumentCount(Versions.skieMaxArgumentCount)
}
}
build {
Expand All @@ -65,12 +66,12 @@ skie {

android {
namespace = "com.infomaniak.multiplatform_swisstransfer"
compileSdk = sharedCompileSdk
compileSdk = Versions.compileSdk
defaultConfig {
minSdk = sharedMinSdk
minSdk = Versions.minSdk
}
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}
}
24 changes: 14 additions & 10 deletions DB/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import co.touchlab.skie.configuration.DefaultArgumentInterop
import com.infomaniak.multiplatform_swisstranfer.gradle.PublishExtension.Companion.publishConfig
import com.infomaniak.multiplatform_swisstranfer.gradle.PublishPlugin
import com.infomaniak.multiplatform_swisstranfer.utils.Versions
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
Expand All @@ -9,18 +12,19 @@ plugins {
alias(libs.plugins.realm)
alias(libs.plugins.skie)
}
apply<PublishPlugin>()

val sharedMinSdk: Int by rootProject.extra
val sharedCompileSdk: Int by rootProject.extra
val javaVersion: JavaVersion by rootProject.extra
val skieMaxArgumentCount: Int by rootProject.extra
publishConfig {
mavenName = "database"
}

kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(javaVersion.toString()))
jvmTarget.set(JvmTarget.fromTarget(Versions.javaVersion.toString()))
}
publishLibraryVariants("release")
}

val xcframeworkName = "DB"
Expand Down Expand Up @@ -55,7 +59,7 @@ skie {
features {
group {
DefaultArgumentInterop.Enabled(true)
DefaultArgumentInterop.MaximumDefaultArgumentCount(skieMaxArgumentCount)
DefaultArgumentInterop.MaximumDefaultArgumentCount(Versions.skieMaxArgumentCount)
}
}
build {
Expand All @@ -65,12 +69,12 @@ skie {

android {
namespace = "com.infomaniak.multiplatform_swisstransfer.db"
compileSdk = sharedCompileSdk
compileSdk = Versions.compileSdk
defaultConfig {
minSdk = sharedMinSdk
minSdk = Versions.minSdk
}
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}
}
21 changes: 10 additions & 11 deletions Network/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import co.touchlab.skie.configuration.DefaultArgumentInterop
import com.infomaniak.multiplatform_swisstranfer.gradle.PublishPlugin
import com.infomaniak.multiplatform_swisstranfer.utils.Versions
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
Expand All @@ -9,18 +11,15 @@ plugins {
kotlin("plugin.serialization") version libs.versions.kotlin
alias(libs.plugins.skie)
}

val sharedMinSdk: Int by rootProject.extra
val sharedCompileSdk: Int by rootProject.extra
val javaVersion: JavaVersion by rootProject.extra
val skieMaxArgumentCount: Int by rootProject.extra
apply<PublishPlugin>()

kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(javaVersion.toString()))
jvmTarget.set(JvmTarget.fromTarget(Versions.javaVersion.toString()))
}
publishLibraryVariants("release")
}

val xcframeworkName = "Network"
Expand Down Expand Up @@ -65,7 +64,7 @@ skie {
features {
group {
DefaultArgumentInterop.Enabled(true)
DefaultArgumentInterop.MaximumDefaultArgumentCount(skieMaxArgumentCount)
DefaultArgumentInterop.MaximumDefaultArgumentCount(Versions.skieMaxArgumentCount)
}
}
build {
Expand All @@ -75,12 +74,12 @@ skie {

android {
namespace = "com.infomaniak.multiplatform_swisstransfer.network"
compileSdk = sharedCompileSdk
compileSdk = Versions.compileSdk
defaultConfig {
minSdk = sharedMinSdk
minSdk = Versions.minSdk
}
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}
}
9 changes: 0 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
buildscript {
extra.apply {
set("sharedMinSdk", 24)
set("sharedCompileSdk", 34)
set("javaVersion", JavaVersion.VERSION_17)
set("skieMaxArgumentCount", 7)
}
}

plugins {
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
Expand Down
7 changes: 6 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[versions]
agp = "8.4.1"
agp = "8.4.2"
coroutines = "1.8.1"
kotlin = "2.0.0"
kotlinxDatetime = "0.6.0"
kotlinxSerializationJson = "1.7.0"
ktor = "2.3.11"
realm = "2.0.0"
Expand All @@ -10,9 +11,13 @@ skie = "0.8.2"
[libraries]
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
ktor-client-content-negociation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-client-encoding = { module = "io.ktor:ktor-client-encoding", version.ref = "ktor" }
ktor-client-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
realm-base = { module = "io.realm.kotlin:library-base", version.ref = "realm" }
#Test
Expand Down

0 comments on commit 21a3bcf

Please sign in to comment.