forked from babric/lwjgl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
291 lines (266 loc) · 8.42 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
plugins {
id 'java-library'
id "maven-publish"
}
def ported = [
"clean-generated",
"clean-generated-native",
"clean-java",
"clean-native",
"clean",
"-copylwjgljars",
"-copymaventdist",
"-copymavenpoms",
"-createmavennativejars",
"-createmavensourcejars",
"-createmavenjavadocs",
"maven",
"maven-full",
"-createjars",
"-createdebugjars",
"compile_native",
"compile",
"-initialize",
"generate-all",
"generate-openal",
"generate-openal-debug",
"generate-debug",
"generate-opengl",
"generate-opengl-debug",
"generate-opengl-capabilities",
"generate-opengl-capabilities-debug",
"generate-opengl-references",
"generate-opengles",
"generate-opengles-debug",
"generate-opengles-capabilities",
"generate-opengles-capabilities-debug",
"generate-opencl",
"generate-opencl-debug",
"generate-opencl-capabilities",
"generate-opencl-capabilities-debug",
"generators",
"compile_native_es",
"all",
"jars",
"jars_es",
"jars_NoDEP",
"touch-version",
"-distribution_javadoc",
"-distribution_source",
"-distribute"
]
def ENV = System.getenv()
ant.importBuild('build.xml') { String oldTargetName ->
if (ported.contains(oldTargetName)) return oldTargetName
return "a-" + oldTargetName
}
apply from:"gradle/props.gradle"
def proparties = project.praps
static String getArch(String arch) {
if (arch == "amd64" || arch == "x64" || arch == "x86_64") {
return "amd64"
} else if (arch == "x86" || arch == "i386") {
return "i386"
} else if (arch == "armhf" || arch == "armv7") {
return "armhf"
} else if (arch == "arm64" || arch == "aarch64" || arch == "armv8") {
return "aarch64"
} else if (arch == "ppc64el" || arch == "ppc64le") {
return "ppc64el"
} else if (arch == "riscv64") {
return "riscv64"
} else if (arch == "armel") {
return "armel"
} else if (arch == "powerpc" || arch == "ppc") {
return "powerpc"
} else if (arch == "ppc64" || arch == "powerpc64") {
return "ppc64"
}
return "unknown"
}
static String getNativeFolder(Project project, String name, String fold) {
project.file("lwjgl-platform/src/" + name + "/c/" + fold).mkdirs()
return project.file("lwjgl-platform/src/" + name + "/c/" + fold).toString()
}
apply from:"gradle/compile.gradle"
apply from:"gradle/clean.gradle"
tasks.register("touch-version") {
dependsOn ":lwjgl:compileJava"
doFirst {
for (final def a in [
"windows/org_lwjgl_opengl_Display.c",
"linux/org_lwjgl_opengl_Display.c",
"macosx/org_lwjgl_opengl_Display.m"
]) {
file("lwjgl-platform/src/${a.split("/")[0]}/c/" + a).createNewFile()
}
}
}
tasks.named("a-version-mismatch").get().dependsOn "touch-version"
//tasks.register("compile") {
// description = "Compiles the java source code"
// dependsOn "compile_test", "compile_examples"
//}
//
//tasks.register("all") {
// description = "Creates the Java archives and the natives for the current platform"
// dependsOn "jars", "compile_native"
//}
//
//// Create ONLY the jar archives
//tasks.register("jars") {
// description = "Creates the Java archives ONLY and places them in libs/"
// dependsOn "-initialize", "generate-all", "compile", "-createjars", "-jars_NoDEP"
//}
//
//// Create ONLY the jar archives for the ES build
//tasks.register("jars_es") {
// description = "Creates the Java archives ONLY for the ES build and places them in libs/"
// dependsOn "-initialize", "generate-all", "compile", "-createjars_es", "-jars_NoDEP"
//}
//
//tasks.register("-jars_NoDEP", Copy) {
// from(proparties["lwjgl.temp"].toString() + "/jar") {
// include "*.jar"
// }
//
// into("libs/")
//}
//
//tasks.register("-distribution_javadoc", Zip) {
// description = "Creates a versioned distribution of javadocs"
//
// destinationDirectory.set(proparties["lwjgl.dist"])
//
// from(proparties["lwjgl.docs"]) {
// include "javadoc/**"
// }
// archiveFileName = "lwjgl-docs-" + proparties["lwjgl.version"] + ".zip"
//}
//
//tasks.register("-distribution_source", Zip) {
// description = "Creates a versioned distribution of the source code"
//
// destinationDirectory.set(proparties["lwjgl.dist"])
// archiveFileName = "lwjgl-source-" + proparties["lwjgl.version"] + ".zip"
//
// from proparties["lwjgl.source.fileset"]
//}
//
//tasks.register("-distribute") {
// description = "Distributes files"
// dependsOn "-distribute_base"
//}
//
//tasks.register("-distribute_del", Delete) {
// delete(fileTree(proparties["lwjgl.temp"].toString() + "/native") {
// include "**/*"
// })
//}
//
//tasks.register("-distribute_jar", Copy) {
// destinationDir = file(proparties["lwjgl.temp"].toString() + "/jar")
//
// from(proparties["lwjgl.lib"]) {
// include "*.jar"
// }
//}
//
//tasks.register("-distribute_base", Zip) {
// destinationDirectory.set(proparties["lwjgl.dist"])
// archiveFileName = "lwjgl-" + proparties["lwjgl.version"] + ".zip"
//
// from(proparties["lwjgl.temp"]) {
// include "**/lwjgl-" + proparties["lwjgl.version"] + "*/**"
// with proparties["lwjgl_base"]
// }
//}
//
//for (final def os in ["windows", "linux", "freebsd", "openbsd", "macosx", "solaris"]) {
// tasks.register("-distribute_${os}", Copy) {
// dependsOn "-distribute_del"
// destinationDir = file(proparties["lwjgl.temp"].toString() + "/native/${os}")
//
// from proparties["lwjgl.bin"].toString() + "/${os}"
// with proparties["lwjgl-${os}.fileset"]
// }
//
// tasks.named("-distribute").get().dependsOn "-distribute_${os}"
// tasks.named("-distribute_base").get().dependsOn "-distribute_${os}"
//}
apply from:"gradle/windows.gradle"
apply from:"gradle/macosx.gradle"
apply from:"gradle/linux.gradle"
allprojects {
repositories {
mavenCentral()
}
tasks.all {
if (it instanceof JavaCompile) {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
it.options.encoding = "UTF-8"
// if (JavaVersion.current().isJava9Compatible()) {
// it.options.release = 8
// }
// it.options.compilerArgs += [
// "--add-exports",
// "java.desktop/com.sun.media.sound=ALL-UNNAMED"
// ]
}
}
}
subprojects {
version = rootProject.version
group = rootProject.group
}
publishing {
publications {
maven(MavenPublication) {
artifactId "parent"
pom {
name = "Lighweight Java Game Library"
description = "Lighweight Java Game Library"
url = "http://lwjgl.org/"
licenses {
license {
name = "BSD"
url = "http://lwjgl.org/license.php"
distribution = "repo"
}
}
scm {
url = "http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/"
connection = "https://java-game-lib.svn.sourceforge.net/svnroot/java-game-lib"
}
developers {
developer {
id = "Developers"
url = "http://lwjgl.org/credits.php"
}
}
}
}
}
setupRepositories(repositories)
}
def static setupRepositories(RepositoryHandler repositories) {
def ENV = System.getenv()
if (ENV.MAVEN_PUBLISH_CREDENTIALS) {
repositories.maven {
url 'https://repo.legacyfabric.net/repository/legacyfabric'
credentials {
username ENV.MAVEN_PUBLISH_CREDENTIALS.split(":")[0]
password ENV.MAVEN_PUBLISH_CREDENTIALS.split(":")[1]
}
authentication {
basic(BasicAuthentication)
}
}
}
}
def os_arch = getArch(System.getProperty("os.arch"))
def target_arch = getArch(System.getProperty("targetArch", os_arch))
if (os_arch == target_arch) {
compile_native.finalizedBy(":lwjgl:nativeTest")
}