-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle.kts
132 lines (109 loc) · 4.52 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
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
id("org.jetbrains.kotlin.plugin.compose") version "2.0.20"
id("com.github.gmazzo.buildconfig") version "5.4.0"
}
val appVersion = "1.0.4"
val isProVersion = true
group = "cn.netdiscovery.monica"
version = appVersion
val mOutputDir = project.buildDir.resolve("output")
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven( "https://jitpack.io" )
}
val osName = System.getProperty("os.name")
val targetOs = when {
osName == "Mac OS X" -> "macos"
osName.startsWith("Win") -> "windows"
osName.startsWith("Linux") -> "linux"
else -> error("Unsupported OS: $osName")
}
val osArch = System.getProperty("os.arch")
var targetArch = when (osArch) {
"x86_64", "amd64" -> "x64"
"aarch64" -> "arm64"
else -> error("Unsupported arch: $osArch")
}
val skikoVersion = "0.8.4"
val target = "${targetOs}-${targetArch}"
buildConfig {
useKotlinOutput { topLevelConstants = true }
useKotlinOutput { internalVisibility = false } // adds `internal` modifier to all declarations
buildConfigField("APP_NAME", project.name)
buildConfigField("APP_VERSION", appVersion)
buildConfigField("KOTLIN_VERSION", "${rootProject.extra["kotlin.version"]}")
buildConfigField("COMPOSE_VERSION", "${rootProject.extra["compose.version"]}")
buildConfigField("IS_PRO_VERSION", isProVersion)
buildConfigField("BUILD_TIME", System.currentTimeMillis())
}
kotlin {
jvm {
withJava()
}
sourceSets {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
// skiko
implementation("org.jetbrains.skiko:skiko-awt-runtime-$target:$skikoVersion")
// 缓存
implementation("com.github.fengzhizi715.RxCache:core:${rootProject.extra["rxcache"]}")
implementation("com.github.fengzhizi715.RxCache:okio:${rootProject.extra["rxcache"]}")
implementation("com.github.fengzhizi715.RxCache:extension:${rootProject.extra["rxcache"]}")
// di
implementation("io.insert-koin:koin-compose:${rootProject.extra["koin.compose"]}")
// color math
implementation("com.github.ajalt.colormath:colormath-ext-jetpack-compose:${rootProject.extra["colormath"]}")
// coroutines utils
implementation ("com.github.fengzhizi715.Kotlin-Coroutines-Utils:common:${rootProject.extra["coroutines.utils"]}")
// log config
implementation("ch.qos.logback:logback-classic:${rootProject.extra["logback"]}")
implementation("ch.qos.logback:logback-core:${rootProject.extra["logback"]}")
implementation("ch.qos.logback:logback-access:${rootProject.extra["logback"]}")
}
}
val jvmTest by getting
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
compose.desktop {
application {
mainClass = "MainKt"
buildTypes.release.proguard {
configurationFiles.from(project.file("compose-desktop.pro"))
}
nativeDistributions {
outputBaseDir.set(mOutputDir) //build/output
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Exe, TargetFormat.Deb)
appResourcesRootDir.set(project.layout.projectDirectory.dir("resources"))
packageName = "Monica"
packageVersion = appVersion
description = "Monica is a cross-platform image editor"
copyright = "© 2024 Tony Shen. All rights reserved."
jvmArgs += listOf("-Xms4G","-Xmx4G")
includeAllModules = true //包含所有模块
macOS {
bundleID = "cn.netdiscovery.monica"
dockName = "monica"
}
windows {
console = false // 为应用程序添加一个控制台启动器
shortcut = true // 桌面快捷方式
dirChooser = true // 允许在安装过程中自定义安装路径
perUserInstall = false //允许在每个用户的基础上安装应用程序
menuGroup = "start-menu-group"
upgradeUuid = "b329caf3-6681-49b9-98d0-adb34d32e130"
iconFile.set(project.file("src/jvmMain/resources/images/launcher.ico"))
}
}
}
}