-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
94 lines (74 loc) · 2.47 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
94 lines (74 loc) · 2.47 KB
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import proguard.gradle.ProGuardTask
version = "1.0-SNAPSHOT"
buildscript {
dependencies {
classpath("com.guardsquare:proguard-gradle:7.0.0")
}
}
plugins {
idea
application
kotlin("jvm") version "1.4.10"
id("org.jlleitschuh.gradle.ktlint") version "9.4.0"
}
application {
mainClassName = "com.xhstormr.app.MainKt"
}
repositories {
maven("https://mirrors.huaweicloud.com/repository/maven")
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("com.github.ajalt:clikt:+")
compileOnly("org.apache.tomcat.embed:tomcat-embed-core:9.+")
implementation("org.apache.commons:commons-collections4:4.0")
implementation("commons-beanutils:commons-beanutils:1.9.2")
}
tasks {
val exe by creating(JavaExec::class) {
buildDir.resolve("bin").mkdirs()
val launch4jJar = "${ext["launch4j_home"]}/launch4j.jar"
val launch4jCfg = "$rootDir/assets/config.xml"
classpath = files(launch4jJar)
args = listOf(launch4jCfg)
}
val proguard by creating(ProGuardTask::class) {
val file = jar.get().archiveFile.get().asFile
injars(file)
outjars(file.resolveSibling("${file.nameWithoutExtension}-min.jar"))
configuration("proguard/proguard-rules.pro")
libraryjars("${System.getProperty("java.home")}/lib/rt.jar")
libraryjars("${System.getProperty("java.home")}/jmods/")
}
withType<Jar> {
manifest.attributes["Main-Class"] = application.mainClassName
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get().map { zipTree(it) })
exclude("**/*.kotlin_module")
exclude("**/*.kotlin_metadata")
exclude("**/*.kotlin_builtins")
}
withType<Wrapper> {
gradleVersion = "6.6"
distributionType = Wrapper.DistributionType.ALL
}
withType<Test> {
useJUnitPlatform()
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=enable")
}
}
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.isFork = true
options.isIncremental = true
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
proguard.dependsOn(jar)
exe.dependsOn(proguard)
}