2018-06-20 17:15:19 +02:00
|
|
|
String getSWTWindowingLibrary() {
|
2018-08-18 11:08:22 +02:00
|
|
|
if (ext.has('swt')) {
|
|
|
|
switch (ext.swt) {
|
|
|
|
case ~/.*linux.*/: return 'gtk'
|
|
|
|
case ~/.*mac.*/: return 'cocoa'
|
|
|
|
case ~/.*win.*/: return 'win32'
|
|
|
|
default: return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:15:19 +02:00
|
|
|
String platform = System.properties['os.name']
|
|
|
|
|
|
|
|
switch (platform.replaceAll(' ', '').toLowerCase()) {
|
|
|
|
case ~/.*linux.*/: return 'gtk'
|
|
|
|
case ~/.*darwin.*/: return 'cocoa'
|
|
|
|
case ~/.*osx.*/: return 'cocoa'
|
|
|
|
case ~/.*win.*/: return 'win32'
|
|
|
|
default: return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String getSWTArch() {
|
|
|
|
String arch = System.properties['os.arch']
|
|
|
|
|
2018-08-18 11:08:22 +02:00
|
|
|
if (ext.has('swt')) {
|
|
|
|
arch = ext.swt
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:15:19 +02:00
|
|
|
switch (arch) {
|
|
|
|
case ~/.*64.*/: return 'x86_64'
|
|
|
|
default: return 'x86'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String getSWTPlatform() {
|
2018-08-18 11:08:22 +02:00
|
|
|
if (ext.has('swt')) {
|
|
|
|
switch (ext.swt) {
|
|
|
|
case ~/.*linux.*/: return 'linux'
|
|
|
|
case ~/.*mac.*/: return 'macosx'
|
|
|
|
case ~/.*win.*/: return 'win32'
|
|
|
|
default: return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:15:19 +02:00
|
|
|
String platform = System.properties['os.name']
|
|
|
|
|
|
|
|
switch (platform.replaceAll(' ', '').toLowerCase()) {
|
|
|
|
case ~/.*linux.*/: return 'linux'
|
|
|
|
case ~/.*darwin.*/: return 'macosx'
|
|
|
|
case ~/.*osx.*/: return 'macosx'
|
|
|
|
case ~/.*win.*/: return 'win32'
|
|
|
|
default: return platform
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 11:08:22 +02:00
|
|
|
// optionally let us specify which SWT to use. options are win32/mac32/linux32 and win64/mac64/linux64
|
|
|
|
// include this in your build.gradle file, before dependencies are determined. ext.swt = 'win64'
|
|
|
|
|
2018-06-20 17:15:19 +02:00
|
|
|
ext {
|
|
|
|
// because the eclipse release of SWT is abandoned on maven, this MAVEN repo has newer version of SWT,
|
|
|
|
// https://github.com/maven-eclipse/maven-eclipse.github.io (for the website about it)
|
|
|
|
// http://maven-eclipse.github.io/maven (for the maven repo)
|
|
|
|
|
|
|
|
swtWindowingLibrary = getSWTWindowingLibrary()
|
|
|
|
swtArch = getSWTArch()
|
|
|
|
swtPlatform = getSWTPlatform()
|
|
|
|
}
|
|
|
|
|