1
1
plugins {
2
- id( " java" )
2
+ java
3
3
}
4
4
5
- repositories{
6
- mavenCentral()
7
- google()
8
- maven { url = uri(" https://jogamp.org/deployment/maven" ) }
9
- }
10
-
11
- sourceSets{
12
- main{
13
- java{
14
- srcDirs(" src" )
15
- exclude(" processing/mode/java/preproc/**" )
16
- }
17
- }
18
- test{
19
- java{
20
- srcDirs(" test" )
21
- }
5
+ java {
6
+ toolchain {
7
+ languageVersion.set(JavaLanguageVersion .of(17 ))
22
8
}
23
9
}
24
10
25
- dependencies{
26
- implementation(project(" :app" ))
27
- implementation(project(" :core" ))
28
- implementation(project(" :java:preprocessor" ))
29
-
30
- implementation(libs.eclipseJDT)
31
- implementation(libs.eclipseJDTCompiler)
32
- implementation(libs.classpathExplorer)
33
- implementation(libs.netbeansSwing)
34
- implementation(libs.ant)
35
- implementation(libs.lsp4j)
36
- implementation(libs.jsoup)
37
- implementation(libs.antlr)
11
+ val coreJar = file(" ../../../core/library/core.jar" )
38
12
39
- testImplementation(libs.junit)
40
- testImplementation(libs.mockito )
13
+ dependencies {
14
+ implementation(files(coreJar) )
41
15
}
42
16
43
- tasks.compileJava{
44
- options.encoding = " UTF-8"
45
- }
46
-
47
- // LEGACY TASKS
48
- // Most of these are shims to be compatible with the old build system
49
- // They should be removed in the future, as we work towards making things more Gradle-native
50
- tasks.register<Copy >(" extraResources" ){
51
- dependsOn(" :java:copyCore" )
52
- from(" ." )
53
- include(" keywords.txt" )
54
- include(" theme/**/*" )
55
- include(" application/**/*" )
56
- into( layout.buildDirectory.dir(" resources-bundled/common/modes/java" ))
57
- }
58
- tasks.register<Copy >(" copyCore" ){
59
- val coreProject = project(" :core" )
60
- dependsOn(coreProject.tasks.jar)
61
- from(coreProject.tasks.jar) {
62
- include(" core*.jar" )
63
- }
64
- rename(" core.+\\ .jar" , " core.jar" )
65
- into(coreProject.layout.projectDirectory.dir(" library" ))
66
- }
67
-
68
- val libraries = arrayOf(" dxf" ," io" ," net" ," pdf" ," serial" ," svg" )
69
- libraries.forEach { library ->
70
- tasks.register<Copy >(" library-$library -extraResources" ){
71
- val build = project(" :java:libraries:$library " ).tasks.named(" build" )
72
- build.configure {
73
- dependsOn(" :java:copyCore" )
17
+ tasks.register(" checkCore" ) {
18
+ doFirst {
19
+ if (! coreJar.exists()) {
20
+ throw GradleException (" Missing core.jar at $coreJar . Please build the core module first." )
74
21
}
75
- dependsOn(build)
76
- from(" libraries/$library " )
77
- include(" *.properties" )
78
- include(" library/**/*" )
79
- include(" examples/**/*" )
80
- into( layout.buildDirectory.dir(" resources-bundled/common/modes/java/libraries/$library " ))
81
22
}
82
- tasks.named(" extraResources" ){ dependsOn(" library-$library -extraResources" ) }
83
23
}
84
- tasks.jar { dependsOn(" extraResources" ) }
85
- tasks.processResources{ finalizedBy(" extraResources" ) }
86
- tasks.compileTestJava{ finalizedBy(" extraResources" ) }
87
24
88
- tasks.test {
89
- useJUnit()
90
- }
25
+ tasks.register<Jar >(" dxfJar" ) {
26
+ dependsOn(" checkCore" , " classes" )
27
+ archiveBaseName.set(" dxf" )
28
+ destinationDirectory.set(file(" library" ))
29
+ from(sourceSets.main.get().output)
30
+ }
0 commit comments