-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
164 lines (141 loc) · 4.77 KB
/
build.gradle
File metadata and controls
164 lines (141 loc) · 4.77 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
plugins {
id 'java'
id 'application'
}
version = '0.0.30'
repositories {
mavenCentral()
}
def gdxVersion = '1.12.1'
dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
// JSON serialization for fence persistence
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.10.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.5.0'
testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
testImplementation 'com.pholser:junit-quickcheck-core:1.0'
testImplementation 'com.pholser:junit-quickcheck-generators:1.0'
}
test {
useJUnitPlatform()
testLogging {
events = ["passed", "skipped", "failed"]
exceptionFormat = "full"
}
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
// Configure assets folder for LibGDX
sourceSets {
main {
resources {
srcDirs = ['assets']
}
}
}
application {
mainClass = 'wagemaker.uk.desktop.DesktopLauncher'
}
// Ensure assets are available during development
run {
workingDir = project.rootDir
}
// Separate task to run the main application
task runApp(type: JavaExec) {
group = 'application'
description = 'Run the main Woodlanders application'
dependsOn classes
classpath = sourceSets.main.runtimeClasspath + files('assets')
mainClass = 'wagemaker.uk.desktop.DesktopLauncher'
workingDir = project.rootDir
}
// Separate task to run the launcher - delegates to launcher subproject
task runLauncher {
group = 'application'
description = 'Run the Woodlanders launcher'
dependsOn ':launcher:run'
}
// Client JAR task (full game with rendering)
jar {
archiveBaseName = 'woodlanders-client'
archiveVersion = ''
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': application.mainClass
}
// Include compiled classes and resources (including assets)
from sourceSets.main.output
// Include dependencies
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}
// Server JAR task for dedicated server (headless, no rendering)
task serverJar(type: Jar) {
archiveBaseName = 'woodlanders-server'
archiveVersion = ''
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': 'wagemaker.uk.server.DedicatedServerLauncher'
}
// Include compiled classes
from sourceSets.main.output
// Include only core dependencies, exclude rendering libraries
from {
configurations.runtimeClasspath.findAll {
// Only include core LibGDX, exclude rendering backends and natives
!it.name.contains('lwjgl') &&
!it.name.contains('backend') &&
!it.name.contains('platform') &&
!it.name.contains('freetype') &&
!it.name.contains('natives')
}.collect {
it.isDirectory() ? it : zipTree(it)
}
}
// Exclude LibGDX rendering and platform-specific classes
exclude 'com/badlogic/gdx/backends/**'
exclude 'org/lwjgl/**'
exclude '**/*.so'
exclude '**/*.dylib'
exclude '**/*.dll'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
// Exclude asset files that are only needed for rendering
exclude 'sprites/**'
exclude 'textures/**'
exclude 'fonts/**'
exclude 'shaders/**'
exclude 'sounds/**'
exclude 'music/**'
}
// Task to copy launcher JAR to root build/libs
task copyLauncherJar(type: Copy) {
dependsOn ':launcher:jar'
from project(':launcher').layout.buildDirectory.file('libs/woodlanders-launcher.jar')
into layout.buildDirectory.dir('libs')
mustRunAfter jar
}
// Make build task create all three JARs
build.dependsOn serverJar, copyLauncherJar
// Ensure proper task ordering
tasks.named('startScripts').configure {
mustRunAfter copyLauncherJar
}
tasks.named('distZip').configure {
mustRunAfter copyLauncherJar
}
tasks.named('distTar').configure {
mustRunAfter copyLauncherJar
}