-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
353 lines (321 loc) · 9.74 KB
/
build.gradle
File metadata and controls
353 lines (321 loc) · 9.74 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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
import java.util.zip.ZipFile
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/current/userguide/userguide.html
*/
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
plugins {
id 'java'
id 'application'
id 'eclipse'
id 'com.gradleup.shadow' version '8.3.9' apply false
id 'org.openjfx.javafxplugin' version '0.1.0' apply false
id 'com.diffplug.spotless' version '6.25.0'
}
spotless {
java {
lineEndings = com.diffplug.spotless.LineEnding.UNIX
eclipse('4.26').configFile('BowlerStudio/libraries/bowler-script-kernel/config/eclipse-formatter.xml') // Optional but recommended additions:
// Optional but recommended additions:
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
// Only apply to the root project
if (project == rootProject) {
apply plugin: 'com.gradleup.shadow'
apply plugin: 'org.openjfx.javafxplugin'
}
allprojects {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
java {
sourceCompatibility = 25
targetCompatibility = 25
}
eclipse {
classpath {
downloadSources = true
downloadJavadoc = true
file {
whenMerged {
entries.forEach { entry ->
if (entry.kind == 'lib') {
entry.entryAttributes['module'] = 'true'
}
}
}
}
}
jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8
file {
withProperties { props ->
props['org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures'] = 'enabled'
props['org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures'] = 'ignore'
}
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
options.compilerArgs += ['--enable-preview']
}
tasks.named('eclipseJdt') {
doLast {
def prefs = file('.settings/org.eclipse.jdt.core.prefs')
def lines = prefs.exists() ? prefs.readLines() : []
def toAdd = [
'org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=enabled',
'org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore'
]
toAdd.each { line ->
def key = line.split('=')[0]
if (!lines.any { it.startsWith(key) }) {
lines << line
}
}
prefs.text = lines.join('\n') + '\n'
}
}
}
tasks.named('eclipseJdt') {
doLast {
def prefs = file('.settings/org.eclipse.jdt.core.prefs')
def lines = prefs.exists() ? prefs.readLines() : []
def toAdd = [
'org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=enabled',
'org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore'
]
toAdd.each { line ->
def key = line.split('=')[0]
if (!lines.any { it.startsWith(key) }) {
lines << line
}
}
prefs.text = lines.join('\n') + '\n'
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ['--enable-preview']
}
tasks.withType(Test).configureEach {
jvmArgs '--enable-preview'
}
tasks.withType(JavaExec).configureEach {
jvmArgs '--enable-preview'
}
subprojects { subproject ->
subproject.afterEvaluate {
if (subproject.plugins.hasPlugin('com.gradleup.shadow')) {
subproject.tasks.matching { it.name == 'shadowJar' }.all {
System.out.println("Disabling Shadowjar for "+it)
it.enabled = false
}
}
}
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
maven {
url "https://repository.ow2.org/nexus/content/repositories/public/"
allowInsecureProtocol = true
}
maven {
url 'https://commonwealthrobotics.com/maven/'
allowInsecureProtocol = true
}
maven { url "https://clojars.org/repo" }
}
java {
//modularity.inferModulePath.set(true)
}
dependencies {
implementation project(':BowlerStudio:libraries:bowler-script-kernel:JCSG')
implementation project(':BowlerStudio:libraries:bowler-script-kernel:java-bowler')
implementation project(':BowlerStudio:libraries:bowler-script-kernel:GithubPasswordManager:GithubPasswordManager')
implementation project(':BowlerStudio:libraries:bowler-script-kernel')
implementation project(':BowlerStudio')
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:33.2.1-jre'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.openjfx:javafx-controls:25'
implementation 'org.openjfx:javafx-fxml:25'
implementation 'org.openjfx:javafx-graphics:25'
// Jaxb moved out of system path in Java 9
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.5'
implementation('org.fxyz3d:fxyz3d:0.6.0') {
exclude group: 'eu.mihosoft.vrl.jcsg', module: 'jcsg'
//eu.mihosoft.vvecmath:vvecmath
exclude group: 'eu.mihosoft.vvecmath', module: 'vvecmath'
}
// Zip and unzip, tar and untar
implementation 'org.apache.commons:commons-compress:1.27.1'
}
javafx {
version = '25' // or whichever version you're using
modules = [
'javafx.controls',
'javafx.fxml',
'javafx.graphics'
] // add other modules as needed
}
//tasks.withType(Test) {
// useJUnitPlatform()
// jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
//}
def javafxOptions = [
'--add-exports',
'javafx.graphics/com.sun.javafx.css=ALL-UNNAMED',
'--add-exports',
'javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED',
'--add-exports',
'javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED',
'--add-exports',
'javafx.base/com.sun.javafx.event=ALL-UNNAMED',
'--add-exports',
'javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED',
'--add-exports',
'javafx.graphics/com.sun.javafx.util=ALL-UNNAMED',
'--add-exports',
'javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED',
'--add-opens',
'javafx.graphics/javafx.scene=ALL-UNNAMED',
'--add-opens',
'java.base/java.io=ALL-UNNAMED',
'--add-opens',
'java.base/java.lang=ALL-UNNAMED',
'--enable-preview'
]
run {
jvmArgs = javafxOptions
}
application {
// Define the main class for the application.
mainClass = 'com.commonwealthrobotics.Main'
applicationDefaultJvmArgs =javafxOptions
}
tasks.withType(JavaCompile) {
options.compilerArgs += [
'--add-modules',
'ALL-MODULE-PATH',
'--add-opens',
'java.base/java.lang=ALL-UNNAMED',
'--add-opens',
'java.base/java.io=ALL-UNNAMED'
]+javafxOptions
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
if (project == rootProject) {
apply plugin: 'com.gradleup.shadow'
apply plugin: 'org.openjfx.javafxplugin'
shadowJar {
dependsOn 'spotlessCheck'
archiveBaseName.set('CaDoodle-Application')
archiveClassifier.set('')
archiveVersion.set('')
zip64 true
mergeServiceFiles()
exclude '**/*.pdb' // Exclude Windows debug files from Jar
// Development options: Items that can be excluded when not used
// exclude '**/opencv/**' // OpenCV
// exclude '**/ibm/**' // IBM
// exclude '**/sun/**' // Sun
// exclude '**/netty/**' // Netty
// exclude 'Windows**/**' // Windows
// exclude 'win**/**' // Windows
// exclude '**/*.dll' // Windows
// exclude '**/*.lib' // Libs
// exclude '**/*.obj' // Obj
// exclude '**/*.exp' // Exp
// exclude '**/*.md' // Docs
// exclude '**/*.dylib' // MacOS
// exclude '**/*.jnilib' // MacOS
// exclude 'Mac-x86_64/**' // MacOS
// exclude '**/*.so' // Linux/Unix
// exclude 'Linux-**/**' // Linux/Unix
// exclude 'linux-**/**' // Linux/Unix
// exclude 'marytts/**' // Text to speach
// exclude 'scala/**' // Scala
// exclude '**/python/**' // Python
// exclude 'ai/**' // ai
// exclude '**/versions/**' // Versions
// exclude '**/glassfish/**' // Glassfish
// exclude '**/bouncycastle/**' // bouncycastle
// Development option: Uncompressed Jar, might build faster, but Jar is larger
// entryCompression=ZipEntryCompression.STORED
}
}
jar {
dependsOn 'spotlessApply'
jar.duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Implementation-Title': 'CaDoodle-Application',
'Implementation-Version': '0.0.1',
'Main-Class': 'com.commonwealthrobotics.Main'
}
}
tasks.withType(Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
compileJava {
options.compilerArgs += javafxOptions
}
eclipse {
classpath {
downloadSources = true
downloadJavadoc = true
file {
whenMerged { classpath ->
classpath.entries.removeAll { it.kind == "con" && it.path.contains("org.eclipse.jdt.launching.JRE_CONTAINER") }
classpath.entries.add(new org.gradle.plugins.ide.eclipse.model.Container("org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-25/"))
classpath.entries.findAll { it.kind == 'con' && it.path.startsWith('org.eclipse.jdt.launching.JRE_CONTAINER') }.each {
it.entryAttributes['module'] = 'true'
def addExports = []
def addOpens = []
for(int i=0; i<javafxOptions.size(); i++) {
if(javafxOptions.get(i).contains("add-opens"))
addOpens << javafxOptions.get(i+1)
if(javafxOptions.get(i).contains("add-exports"))
addExports << javafxOptions.get(i+1)
}
it.entryAttributes['add-exports'] = addExports.join(':')
it.entryAttributes['add-opens'] = addOpens.join(':')
}
}
}
}
jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8
file {
withProperties { properties ->
properties.setProperty('org.eclipse.jdt.core.compiler.problem.forbiddenReference', 'ignore')
}
}
}
}