-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
268 lines (237 loc) · 10.7 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
import org.gradle.internal.os.OperatingSystem
import java.text.SimpleDateFormat
group 'net.fexcraft.app.fmt'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
project.ext.lwjglVersion = "3.3.3"
project.ext.jomlVersion = "1.9.23"
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
def osArch = System.getProperty("os.arch")
project.ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64")
? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}"
: "natives-linux"
break
case OperatingSystem.MAC_OS:
project.ext.lwjglNatives = "natives-macos"
break
case OperatingSystem.WINDOWS:
project.ext.lwjglNatives = System.getProperty("os.arch").contains("64") ? "natives-windows" : "natives-windows-x86"
break
}
version = "3.0.0"
new File(projectDir, '/src/net/fexcraft/app/fmt/FMT.java').find { line ->
if (line.contains('String VERSION')) {
version = line.substring(line.indexOf('"') + 1).replace('";', '')
return true
}
return false
}
sourceCompatibility = 17
targetCompatibility = 17
compileJava.options.encoding = 'UTF-8'
//@formatter:off
def log4j_version = '2.21.1'
def commons_version = '3.13.0'
def commons_collections = '4.4'
def guava_version = '32.1.2-jre'
def gson_version = '2.8.9'
def legui_version = '4.2.0'
def joml_version = "1.10.5"//"-SNAPSHOT"
def lwjgl_version = "3.3.3"//'3.2.4-SNAPSHOT'
def le_cbchain = '1.0.2'
//@formatter:on
//Make this project as a Gradle project
eclipse.project {
natures 'org.springsource.ide.eclipse.gradle.core.nature'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://raw.github.com/SpinyOwl/repo/releases" }
maven { url 'https://jitpack.io' }
}
dependencies {
// implementation fileTree(dir: 'libs', include: '*.jar')
// https://mvnrepository.com/artifact/org.reflections/reflections
implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation 'commons-io:commons-io:2.15.0'
//@formatter:off
implementation group: "org.joml", name: "joml", version: joml_version, changing: true
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4j_version, changing: false
implementation group: 'org.apache.commons', name: 'commons-lang3', version: commons_version, changing: false
implementation group: 'org.apache.commons', name: 'commons-collections4', version: commons_collections, changing: false
implementation group: 'com.google.guava', name: 'guava', version: guava_version, changing: false
implementation group: 'com.google.code.gson', name: 'gson', version: gson_version, changing: false
implementation group: 'com.spinyowl', name: 'cbchain', version: le_cbchain, changing: true
implementation group: 'com.spinyowl', name: 'legui', version: legui_version, changing: true
implementation group: 'org.lwjgl', name: 'lwjgl-stb', version: lwjgl_version, changing: true
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-stb', version: lwjgl_version, changing: true, classifier: 'natives-windows'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-stb', version: lwjgl_version, changing: true, classifier: 'natives-linux'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-stb', version: lwjgl_version, changing: true, classifier: 'natives-macos'
implementation group: 'org.lwjgl', name: 'lwjgl-glfw', version: lwjgl_version, changing: true
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-glfw', version: lwjgl_version, changing: true, classifier: 'natives-windows'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-glfw', version: lwjgl_version, changing: true, classifier: 'natives-linux'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-glfw', version: lwjgl_version, changing: true, classifier: 'natives-macos'
implementation group: 'org.lwjgl', name: 'lwjgl-nanovg', version: lwjgl_version, changing: true
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-nanovg', version: lwjgl_version, changing: true, classifier: 'natives-windows'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-nanovg', version: lwjgl_version, changing: true, classifier: 'natives-linux'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-nanovg', version: lwjgl_version, changing: true, classifier: 'natives-macos'
implementation group: 'org.lwjgl', name: 'lwjgl-opengl', version: lwjgl_version, changing: true
implementation group: 'org.lwjgl', name: 'lwjgl-opengl', version: lwjgl_version, changing: true, classifier: 'natives-windows'
implementation group: 'org.lwjgl', name: 'lwjgl-opengl', version: lwjgl_version, changing: true, classifier: 'natives-linux'
implementation group: 'org.lwjgl', name: 'lwjgl-opengl', version: lwjgl_version, changing: true, classifier: 'natives-macos'
implementation group: 'org.lwjgl', name: 'lwjgl', version: lwjgl_version, changing: true
runtimeOnly group: 'org.lwjgl', name: 'lwjgl', version: lwjgl_version, changing: true, classifier: 'natives-windows'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl', version: lwjgl_version, changing: true, classifier: 'natives-linux'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl', version: lwjgl_version, changing: true, classifier: 'natives-macos'
implementation group: 'org.lwjgl', name: 'lwjgl-yoga', version: lwjgl_version, changing: true
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-yoga', version: lwjgl_version, changing: true, classifier: 'natives-windows'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-yoga', version: lwjgl_version, changing: true, classifier: 'natives-linux'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-yoga', version: lwjgl_version, changing: true, classifier: 'natives-macos'
implementation group: 'org.lwjgl', name: 'lwjgl-tinyfd', version: lwjgl_version, changing: true
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-tinyfd', version: lwjgl_version, changing: true, classifier: 'natives-windows'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-tinyfd', version: lwjgl_version, changing: true, classifier: 'natives-linux'
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-tinyfd', version: lwjgl_version, changing: true, classifier: 'natives-macos'
//implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.7', changing: true
//runtimeOnly group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.7', changing: true
implementation files('libs/VOXtoFMT-1.jar')
//@formatter:on
//testCompile group: 'junit', name: 'junit', version: '4.11'
implementation 'com.github.JnCrMx:discord-game-sdk4j:master-SNAPSHOT'
}
sourceSets {
main {
java {
srcDirs "src"
srcDirs "../Json/src"
srcDirs "../FCL/common/src"
}
resources {
srcDirs 'resources'
srcDirs 'scripts'
}
}
}
mainClassName = 'net.fexcraft.app.fmt.FMT'
tasks.register('mainJar', Jar) {
manifest {
attributes 'Title': "Fex's Modelling Toolbox",
'Version': version,
'Main-Class': 'net.fexcraft.app.fmt.FMT',
'Created-By': "Ferdinand Calo' (FEX___96)",
"Class-Path": ". " + (configurations.runtimeClasspath.collect { "lib/" + it.getName() }.join(' '))
}
from(sourceSets.main.output){
exclude 'net/fexcraft/app/fmt/updater/'
include 'net/fexcraft/app/fmt/'
include 'net/fexcraft/app/json/'
include 'net/fexcraft/lib/'
include 'log4j2.xml'
}
from('src/'){
include 'log4j2.xml'
}
archiveBaseName = "FMT"
version = ""
}
tasks.register('fullJar', Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Title': "Fex's Modelling Toolbox",
'Version': version,
'Main-Class': 'net.fexcraft.app.fmt.FMT',
'Created-By': "Ferdinand Calo' (FEX___96)",
'Multi-Release': true
}
from(sourceSets.main.output){
include 'net/fexcraft/app/fmt/launch/'
include 'net/fexcraft/app/fmt/'
include 'net/fexcraft/app/json/'
include 'net/fexcraft/lib/'
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
from('src/') {
include 'log4j2.xml'
}
archiveBaseName = "FMTI"
version = ""
}
tasks.register('launcherJar', Jar) {
manifest {
attributes 'Title': "Fex's Modelling Toolbox Updater",
'Version': version,
'Main-Class': 'net.fexcraft.app.fmt.updater.Updater',
'Created-By': "Ferdinand Calo' (FEX___96)"
}
from(sourceSets.main.output) {
include 'net/fexcraft/app/fmt/updater/'
include 'net/fexcraft/app/json/'
}
archiveBaseName = "FMT_Updater"
version = ""
}
tasks.register('copyForUpload') {
copy {
from configurations.runtimeClasspath
into "upload/lib"
}
copy {
from "build/libs/FMT.jar"
into "upload/"
}
copy {
from "build/libs/FMTI.jar"
into "upload/"
}
copy {
from "build/libs/FMT_Updater.jar"
into "upload/"
}
copy {
from "resources/"
into "upload/resources"
}
copy {
from "scripts/"
into "upload/scripts"
}
}
String[] res_types = ["resources/", "scripts/"]
tasks.register('compileCatalog') {
String catalog_fmt = '{\n\t"file_root": "http://fexcraft.net/files/app_data/fmt/",\n\t"files": [\n'
String path, restype
sourceSets.main.resources.each {
path = it.getPath()
path = path.replace("\\", "/")
for (String type : res_types) {
if (path.contains(type)) {
restype = type
break
}
}
path = path.substring(path.indexOf(restype))
catalog_fmt += '\t\t[ "' + path + '", ' + it.lastModified() + ' ],\n'
}
configurations.runtimeClasspath.each {
path = it.getPath().replace("\\", "/")
path = "lib" + path.substring(path.lastIndexOf("/"))
catalog_fmt += '\t\t[ "' + path + '", ' + it.lastModified() + ', true ],\n'
}
catalog_fmt += '\t\t[ "FMT.jar", ' + new File(projectDir, "/upload/FMT.jar").lastModified() + ', true, false ]\n'
catalog_fmt += '\t],\n'
catalog_fmt += '\t"last_catalog_update": "' + new SimpleDateFormat("HH:mm:ss dd.MMM.yyyy z").format(new Date()) + '"\n'
catalog_fmt += '\t"fmt_version": "' + new SimpleDateFormat("3.yyD.HHmm").format(new Date()) + '"\n'
catalog_fmt += '}\n'
new File(projectDir, "upload/catalog.fmt").text = catalog_fmt
new File(projectDir, "catalog.fmt").text = catalog_fmt
}
build.finalizedBy(mainJar)
build.finalizedBy(fullJar)
build.finalizedBy(launcherJar)
build.finalizedBy(copyForUpload)
build.finalizedBy(compileCatalog)