-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
103 lines (88 loc) · 2.52 KB
/
build.gradle
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
import java.util.regex.Matcher
plugins {
id 'java'
id 'application'
id "org.beryx.jlink" version "2.16.2"
}
group 'razesoldier'
version '1.0-SNAPSHOT'
sourceCompatibility = 14
targetCompatibility = 14
repositories {
mavenCentral()
}
dependencies {
implementation("com.mayabot.mynlp:mynlp-transform:3.0.2")
implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jetbrains:annotations:17.0.0")
testImplementation("org.slf4j:slf4j-nop:1.7.28")
testImplementation("org.junit.jupiter:junit-jupiter:5.5.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.5.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2")
}
ext.moduleName = 'razesoldier.epub'
mainClassName = "$moduleName/razesoldier.epub.cli.CliEntry"
task copyTestResource(type: Copy) {
from "$buildDir/resources/test"
into "$buildDir/classes/java/test"
mustRunAfter processTestResources
}
compileJava {
inputs.property("moduleName", moduleName)
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
classpath = files()
}
}
test {
dependsOn copyTestResource
useJUnitPlatform()
}
startScripts {
inputs.property("moduleName", moduleName)
doFirst {
classpath = files()
defaultJvmOpts = [
'-Dfile.encoding=UTF-8',
'--module-path', 'APP_HOME_LIBS',
'--module', mainClassName
]
}
doLast{
def bashFile = new File(outputDir, applicationName)
String bashContent = bashFile.text
bashFile.text = bashContent.replaceFirst('APP_HOME_LIBS', Matcher.quoteReplacement('$APP_HOME/lib'))
def batFile = new File(outputDir, applicationName + ".bat")
String batContent = batFile.text
batFile.text = batContent.replaceFirst('APP_HOME_LIBS', Matcher.quoteReplacement('%APP_HOME%\\lib'))
}
}
afterEvaluate {
jar {
inputs.property("moduleName", moduleName)
manifest {
attributes('Automatic-Module-Name': moduleName)
attributes 'Implementation-Title': "EPubHant2Hans",
'Main-Class': 'razesoldier.epub.cli.CliEntry'
}
}
}
jlink {
launcher {
name = 'epubconverter'
jvmArgs = ['-Dfile.encoding=UTF-8']
}
imageName.set("epubconverter-image")
addOptions("--bind-services")
}
tasks.jlink.doLast {
copy {
from('src/main/resources')
into("$buildDir/image/bin")
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}