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 {
|
|
|
|
id("android-setup")
|
2021-05-20 18:07:54 +02:00
|
|
|
id("multiplatform-setup")
|
|
|
|
id("multiplatform-setup-test")
|
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"))
|
2021-08-23 19:16:20 +02:00
|
|
|
export(project(":common:core-components"))
|
|
|
|
export(project(":common:providers"))
|
2021-05-01 20:00:59 +02:00
|
|
|
export(project(":common:list"))
|
2021-07-10 22:14:27 +02:00
|
|
|
export(project(":common:preference"))
|
2021-09-30 19:16:43 +02:00
|
|
|
with(deps) {
|
|
|
|
export(decompose.dep)
|
|
|
|
export(bundles.mviKotlin)
|
|
|
|
}
|
2021-05-01 20:00:59 +02:00
|
|
|
}
|
|
|
|
}
|
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-18 16:32:33 +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) {
|
2021-05-18 16:32:33 +02:00
|
|
|
iosArm64("ios") {
|
2021-04-29 22:14:51 +02:00
|
|
|
binaries {
|
2021-05-01 20:00:59 +02:00
|
|
|
generateFramework()
|
2021-04-29 22:14:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2021-05-18 16:32:33 +02:00
|
|
|
iosX64("ios") {
|
2021-04-29 22:14:51 +02:00
|
|
|
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-08-23 19:16:20 +02:00
|
|
|
implementation(project(":common:providers"))
|
|
|
|
implementation(project(":common:core-components"))
|
2021-07-10 22:14:27 +02:00
|
|
|
implementation(project(":common:preference"))
|
2021-01-26 13:54:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-18 16:32:33 +02:00
|
|
|
if (HostOS.isMac) {
|
2021-05-08 19:50:49 +02:00
|
|
|
/*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"))
|
2021-07-10 22:14:27 +02:00
|
|
|
api(project(":common:preference"))
|
2021-09-30 19:16:43 +02:00
|
|
|
with(deps) {
|
|
|
|
api(decompose.dep)
|
|
|
|
api(bundles.mviKotlin)
|
|
|
|
}
|
2021-05-08 19:50:49 +02:00
|
|
|
}
|
2021-04-29 22:14:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val packForXcode by tasks.creating(Sync::class) {
|
2021-05-18 16:32:33 +02:00
|
|
|
if (HostOS.isMac) {
|
2021-05-08 19:50:49 +02:00
|
|
|
group = "build"
|
|
|
|
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
|
|
|
|
val targetName = "ios"
|
2021-09-30 19:16:43 +02:00
|
|
|
val framework =
|
|
|
|
kotlin.targets.getByName<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>(
|
|
|
|
targetName
|
|
|
|
)
|
|
|
|
.binaries.getFramework(mode)
|
2021-05-08 19:50:49 +02:00
|
|
|
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
|
|
|
}
|