Skip to content

Commit ad79df9

Browse files
Fixed issues with building the .sandbox folder with current version of Gradle (8.10+).
Now all Robocode libraries are copied into the `.sandbox/libs` folder. Robocode can be run from there.
1 parent b11ddd3 commit ad79df9

File tree

7 files changed

+129
-57
lines changed

7 files changed

+129
-57
lines changed

.idea/runConfigurations/Robocode_app.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.idea/runConfigurations/robocode_core_JUnit.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.idea/runConfigurations/robocode_host_JUnit.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.idea/runConfigurations/robocode_tests_JUnit.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

build.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* To build Robocode, you need to run this command:
3+
* ./gradlew build
4+
*
5+
* To clean the build, to run this command:
6+
* ./gradlew clean
7+
*
8+
* To run Robocode you need to build Robocode and do a `cd .sandbox` and write `robocode.bat` or `robocode.sh`
9+
*
10+
* The distribution file for Robocode is put into /build and named `robocode.x.x.x.x-setup.jar`
11+
* The x.x.x.x is a version number like e.g. 1.9.5.4
12+
*
13+
* You can run the distribution file with hava like this:
14+
* java -jar robocode.x.x.x.x-setup.jar
15+
*/
16+
117
plugins {
218
`java-library`
319
idea
@@ -20,6 +36,12 @@ subprojects {
2036
}
2137
}
2238

39+
tasks {
40+
named("clean") {
41+
delete(".sandbox")
42+
}
43+
}
44+
2345
nexusPublishing {
2446
repositories {
2547
sonatype {

robocode.content/build.gradle.kts

Lines changed: 106 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ dependencies {
1313

1414
// BCEL is required for Codesize
1515
runtimeOnly(libs.bcel)
16+
17+
runtimeOnly(libs.picocontainer)
1618
}
1719

1820
tasks {
@@ -27,22 +29,121 @@ tasks {
2729
}
2830

2931
val copyExternalLibs by registering(Copy::class) {
30-
dependsOn(configurations.runtimeClasspath)
3132
from({
32-
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") && it.name.contains("kotlin") }.map { it }
33+
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { it }
3334
})
3435
into("../.sandbox/libs")
3536
}
3637

3738
val copyCompilers by registering(Copy::class) {
3839
from({
39-
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") &&
40-
(it.name.contains("eclipse") || (it.name.startsWith("ecj")))}.map { it }
40+
configurations.runtimeClasspath.get().filter {
41+
it.name.endsWith("jar") &&
42+
(it.name.contains("eclipse") || (it.name.startsWith("ecj")))
43+
}.map { it }
4144
})
4245
into("../.sandbox/compilers")
4346
}
4447

45-
processResources {
48+
val copyRobocodeApiLib by registering(Copy::class) {
49+
dependsOn(project(":robocode.api").tasks.named("jar"))
50+
51+
from(
52+
project(":robocode.api").fileTree("build/libs").matching {
53+
include("robocode.jar")
54+
}
55+
)
56+
into("../.sandbox/libs") // Copy to the target directory
57+
}
58+
59+
val copyRobocodeBattleLib by registering(Copy::class) {
60+
dependsOn(project(":robocode.battle").tasks.named("jar"))
61+
62+
from(
63+
project(":robocode.battle").fileTree("build/libs").matching {
64+
include("robocode.battle-*.jar")
65+
exclude("robocode.battle-*-javadoc.jar", "robocode.battle-*-sources.jar")
66+
}
67+
)
68+
into("../.sandbox/libs") // Copy to the target directory
69+
}
70+
71+
val copyRobocodeCoreLib by registering(Copy::class) {
72+
dependsOn(project(":robocode.core").tasks.named("jar"))
73+
74+
from(
75+
project(":robocode.core").fileTree("build/libs").matching {
76+
include("robocode.core-*.jar")
77+
}
78+
)
79+
into("../.sandbox/libs") // Copy to the target directory
80+
}
81+
82+
val copyRobocodeHostLib by registering(Copy::class) {
83+
dependsOn(project(":robocode.host").tasks.named("jar"))
84+
85+
from(
86+
project(":robocode.host").fileTree("build/libs").matching {
87+
include("robocode.host-*.jar")
88+
}
89+
)
90+
into("../.sandbox/libs") // Copy to the target directory
91+
}
92+
93+
val copyRobocodeRepositoryLib by registering(Copy::class) {
94+
dependsOn(project(":robocode.repository").tasks.named("jar"))
95+
96+
from(
97+
project(":robocode.repository").fileTree("build/libs").matching {
98+
include("robocode.repository-*.jar")
99+
}
100+
)
101+
into("../.sandbox/libs") // Copy to the target directory
102+
}
103+
104+
val copyRobocodeSoundLib by registering(Copy::class) {
105+
dependsOn(project(":robocode.sound").tasks.named("jar"))
106+
107+
from(
108+
project(":robocode.sound").fileTree("build/libs").matching {
109+
include("robocode.sound-*.jar")
110+
}
111+
)
112+
into("../.sandbox/libs") // Copy to the target directory
113+
}
114+
115+
val copyRobocodeUiLib by registering(Copy::class) {
116+
dependsOn(project(":robocode.ui").tasks.named("jar"))
117+
118+
from(
119+
project(":robocode.ui").fileTree("build/libs").matching {
120+
include("robocode.ui-*.jar")
121+
}
122+
)
123+
into("../.sandbox/libs") // Copy to the target directory
124+
}
125+
126+
val copyRobocodeUiEditorLib by registering(Copy::class) {
127+
dependsOn(project(":robocode.ui.editor").tasks.named("jar"))
128+
129+
from(
130+
project(":robocode.ui.editor").fileTree("build/libs").matching {
131+
include("robocode.ui.editor-*.jar")
132+
}
133+
)
134+
into("../.sandbox/libs") // Copy to the target directory
135+
}
136+
137+
assemble {
138+
dependsOn(copyRobocodeApiLib)
139+
dependsOn(copyRobocodeBattleLib)
140+
dependsOn(copyRobocodeCoreLib)
141+
dependsOn(copyRobocodeHostLib)
142+
dependsOn(copyRobocodeRepositoryLib)
143+
dependsOn(copyRobocodeSoundLib)
144+
dependsOn(copyRobocodeUiLib)
145+
dependsOn(copyRobocodeUiEditorLib)
146+
46147
dependsOn(copyContent)
47148
dependsOn(copyExternalLibs)
48149
dependsOn(copyCompilers)

robocode.core/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ tasks {
2525
into("build/resources/main/")
2626
}
2727

28-
processResources{
28+
compileJava {
2929
dependsOn(copyVersion)
3030
}
3131

0 commit comments

Comments
 (0)