Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
85 lines (73 loc) · 1.68 KB
/
Copy pathbuild.gradle
File metadata and controls
85 lines (73 loc) · 1.68 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
plugins {
id 'java'
id 'application'
id 'com.diffplug.spotless' version '6.25.0'
}
group = 'nsl'
version = '1.0-SNAPSHOT'
java {
// Use toolchain to compile with specified Java version
// This allows Gradle to run with Java 11+ (for Spotless) while compiling for target version
toolchain {
// Default to Java 8, but can be overridden via -PjavaToolchain=X
def toolchainVersion = project.hasProperty('javaToolchain') ? project.property('javaToolchain') : '8'
languageVersion = JavaLanguageVersion.of(toolchainVersion)
}
}
application {
mainClass = 'nsl.Main'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-core:1.3'
}
// Configure JAR manifest
jar {
manifest {
attributes(
'Main-Class': 'nsl.Main'
)
}
archiveFileName = 'nsL.jar'
}
// Configure source and test directories to match existing structure
sourceSets {
main {
java {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
}
}
// Configure test output
test {
// Codegen tests fork the assembler rather than calling it in process, so they
// need the jar built first and need to be told where it landed.
dependsOn jar
systemProperty 'nsl.jar', jar.archiveFile.get().asFile.absolutePath
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = true
}
}
// Configure code formatting with Spotless
spotless {
java {
target 'src/**/*.java', 'test/**/*.java'
// Use Google Java Format with explicit version for Java 21 compatibility
googleJavaFormat('1.22.0')
// Additional formatting
removeUnusedImports()
indentWithTabs(2)
trimTrailingWhitespace()
endWithNewline()
}
}