-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.gradle.kts
144 lines (126 loc) · 4.5 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.Instant
import java.time.ZoneId
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
plugins {
application
alias(libs.plugins.kotlin)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.compose)
alias(libs.plugins.detekt)
alias(libs.plugins.shadow)
alias(libs.plugins.licenseReport)
alias(libs.plugins.dependencyAnalysis)
alias(libs.plugins.versions)
}
repositories {
mavenCentral()
maven(url = "https://maven.ej-technologies.com/repository")
maven(url = "https://repo.spongepowered.org/repository/maven-public")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}
application {
mainClass.set("org.wysko.midis2jam2.MainKt")
}
kotlin {
jvmToolchain(17)
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn", "-Xcontext-receivers")
}
}
tasks.processResources {
dependsOn(tasks.getByName("downloadLicenses"))
doFirst {
val gitHash = System.getenv("GIT_HASH")
val buildTime = DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneId.from(ZoneOffset.UTC)).format(Instant.now())
File(projectDir, "src/main/resources/build.txt").writeText("$buildTime${gitHash?.let { " $it" } ?: ""}")
println("Build time: $buildTime")
copy {
from("build/reports/license/dependency-license.json")
into("src/main/resources")
}
val midis2jam2Version: String by project
File(projectDir, "src/main/resources/version.txt").writeText(midis2jam2Version)
}
}
dependencies {
// JMonkeyEngine
implementation(libs.bundles.jme3)
// Compose Multiplatform
if (project.ext.has("targetplatform")) {
when (project.ext["targetplatform"]) {
"windows" -> {
implementation(compose.desktop.windows_x64)
implementation(libs.jme3.lwjgl3)
}
"macos_x64" -> {
implementation(compose.desktop.macos_x64)
implementation(libs.jme3.lwjgl)
}
"macos_arm64" -> {
implementation(compose.desktop.macos_arm64)
implementation(libs.jme3.lwjgl)
}
"linux_x64" -> {
implementation(compose.desktop.linux_x64)
implementation(libs.jme3.lwjgl3)
}
"linux_arm64" -> {
implementation(compose.desktop.linux_arm64)
implementation(libs.jme3.lwjgl3)
}
else -> {
println("Unknown target platform: ${project.properties["targetplatform"]}, reverting to default")
implementation(compose.desktop.currentOs)
implementation(libs.jme3.lwjgl3)
}
}
println("used platform: ${project.properties["targetplatform"]}")
} else {
println("used platform: current")
implementation(compose.desktop.currentOs)
implementation(libs.jme3.lwjgl3)
}
implementation(compose.material3)
implementation(libs.mpfilepicker)
implementation(libs.install4j.runtime)
implementation(libs.noise)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlin.reflect)
implementation(libs.logback.classic)
implementation(libs.kmidi)
implementation(files("libs/Gervill-0.2.31.jar", "libs/jme-ttf-2.2.2.jar"))
}
tasks.withType<ShadowJar> {
archiveFileName.set(
"midis2jam2-${
if (project.hasProperty("targetplatform")) {
when (project.properties["targetplatform"]) {
"windows" -> "windows"
"macos_x64" -> "macos_x64"
"macos_arm64" -> "macos_arm64"
"linux_x64" -> "linux_x64"
"linux_arm64" -> "linux_arm64"
else -> {
println(
"Unknown target platform: ${project.properties["targetplatform"]}, reverting to default",
)
"current"
}
}
} else {
"current"
}
}-${project.properties["midis2jam2Version"]}.jar",
)
}
detekt { config.setFrom(files("detekt-config.yml")) }
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = "compileClasspath"
}