Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
119 lines (105 loc) · 2.49 KB
/
Copy pathbuild.gradle
File metadata and controls
119 lines (105 loc) · 2.49 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
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
plugins {
id 'java'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['src']
exclude '**/*.java'
}
}
}
dependencies {
implementation files('lib/xmljava.jar')
implementation files('lib/json.jar')
}
// Disable all caching for fresh builds
gradle.startParameter.buildCacheEnabled = false
tasks.configureEach {
outputs.upToDateWhen { false }
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
// Disable incremental compilation for fresh builds
options.incremental = false
}
jar {
archiveBaseName = 'terms'
destinationDirectory = file('lib')
}
// Clean task to remove build outputs
tasks.named('clean') {
doFirst {
delete 'lib/terms.jar'
delete 'dist'
}
}
// Task to create jlink distribution
tasks.register('jlink', Exec) {
dependsOn jar
doFirst {
delete 'dist'
}
def pathSeparator = System.getProperty('os.name').toLowerCase().contains('win') ? ';' : ':'
commandLine 'jlink',
'--module-path', "lib${pathSeparator}${System.getProperty('java.home')}/jmods",
'--add-modules', 'terms',
'--output', 'dist',
'--no-man-pages',
'--no-header-files'
doLast {
delete 'dist/lib/jrt-fs.jar'
}
}
// Task to create complete distribution
tasks.register('dist') {
dependsOn jlink
doLast {
def os = System.getProperty('os.name').toLowerCase()
if (os.contains('win')) {
copy {
from('extractTerms.cmd')
into 'dist'
}
copy {
from('bilingualExtractor.cmd')
into 'dist'
}
} else {
copy {
from('extractTerms.sh') {
filePermissions {
unix('rwxr-xr-x')
}
}
into 'dist'
}
copy {
from('bilingualExtractor.sh') {
filePermissions {
unix('rwxr-xr-x')
}
}
into 'dist'
}
}
copy {
from 'LICENSE'
into 'dist'
}
copy {
from 'licenses'
into 'dist/licenses'
}
}
}
// Default task
defaultTasks 'dist'