forked from jeffdgr8/kotbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase-convention.gradle.kts
More file actions
110 lines (101 loc) · 3.69 KB
/
base-convention.gradle.kts
File metadata and controls
110 lines (101 loc) · 3.69 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.target.Family
import rules.applyCouchbaseLiteRule
plugins {
`kotlin-multiplatform`
`kotlin-native-cocoapods`
`android-library`
org.jetbrains.kotlinx.atomicfu
}
kotlin {
cocoapods {
version = project.version.toString()
homepage = "https://kotbase.dev/"
source = "{ :git => 'https://github.com/jeffdgr8/kotbase.git', :tag => $version }"
authors = "Jeff Lockhart"
license = "Apache License, Version 2.0"
afterEvaluate { summary = description }
ios.deploymentTarget = "12.0"
osx.deploymentTarget = "12.0"
noPodspec()
}
compilerOptions.freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
"-Xdont-warn-on-error-suppression"
)
sourceSets.configureEach {
languageSettings {
optIn("kotlin.time.ExperimentalTime")
if (!name.startsWith("common") &&
!name.startsWith("jvm") &&
!name.startsWith("android")
) {
optIn("kotlinx.cinterop.BetaInteropApi")
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
}
targets.withType<KotlinNativeTarget>().configureEach {
if (konanTarget.family.isAppleFamily) {
// Run Apple tests on background thread with main run loop
binaries.withType<TestExecutable>().configureEach {
freeCompilerArgs += listOf("-e", "kotbase.test.mainBackground")
}
}
if (konanTarget.family != Family.MINGW) {
binaries.configureEach {
binaryOptions["sourceInfoType"] = "libbacktrace"
}
}
binaries.getTest(DEBUG).linkTaskProvider.configure {
doLast {
val outputDir = outputFile.get().parentFile
projectDir.resolve("src/commonTest/resources").listFiles()?.forEach { file ->
file.copyRecursively(outputDir.resolve(file.name), overwrite = true)
}
}
}
}
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)
}
android {
compileSdk = 36
defaultConfig {
minSdk = 22
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
testOptions {
targetSdk = 36
}
// required by coroutines 1.7.0+ to avoid errors:
// 6 files found with path 'META-INF/LICENSE.md'.
packaging.resources.pickFirsts += "META-INF/**"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
dependencies {
components {
applyCouchbaseLiteRule("com.couchbase.lite:couchbase-lite-java", "com.couchbase.lite:couchbase-lite-android")
applyCouchbaseLiteRule("com.couchbase.lite:couchbase-lite-java-ee", "com.couchbase.lite:couchbase-lite-android-ee")
}
}
// work around native compiler and linker warnings in tests
// duplicate library name: org.jetbrains.kotlinx:kotlinx-serialization-core
// https://youtrack.jetbrains.com/issue/KT-51110
// (leave off by default, enable to avoid warnings)
/*
configurations.configureEach {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlinx" && requested.name == "kotlinx-serialization-core") {
val libs = the<org.gradle.accessors.dm.LibrariesForLibs>()
useVersion(libs.versions.kotlinx.serialization.get())
}
}
}//*/