forked from hectorqin/reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
231 lines (199 loc) · 7.43 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
import org.openjfx.gradle.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.lang.reflect.*
import io.github.fvarrui.javapackager.model.Platform
import io.github.fvarrui.javapackager.model.WindowsConfig
import de.undercouch.gradle.tasks.download.Download
buildscript {
val kotlin_version: String by extra{"1.5.21"}
// extra["kotlin_version"] = "1.5.21"
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
classpath("io.github.fvarrui:javapackager:1.6.5")
}
}
plugins {
id("org.springframework.boot") version "2.1.6.RELEASE"
id("java")
id("application")
id("org.openjfx.javafxplugin") version "0.0.9"
id("org.jetbrains.kotlin.plugin.spring") version "1.3.61"
}
configure<JavaFXOptions> {
version = "11.0.2"
modules = listOf("javafx.web")
// Set JAVAFX_PLATFORM to "linux", "win", or "mac"
val javafxPlatformOverride = System.getenv("JAVAFX_PLATFORM")
if (javafxPlatformOverride != null) {
val javafxPlatform: JavaFXPlatform = JavaFXPlatform.values()
.firstOrNull { it.classifier == javafxPlatformOverride }
?: throw IllegalArgumentException("JAVAFX_PLATFORM $javafxPlatformOverride not in list:" +
" ${JavaFXPlatform.values().map { it.classifier }}")
logger.info("Overriding JavaFX platform to {}", javafxPlatform)
// Override the private platform field
val platformField: Field = JavaFXOptions::class.java.getDeclaredField("platform")
platformField.isAccessible = true
platformField.set(this, javafxPlatform)
// Invoke the private updateJavaFXDependencies() method
val updateDeps: Method = JavaFXOptions::class.java.getDeclaredMethod("updateJavaFXDependencies")
updateDeps.isAccessible = true
updateDeps.invoke(this)
}
}
apply(plugin = "io.spring.dependency-management")
apply(plugin = "kotlin")
apply(plugin = "io.github.fvarrui.javapackager.plugin")
group = "com.htmake"
version = "2.5.4"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
maven("https://jitpack.io")
maven("https://gitlab.com/api/v4/projects/26729549/packages/maven")
google()
jcenter()
}
val compileOnly by configurations.getting {
extendsFrom(configurations["annotationProcessor"])
}
dependencies {
val kotlin_version: String by extra{"1.5.21"}
// val kotlin_version: String by extra
implementation("org.springframework.boot:spring-boot-starter")
testImplementation("org.springframework.boot:spring-boot-starter-test")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
// vertx
implementation("io.vertx:vertx-core:3.8.1")
implementation("io.vertx:vertx-lang-kotlin:3.8.1")
implementation("io.vertx:vertx-lang-kotlin-coroutines:3.8.1")
implementation("io.vertx:vertx-web:3.8.1")
implementation("io.vertx:vertx-web-client:3.8.1")
// json
implementation("com.google.code.gson:gson:2.8.5")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.+")
// log
implementation("io.github.microutils:kotlin-logging:1.6.24")
implementation("uk.org.lidalia:sysout-over-slf4j:1.0.2")
implementation("com.google.guava:guava:28.0-jre")
// 网络
implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation("com.squareup.okhttp3:logging-interceptor:4.1.0")
// Retrofit
implementation("com.squareup.retrofit2:retrofit:2.6.1")
implementation("com.julienviet:retrofit-vertx:1.1.3")
//JS rhino
// implementation("com.github.gedoor:rhino-android:1.6")
implementation(fileTree("src/lib").include("rhino-*.jar"))
// 规则相关
implementation("org.jsoup:jsoup:1.14.1")
implementation("cn.wanghaomiao:JsoupXpath:2.5.0")
implementation("com.jayway.jsonpath:json-path:2.6.0")
// xml
// 弃用 xmlpull-1.1.4.0,因为它需要 Java9
// implementation("org.xmlpull:xmlpull:1.1.4.0")
implementation(fileTree("src/lib").include("xmlpull-*.jar"))
// implementation("com.github.stefanhaustein:kxml2:2.5.0")
//加解密类库
implementation("cn.hutool:hutool-crypto:5.8.0.M1")
// 转换繁体
// implementation("com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.1")
}
// val compileKotlin: KotlinCompile by tasks
// val compileTestKotlin: KotlinCompile by tasks
// compileKotlin.kotlinOptions {
// jvmTarget = "1.8"
// }
// compileTestKotlin.kotlinOptions {
// jvmTarget = "1.8"
// }
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
application {
// Define the main class for the application
mainClassName = "com.htmake.reader.ReaderUIApplicationKt"
}
tasks.create<io.github.fvarrui.javapackager.gradle.PackageTask>("buildReader"){
dependsOn("build")
// mandatory
mainClass = "com.htmake.reader.ReaderUIApplicationKt"
// optional
setBundleJre(false)
vmArgs = arrayListOf<String>("-Dreader.app.showUI=true", "-Dspring.profiles.active=prod", "-Dreader.app.packaged=true", "-Dreader.app.debug=true")
}
tasks.create<io.github.fvarrui.javapackager.gradle.PackageTask>("packageReaderMac") {
dependsOn("build")
// mandatory
mainClass = "com.htmake.reader.ReaderUIApplicationKt"
// optional
setBundleJre(false)
// bundleJre = false
// setCreateZipball(true)
platform = Platform.mac
vmArgs = arrayListOf<String>("-Dreader.app.showUI=true", "-Dspring.profiles.active=prod", "-Dreader.app.packaged=true", "-Dreader.app.debug=false", "-Dlogging.path=\$HOME/.reader/logs")
}
tasks.create<io.github.fvarrui.javapackager.gradle.PackageTask>("packageReaderWin") {
dependsOn("build")
// mandatory
mainClass = "com.htmake.reader.ReaderUIApplicationKt"
// optional
setBundleJre(false)
// bundleJre = true
// jrePath = File(buildDir, "win64-jre")
setCreateZipball(true)
platform = Platform.windows
vmArgs = arrayListOf<String>("-Dreader.app.showUI=true", "-Dspring.profiles.active=prod", "-Dreader.app.debug=false")
withGroovyBuilder {
"winConfig" {
"setWrapJar"(false)
}
}
// winConfig {
// wrapJar = false
// }
}
tasks.create<io.github.fvarrui.javapackager.gradle.PackageTask>("packageReaderLinux") {
dependsOn("build")
// mandatory
mainClass = "com.htmake.reader.ReaderUIApplicationKt"
// optional
setBundleJre(false)
// bundleJre = false
setCreateZipball(true)
platform = Platform.linux
vmArgs = arrayListOf<String>("-Dreader.app.showUI=true", "-Dspring.profiles.active=prod", "-Dreader.app.debug=false")
withGroovyBuilder {
"linuxConfig" {
"setWrapJar"(false)
}
}
}
tasks {
val downloadWinJre by registering(Download::class) {
src("https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_x64_windows_hotspot_11.0.8_10.zip")
dest(File(buildDir, "win64-jre.zip"))
onlyIfModified(true)
}
}
tasks.register<Copy>("unpackWinJre") {
dependsOn("downloadWinJre")
from(zipTree("$buildDir/win64-jre.zip")) {
include("jdk*/**")
eachFile {
relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
}
includeEmptyDirs = false
}
into(File(buildDir, "win64-jre"))
}
// javafx {
// version = "11.0.2"
// modules = [ 'javafx.web' ]
// }