-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
138 lines (113 loc) · 3.4 KB
/
build.gradle
File metadata and controls
138 lines (113 loc) · 3.4 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
plugins {
id 'java'
id 'war'
}
// Java version configuration
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
// Project properties
group = 'com.maxprograms.remotetm'
version = '6.2.0'
// Source sets configuration
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['src']
exclude '**/*.java'
}
}
}
// Dependencies - using fileTree to reference existing JAR files
dependencies {
// Servlet API
compileOnly files('lib/javax.servlet-api.jar')
// Runtime dependencies from WEB-INF/lib
implementation files('WebContent/WEB-INF/lib/activation.jar')
implementation files('WebContent/WEB-INF/lib/bcp47j.jar')
implementation files('WebContent/WEB-INF/lib/javax.mail.jar')
implementation files('WebContent/WEB-INF/lib/json.jar')
implementation files('WebContent/WEB-INF/lib/jsoup.jar')
implementation files('WebContent/WEB-INF/lib/mapdb.jar')
implementation files('WebContent/WEB-INF/lib/openxliff.jar')
implementation files('WebContent/WEB-INF/lib/sqlite-jdbc-3.51.3.0.jar')
implementation files('WebContent/WEB-INF/lib/swordfish.jar')
implementation files('WebContent/WEB-INF/lib/xmljava.jar')
}
// War plugin configuration
war {
archiveFileName = 'RemoteTM.war'
destinationDirectory = file('.')
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from('WebContent') {
exclude '*.xcf'
exclude '**/*.java'
}
doFirst {
println "Building WAR file: ${archiveFileName.get()}"
}
}
// Clean task configuration
clean {
delete 'WebContent/WEB-INF/classes'
delete 'WebContent/js'
delete 'RemoteTM.war'
}
// Custom task to bundle TypeScript using esbuild
task bundle(type: Exec) {
description = 'Bundle TypeScript files using esbuild'
// Delete existing js directory
doFirst {
delete 'WebContent/js'
}
commandLine 'npx', 'esbuild', 'ts/remotetm.ts', '--bundle', '--outfile=WebContent/js/remotetm.js'
}
// Custom task to copy resources (equivalent to init in Ant)
task copyResources(type: Copy) {
description = 'Copy non-Java resources to classes directory'
doFirst {
mkdir 'WebContent/WEB-INF/classes'
}
from 'src'
into 'WebContent/WEB-INF/classes'
exclude '**/*.java'
}
// Compile Java task configuration
compileJava {
dependsOn copyResources
destinationDirectory = file('WebContent/WEB-INF/classes')
outputs.upToDateWhen { false } // Always rebuild
// Calculate file count at configuration time
def javaFileCount = fileTree('src').include('**/*.java').files.size()
// Ensure clean build
doFirst {
delete destinationDirectory
mkdir destinationDirectory
println "Compiling ${javaFileCount} Java source files to ${destinationDirectory}"
}
}
// Build task dependencies
war.dependsOn compileJava, bundle
build.dependsOn war
// Custom task equivalent to Ant's "ui" target
task ui {
description = 'Build UI only (bundle and war)'
dependsOn bundle, war
}
// Custom task equivalent to Ant's "copyDocs" target
task copyDocs(type: Copy) {
description = 'Copy generated PDF docs to WebContent/docs'
doFirst {
delete 'WebContent/docs'
}
from 'docs/out/pdf'
into 'WebContent/docs'
includeEmptyDirs = false
}
// Default task
defaultTasks 'build'