-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathbuild.gradle.kts
91 lines (76 loc) · 2.77 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
/*
* Copyright (C) 2024 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* https://github.com/open-ani/ani/blob/main/LICENSE
*/
import java.util.Properties
/*
* Copyright (C) 2024 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* https://github.com/open-ani/ani/blob/main/LICENSE
*/
plugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
google()
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") // Compose Multiplatform pre-release versions
}
kotlin {
jvmToolchain {
this.vendor.set(getPropertyOrNull("jvm.toolchain.vendor")?.let { JvmVendorSpec.matching(it) })
this.languageVersion = getPropertyOrNull("jvm.toolchain.version")?.let { JavaLanguageVersion.of(it) }
}
compilerOptions {
optIn.add("org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi")
}
}
dependencies {
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.okhttp)
}
dependencies {
api(gradleApi())
api(gradleKotlinDsl())
api(libs.kotlin.gradle.plugin) {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
exclude("org.jetbrains.kotlin", "kotlin-reflect")
}
api(libs.android.gradle.plugin)
api(libs.atomicfu.gradle.plugin)
api(libs.android.application.gradle.plugin)
api(libs.android.library.gradle.plugin)
api(libs.compose.multiplatfrom.gradle.plugin)
api(libs.kotlin.compose.compiler.gradle.plugin)
implementation(kotlin("script-runtime"))
implementation(libs.snakeyaml)
}
fun Project.getPropertyOrNull(name: String) =
getLocalProperty(name)
?: System.getProperty(name)
?: System.getenv(name)
?: findProperty(name)?.toString()
?: properties[name]?.toString()
?: extensions.extraProperties.runCatching { get(name).toString() }.getOrNull()
val Project.localPropertiesFile: File get() = project.rootProject.file("local.properties")
fun Project.getLocalProperty(key: String): String? {
return if (localPropertiesFile.exists()) {
val properties = Properties()
localPropertiesFile.inputStream().buffered().use { input ->
properties.load(input)
}
properties.getProperty(key)
} else {
localPropertiesFile.createNewFile()
null
}
}