-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
118 lines (99 loc) · 3.73 KB
/
build.gradle
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
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building a CLI application.
id 'application'
id 'eclipse'
id 'edu.sc.seis.launch4j' version '2.5.3'
}
sourceCompatibility = 11
repositories {
jcenter()
mavenCentral()
}
launch4j {
mainClassName = 'survival.SurvivalApp'
bundledJrePath = 'jre'
outfile = 'survival.exe'
// please run copyjre first
// look in RallyGame\build\launch4j for the lib, jre and exe files, usually i zip and upload
}
def jme3Version = '3.3.2-stable'
dependencies {
implementation 'com.google.guava:guava:28.0-jre'
implementation "org.jmonkeyengine:jme3-bullet:${jme3Version}"
implementation "org.jmonkeyengine:jme3-bullet-native:${jme3Version}"
implementation "org.jmonkeyengine:jme3-core:${jme3Version}"
implementation "org.jmonkeyengine:jme3-desktop:${jme3Version}"
implementation "org.jmonkeyengine:jme3-effects:${jme3Version}"
implementation "org.jmonkeyengine:jme3-lwjgl:${jme3Version}"
implementation "org.jmonkeyengine:jme3-plugins:${jme3Version}"
implementation "org.jmonkeyengine:jme3-terrain:${jme3Version}"
implementation "org.jmonkeyengine:jme3-jogg:${jme3Version}"
implementation 'org.yaml:snakeyaml:1.25'
implementation 'com.simsilica:lemur:1.13.0'
// Use JUnit Jupiter API for testing
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.1'
}
test {
// Use junit platform for unit tests
useJUnitPlatform()
}
application {
// Define the main class for the application
mainClassName = 'rallygame.game.Main'
}
// run the 'real' game
task runDuel(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'duel.DuelApp'
}
task runSurvival(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'survival.SurvivalApp'
}
def blenderCommandWin = "C:\\Program Files\\Blender Foundation\\Blender 2.82\\blender"
def blenderCommandLinux = "/usr/bin/blender"
def blenderPythonFile = "$projectDir/src/main/resources/blend2gltf.py"
task convertAllBlendFiles {
doFirst {
def blenderCommand = blenderCommandLinux
print('Running on: ' + System.getProperty('os.name').toLowerCase(Locale.ROOT)+'\n')
def isWindows = System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')
if (isWindows) {
blenderCommand = blenderCommandWin + '.exe'
}
// and check blender exists first
assert file(blenderCommand).exists()
ConfigurableFileTree files = fileTree(dir: 'src/main/resources', include: '**/*.blend')
files.each { File file ->
File glbFile = new File(file.path + '.glb')
if (!glbFile.exists() || file.lastModified() > glbFile.lastModified()) {
println 'Running: ' + file.path
def ip = new ByteArrayOutputStream()
exec {
standardOutput = ip
ignoreExitValue = true
def command = '"' + blenderCommand + '" "'+file.path+'" --background --python "' + blenderPythonFile + '"'
if (isWindows) {
commandLine 'cmd', '/s', '/c', '"'+command+'"'
} else {
commandLine 'sh', '-c', command
}
}
} else {
println 'generated is newer for: ' + file.name
}
}
}
}
compileJava.dependsOn(convertAllBlendFiles)
task copyjre {
// TODO get this to run before launch4j.createExe
doFirst {
copy {
from "C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.7.10-hotspot"
into "build/launch4j/jre"
}
}
}