-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
83 lines (73 loc) · 2.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
import org.gradle.internal.os.OperatingSystem
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
apply plugin: 'java-library'
description = 'LWJGL3 SWT'
project.ext.lwjglVersion = "3.2.2"
project.ext.swtVersion = "3.109.0"
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task packageSources(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts.archives packageSources
repositories {
mavenCentral()
maven { url "http://repo.maven.apache.org/maven2" }
}
sourceSets.main.java.srcDirs "src"
switch ( OperatingSystem.current() ) {
case OperatingSystem.WINDOWS:
project.ext.lwjglNatives = "natives-windows"
project.ext.swtNatives = "org.eclipse.swt.win32.win32.x86_64"
sourceSets.main.java {
exclude "**/PlatformLinux*.java", "**/PlatformMacOSX*.java"
}
sourceSets.test.java.srcDirs "test"
break
case OperatingSystem.LINUX:
project.ext.lwjglNatives = "natives-linux"
project.ext.swtNatives = "org.eclipse.swt.gtk.linux.x86_64"
sourceSets.main.java {
exclude "**/PlatformWin32*.java", "**/PlatformMacOSX*.java"
}
break
case OperatingSystem.MAC_OS:
project.ext.lwjglNatives = "natives-macos"
project.ext.swtNatives = "org.eclipse.swt.cocoa.macosx.x86_64"
sourceSets.main.java {
exclude "**/PlatformWin32*.java", "**/PlatformLinux*.java"
}
break
}
configurations.all {
resolutionStrategy {
dependencySubstitution {
// The maven property ${osgi.platform} is not handled by Gradle
// so we replace the dependency, using the osgi platform from the project settings
def os = System.getProperty("os.name").toLowerCase()
if (os.contains("windows")) {
substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') with module("org.eclipse.platform:org.eclipse.swt.win32.win32.x86_64:3.108.0")
}
else if (os.contains("linux")) {
substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') with module("org.eclipse.platform:org.eclipse.swt.gtk.linux.x86_64:3.108.0")
}
else if (os.contains("mac")) {
substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') with module("org.eclipse.platform:org.eclipse.swt.cocoa.macosx.x86_64:3.108.0")
}
}
}
}
dependencies {
implementation "org.lwjgl:lwjgl:$lwjglVersion"
implementation "org.lwjgl:lwjgl:$lwjglVersion:$lwjglNatives"
implementation "org.lwjgl:lwjgl-opengl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-opengl:$lwjglVersion:$lwjglNatives"
implementation "org.lwjgl:lwjgl-opengles:$lwjglVersion"
implementation "org.lwjgl:lwjgl-opengles:$lwjglVersion:$lwjglNatives"
implementation "org.lwjgl:lwjgl-vulkan:$lwjglVersion"
implementation "org.eclipse.platform:$swtNatives:$swtVersion"
}