2021-03-18 19:11:45 +01:00
|
|
|
/*
|
|
|
|
* * Copyright (c) 2021 Shabinder Singh
|
|
|
|
* * This program is free software: you can redistribute it and/or modify
|
|
|
|
* * it under the terms of the GNU General Public License as published by
|
|
|
|
* * the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* * (at your option) any later version.
|
|
|
|
* *
|
|
|
|
* * This program is distributed in the hope that it will be useful,
|
|
|
|
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* * GNU General Public License for more details.
|
|
|
|
* *
|
|
|
|
* * You should have received a copy of the GNU General Public License
|
|
|
|
* * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-01-26 13:54:28 +01:00
|
|
|
plugins {
|
2021-03-06 18:33:05 +01:00
|
|
|
id("multiplatform-setup")
|
2021-01-26 13:54:28 +01:00
|
|
|
id("android-setup")
|
2021-02-08 21:05:40 +01:00
|
|
|
id("kotlin-parcelize")
|
2021-01-26 13:54:28 +01:00
|
|
|
}
|
|
|
|
|
2021-05-01 20:00:59 +02:00
|
|
|
fun org.jetbrains.kotlin.gradle.dsl.KotlinNativeBinaryContainer.generateFramework() {
|
|
|
|
framework {
|
|
|
|
baseName = "SpotiFlyer"
|
|
|
|
linkerOpts.add("-lsqlite3")
|
|
|
|
export(project(":common:dependency-injection"))
|
|
|
|
export(project(":common:data-models"))
|
|
|
|
export(project(":common:database"))
|
|
|
|
export(project(":common:main"))
|
|
|
|
export(project(":common:list"))
|
|
|
|
export(Decompose.decompose)
|
|
|
|
export(MVIKotlin.mvikotlinMain)
|
|
|
|
export(MVIKotlin.mvikotlinLogging)
|
|
|
|
}
|
|
|
|
}
|
2021-04-29 22:14:51 +02:00
|
|
|
|
2021-01-26 13:54:28 +01:00
|
|
|
kotlin {
|
2021-04-29 22:14:51 +02:00
|
|
|
|
|
|
|
/*IOS Target Can be only built on Mac*/
|
2021-05-01 20:00:59 +02:00
|
|
|
if(HostOS.isMac) {
|
2021-04-29 22:14:51 +02:00
|
|
|
val sdkName: String? = System.getenv("SDK_NAME")
|
|
|
|
val isiOSDevice = sdkName.orEmpty().startsWith("iphoneos")
|
|
|
|
if (isiOSDevice) {
|
|
|
|
iosArm64("ios"){
|
|
|
|
binaries {
|
2021-05-01 20:00:59 +02:00
|
|
|
generateFramework()
|
2021-04-29 22:14:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
iosX64("ios"){
|
|
|
|
binaries {
|
2021-05-01 20:00:59 +02:00
|
|
|
generateFramework()
|
2021-04-29 22:14:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-26 13:54:28 +01:00
|
|
|
sourceSets {
|
2021-01-26 20:58:11 +01:00
|
|
|
commonMain {
|
2021-01-26 13:54:28 +01:00
|
|
|
dependencies {
|
2021-01-31 12:33:41 +01:00
|
|
|
implementation(project(":common:dependency-injection"))
|
|
|
|
implementation(project(":common:data-models"))
|
|
|
|
implementation(project(":common:database"))
|
2021-02-25 14:28:33 +01:00
|
|
|
implementation(project(":common:list"))
|
|
|
|
implementation(project(":common:main"))
|
2021-02-01 17:33:30 +01:00
|
|
|
implementation(SqlDelight.coroutineExtensions)
|
2021-01-26 13:54:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-08 19:50:49 +02:00
|
|
|
if(HostOS.isMac){
|
|
|
|
/*Required to Export `packForXcode`*/
|
|
|
|
sourceSets {
|
|
|
|
named("iosMain") {
|
|
|
|
dependencies {
|
|
|
|
api(project(":common:dependency-injection"))
|
|
|
|
api(project(":common:data-models"))
|
|
|
|
api(project(":common:database"))
|
|
|
|
api(project(":common:list"))
|
|
|
|
api(project(":common:main"))
|
|
|
|
api(Decompose.decompose)
|
|
|
|
api(MVIKotlin.mvikotlinMain)
|
|
|
|
api(MVIKotlin.mvikotlinLogging)
|
|
|
|
}
|
2021-04-29 22:14:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val packForXcode by tasks.creating(Sync::class) {
|
2021-05-08 19:50:49 +02:00
|
|
|
if(HostOS.isMac){
|
|
|
|
group = "build"
|
|
|
|
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
|
|
|
|
val targetName = "ios"
|
|
|
|
val framework = kotlin.targets.getByName<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>(targetName)
|
|
|
|
.binaries.getFramework(mode)
|
|
|
|
inputs.property("mode", mode)
|
|
|
|
dependsOn(framework.linkTask)
|
|
|
|
val targetDir = File(buildDir, "xcode-frameworks")
|
|
|
|
from(framework.outputDirectory)
|
|
|
|
into(targetDir)
|
|
|
|
}
|
2021-02-14 00:46:59 +01:00
|
|
|
}
|