-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
95 lines (79 loc) · 2.64 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
plugins {
kotlin("multiplatform") version "1.5.21"
id("maven-publish")
}
val libraryVersion = "0.5.20"
group = "com.yesferal.hornsapp.core"
version = libraryVersion
// Libraries
val mockitoVersion = "4.0.0"
repositories {
mavenCentral()
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnit()
}
}
sourceSets {
sourceSets["commonMain"].dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1")
}
sourceSets["jvmTest"].dependencies {
implementation("junit:junit:4.13.2")
implementation("org.mockito:mockito-core:$mockitoVersion")
implementation("org.mockito:mockito-inline:$mockitoVersion")
}
}
val libraryName = "HornsAppCore"
// Simulator Architecture
val iosX64 = iosX64()
// Device Architecture
val iosArm64 = iosArm64()
configure(listOf(iosX64, iosArm64)) {
binaries.framework {
baseName = libraryName
}
}
tasks.register("buildReleaseXCFramework", Exec::class.java) {
description = "Create a Release XCFramework"
dependsOn("linkReleaseFrameworkIosArm64")
dependsOn("linkReleaseFrameworkIosX64")
val arm64FrameworkPath = "$rootDir/build/bin/iosArm64/releaseFramework/${libraryName}.framework"
val arm64ReleaseSymbolsPath = "$rootDir/build/bin/iosArm64/releaseFramework/${libraryName}.framework.dSYM"
val x64FrameworkPath = "$rootDir/build/bin/iosX64/releaseFramework/${libraryName}.framework"
val x64ReleaseSymbolsPath = "$rootDir/build/bin/iosX64/releaseFramework/${libraryName}.framework.dSYM"
val xcFrameworkDest = File("$rootDir/build/bin/xcframework/releaseFramework/$libraryName.xcframework")
executable = "xcodebuild"
args(mutableListOf<String>().apply {
add("-create-xcframework")
add("-output")
add(xcFrameworkDest.path)
// Real Device
add("-framework")
add(arm64FrameworkPath)
add("-debug-symbols")
add(arm64ReleaseSymbolsPath)
// Simulator
add("-framework")
add(x64FrameworkPath)
add("-debug-symbols")
add(x64ReleaseSymbolsPath)
})
doFirst {
xcFrameworkDest.deleteRecursively()
}
}
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
artifact(tasks["sourcesJar"])
version = libraryVersion
}
}
}