-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.gradle.kts
131 lines (113 loc) · 3.97 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
@file:Suppress("UnstableApiUsage")
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
import kotlin.io.path.listDirectoryEntries
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
}
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://packages.jetbrains.team/maven/p/kpm/public/")
}
version = "1.6.5"
val baseName = "Kotlin Explorer"
kotlin {
jvm {
@Suppress("OPT_IN_USAGE")
mainRun {
mainClass = "dev.romainguy.kotlin.explorer.KotlinExplorerKt"
}
}
jvmToolchain {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(17)
}
sourceSets {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs) {
exclude(group = "org.jetbrains.compose.material")
}
implementation(libs.collection)
implementation(libs.compose.material3)
implementation(libs.compose.splitpane)
implementation(libs.jewel)
implementation(libs.jewel.decorated)
implementation(libs.jewel.markdown.core)
implementation(libs.jewel.markdown.intUiStandaloneStyling)
implementation(libs.jna)
implementation(libs.lifecycle)
implementation(libs.lifecycle.compose)
implementation(libs.lifecycle.viewmodel)
implementation(libs.lifecycle.viewmodel.compose)
implementation(libs.skiko.mac)
implementation(libs.rsyntaxtextarea)
implementation(libs.rstaui)
implementation(project(":token-makers"))
runtimeOnly(libs.skiko.linux)
}
}
val jvmTest by getting {
dependencies {
implementation(libs.junit4)
implementation(libs.kotlin.test)
implementation(libs.truth)
}
}
}
}
composeCompiler {
stabilityConfigurationFile = layout.projectDirectory.file("compose-stability.config")
reportsDestination = layout.buildDirectory.dir("compose-compiler")
}
compose.desktop {
application {
mainClass = "dev.romainguy.kotlin.explorer.KotlinExplorerKt"
buildTypes.release.proguard {
configurationFiles.from(project.file("compose-desktop.pro"))
}
nativeDistributions {
modules("jdk.unsupported")
targetFormats(TargetFormat.Dmg)
packageVersion = version.toString()
packageName = baseName
description = baseName
vendor = "Romain Guy"
licenseFile = rootProject.file("LICENSE")
macOS {
dockName = "Kotlin Explorer"
iconFile = file("art/app-icon/icon.icns")
bundleID = "dev.romainguy.kotlin.explorer"
}
}
}
}
val currentArch: String = when (val osArch = System.getProperty("os.arch")) {
"x86_64", "amd64" -> "x64"
"aarch64" -> "arm64"
else -> error("Unsupported OS arch: $osArch")
}
/**
* TODO: workaround for https://github.com/JetBrains/compose-multiplatform/issues/4976.
*/
val renameDmg by tasks.registering(Copy::class) {
group = "distribution"
description = "Rename the DMG file"
val packageReleaseDmg = tasks.named<AbstractJPackageTask>("packageReleaseDmg")
// build/compose/binaries/main-release/dmg/*.dmg
val fromFile = packageReleaseDmg.map { task ->
task.destinationDir.asFile.get().toPath().listDirectoryEntries("$baseName*.dmg").single()
}
from(fromFile)
into(fromFile.map { it.parent })
rename {
"kotlin-explorer-$currentArch-$version.dmg"
}
}
tasks.assemble {
dependsOn(renameDmg)
}