-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
213 lines (181 loc) · 7.16 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
plugins {
id 'application'
id 'java'
id "de.undercouch.download" version "5.1.0"
id 'idea'
id "io.github.0ffz.github-packages" version "1.2.1" // Plugin for anonymous inclusion of artifacts hosted in github package registry
}
description = 'DodgetheCreeps application'
java {
sourceCompatibility = '11'
targetCompatibility = '11'
}
ext.jmonkeyengineVersion = '3.5.2-stable'
ext.dyn4jVer = '5.0.0'
mainClassName = 'com.mygame.DodgetheCreeps'
if (!hasProperty('mainClass')) {
ext.mainClass = mainClassName
}
jar.manifest.attributes('Main-Class': mainClassName)
repositories {
flatDir { dirs "${rootProject.projectDir}/lib" } // to find libraries in the project's "lib" directory
mavenCentral()
mavenLocal()
}
dependencies {
// You can read more about how to add dependencies here:
// https://docs.gradle.org/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
implementation 'org.jmonkeyengine:jme3-core:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-desktop:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-lwjgl3:' + jmonkeyengineVersion
implementation 'com.simsilica:lemur:1.16.0'
implementation 'com.simsilica:lemur-proto:1.13.0'
runtimeOnly 'org.codehaus.groovy:groovy-jsr223:3.0.10'
implementation 'org.dyn4j:dyn4j:' + dyn4jVer
implementation name: 'jMe3GL2-core-1.2-SNAPSHOT'
implementation name: 'dynamic-hud-v1.0.0'
}
distZip {
//having a degenerate folder within the dist zip complicates generating the other zips
eachFile { file ->
String path = file.relativePath
file.setPath(path.substring(path.indexOf("/") + 1, path.length()))
}
includeEmptyDirs(false)
}
//See https://api.adoptium.net/v3/assets/feature_releases/11/ga?image_type=jre for jre urls
def windowsJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_windows_hotspot_11.0.15_10.zip"
def linuxJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_linux_hotspot_11.0.15_10.tar.gz"
def macJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz"
task downloadWindowsJre(type: Download) {
src windowsJreUrl
dest new File(buildDir, '/jres/windowsJre.zip')
overwrite false
}
task downloadAndUnzipWindowsJre(dependsOn: downloadWindowsJre, type: Copy) {
from zipTree(downloadWindowsJre.dest)
into "${buildDir}/jres/windowsJre/"
includeEmptyDirs(false)
filesMatching("**") {
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
}
}
task buildWindowsDistribution(dependsOn: [distZip, downloadAndUnzipWindowsJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/DodgetheCreeps.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
into new File(buildDir, 'distributions/DodgetheCreeps-windows')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
task zipWindowsDistribution( dependsOn:buildWindowsDistribution, type: Zip) {
group 'distribution'
archiveFileName = "DodgetheCreeps-windows.zip"
destinationDirectory = file("$buildDir/distributions")
from "$buildDir/distributions/DodgetheCreeps-windows"
}
task downloadLinuxJre(type: Download) {
src linuxJreUrl
dest new File(buildDir, '/jres/linuxJre.tar.gz')
overwrite false
}
task downloadAndUnzipLinuxJre(dependsOn: downloadLinuxJre, type: Copy) {
from tarTree(downloadLinuxJre.dest)
into "${buildDir}/jres/linuxJre/"
includeEmptyDirs(false)
filesMatching("**") {
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
}
}
task buildLinuxDistribution(dependsOn: [distZip, downloadAndUnzipLinuxJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/DodgetheCreeps.sh"){
fileMode 0755
}
from zipTree(distZip.archiveFile)
from "${buildDir}/jres/linuxJre"
into new File(buildDir, 'distributions/DodgetheCreeps-linux')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
task zipLinuxDistribution( dependsOn:buildLinuxDistribution, type: Zip) {
group 'distribution'
archiveFileName = "DodgetheCreeps-linux.tar.gz"
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/distributions/DodgetheCreeps-linux"){
include('**.sh')
include('**/java')
fileMode 0755
}
from ("$buildDir/distributions/DodgetheCreeps-linux"){
exclude('**.sh')
exclude('**/java')
}
}
task downloadMacJre(type: Download) {
src macJreUrl
dest new File(buildDir, '/jres/macJre.tar.gz')
overwrite false
}
task downloadAndUnzipMacJre(dependsOn: downloadMacJre, type: Copy) {
from tarTree(downloadMacJre.dest)
into "${buildDir}/jres/macJre/"
includeEmptyDirs(false)
filesMatching("**") {
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
}
}
task buildMacDistribution(dependsOn: [distZip, downloadAndUnzipMacJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/DodgetheCreeps.command"){
fileMode 0755
}
from zipTree(distZip.archiveFile)
from "${buildDir}/jres/macJre"
into new File(buildDir, 'distributions/DodgetheCreeps-mac')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
task zipMacDistribution( dependsOn:buildMacDistribution, type: Zip) {
group 'distribution'
archiveFileName = "DodgetheCreeps-mac.tar.gz"
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/distributions/DodgetheCreeps-mac"){
include('**.command')
include('**/java')
fileMode 0755
}
from ("$buildDir/distributions/DodgetheCreeps-mac"){
exclude('**.command')
exclude('**/java')
}
}
task buildAllDistributions{
group 'distribution'
dependsOn 'zipWindowsDistribution'
dependsOn 'zipLinuxDistribution'
dependsOn 'zipMacDistribution'
}
// cleanup tasks
clean.dependsOn('cleanDLLs', 'cleanDyLibs', 'cleanLogs', 'cleanSOs')
task cleanDLLs(type: Delete) {
delete fileTree(dir: '.', include: '*.dll')
}
task cleanDyLibs(type: Delete) {
delete fileTree(dir: '.', include: '*.dylib')
}
task cleanLogs(type: Delete) {
delete fileTree(dir: '.', include: 'hs_err_pid*.log')
}
task cleanSOs(type: Delete) {
delete fileTree(dir: '.', include: '*.so')
}
task fund(){
doLast {
java.awt.Desktop.desktop.browse "https://start.jmonkeyengine.org/#!funding=JME_DESKTOP,LEMUR".toURI()
}
}