-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle.kts
89 lines (84 loc) · 2.72 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
import org.jetbrains.compose.ComposePlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@Suppress("DSL_SCOPE_VIOLATION")
plugins { libs.run {
val apply = true
plugins.run {
arrayOf(
org.jetbrains.kotlin.jvm to apply.not(),
me.heizi.gradle.controller.version to apply,
org.jetbrains.compose to apply,
com.github.ben.manes.versions to apply,
com.github.johnrengelman.shadow to apply.not(),
nl.littlerobots.version.catalog.update to apply,
).forEach { (dependent,enabled) ->
alias(dependent) apply enabled
}
}
} }
// defined the info of the project
allprojects {
version = rootProject.libs.versions.heizi.flash.tools.get()
group = when (this.projectDir.toPath().parent.fileName.toString()) {
"libs" -> "me.heizi.kotlinx"
else -> "me.heizi.flashing_tool"
}
repositories {
mavenCentral()
google()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
maven { url = uri("https://raw.githubusercontent.com/ElisaMin/Maven/master/")}
mavenLocal()
}
}
// config shadow jar
allprojects {
apply (plugin = "com.github.johnrengelman.shadow")
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
// minimize()
manifest.attributes["Manifest-Version"] = rootProject.version
}
}
// config kotlin
allprojects {
apply (plugin = "org.jetbrains.kotlin.jvm")
configure<KotlinProjectExtension> {
jvmToolchain(19)
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn", "-Xcontext-receivers", "-Xskip-prerelease-check")
}
}
}
// debug sources set
allprojects {
apply (plugin = "org.jetbrains.kotlin.jvm")
configure<SourceSetContainer> {
val main by getting
create("debug") {
compileClasspath+=(main.compileClasspath+main.output)
runtimeClasspath+=(main.runtimeClasspath+main.output)
resources+main.resources
}
}
configure<JavaPluginExtension> {
registerFeature("debug") {
usingSourceSet(sourceSets["debug"])
disablePublication()
}
}
}
// config compose
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
subprojects {
apply(plugin ="org.jetbrains.compose")
with(ComposePlugin.Dependencies(this)) {
ext["composeDependencies"] = arrayOf(material3, desktop.currentOs)
}
}
versionCatalogUpdate {
catalogFile.set(rootProject.file("gradle/libs.versions.toml"))
}
tasks.getByName("build").dependsOn("clean")