-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
93 lines (82 loc) · 3.25 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
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("jvm")
id("org.jetbrains.compose")
id("org.jetbrains.kotlin.plugin.compose")
}
group = "top.ntutn"
version = "1.0-SNAPSHOT"
tasks.register("buildGuidePdf") {
val mdFile = project.file("docs/guide/Guide.md")
val generatedResources = project.file("build/generated/resources")
val guideDir = File(generatedResources, "guide")
val outputFile = File(guideDir, "Guide.pdf")
doLast {
if (mdFile.exists().not()) {
logger.log(LogLevel.WARN, "mdFile not exist, please create $mdFile.")
} else if (outputFile.exists() && outputFile.lastModified() > mdFile.lastModified()) {
logger.log(LogLevel.INFO, "Guide.pdf is UPDATE TO DATE.")
} else {
logger.log(LogLevel.INFO, "Guide.pdf not found, generating it.")
generatedResources.deleteRecursively()
generatedResources.mkdirs()
guideDir.mkdirs()
val command = arrayOf("pandoc", mdFile.absolutePath, "-o" , outputFile.absolutePath, "--pdf-engine=xelatex", "-V", "CJKmainfont=KaiTi")
println(command.joinToString(" "))
val process = ProcessBuilder(*command)
.directory(mdFile.parentFile)
.start()
process.waitFor()
process.inputStream.readAllBytes().decodeToString().let(::println)
process.errorStream.readAllBytes().decodeToString().let(::println)
}
}
}
tasks.withType<ProcessResources> {
dependsOn(":buildGuidePdf")
}
repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://jitpack.io")
google()
}
dependencies {
// Note, if you develop a library, you should use compose.desktop.common.
// compose.desktop.currentOs should be used in launcher-sourceSet
// (in a separate module for demo project and in testMain).
// With compose.desktop.common you will also lose @Preview functionality
implementation(compose.desktop.currentOs)
// https://mvnrepository.com/artifact/net.java.dev.jna/jna
implementation("net.java.dev.jna:jna:5.14.0")
// https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform
implementation("net.java.dev.jna:jna-platform:5.14.0")
implementation("com.github.qurben:jico:v2.2.0")
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation("commons-io:commons-io:2.16.1")
}
sourceSets {
main {
resources {
srcDirs( "build/generated/resources")
}
}
}
compose.desktop {
application {
mainClass = "top.ntutn.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Msi, TargetFormat.Exe)
packageVersion = "1.4.1"
description = "A simple Windows desktop workspace manager."
windows {
packageName = "top_ntutn_ZDesktopManager"
dirChooser = true
menuGroup = "ntutn"
upgradeUuid = "a2fde22b-ec5f-49e4-b63f-a4235ef4848c" // generate with https://www.guidgen.com
// licenseFile.set(project.file("LICENSE.txt")) // 不能显示中文
iconFile.set(project.file("icon.ico"))
}
}
}
}