AppleCommander/lib/ac-swt-common/build.gradle

64 lines
1.7 KiB
Groovy

plugins {
id 'java-library'
}
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
flatDir {
// Raspberry Pi 32-bit library
dirs project(':').projectDir.absolutePath + "/swt-lib"
}
}
dependencies {
implementation project(':lib:ac-api')
implementation "net.sf.applecommander:applesingle-api:$asVersion"
testImplementation "junit:junit:$junitVersion"
testImplementation "org.apache.commons:commons-lang3:$commonsLang3Version"
}
test {
String osName = System.getProperty('os.name').toLowerCase().split()[0]
String osArch = System.getProperty('os.arch').toLowerCase().split()[0]
switch (osArch) {
case 'amd64':
osArch = "x86_64"
break
case 'arm':
swtVersion = "$piSwtVersion"
break
}
String swtDependency
switch (osName) {
case 'windows':
swtDependency = "org.eclipse.platform:org.eclipse.swt.win32.win32.${osArch}:$swtVersion"
break
case 'linux':
swtDependency = "org.eclipse.platform:org.eclipse.swt.gtk.linux.${osArch}:$swtVersion"
break
case 'mac':
swtDependency = "org.eclipse.platform:org.eclipse.swt.cocoa.macosx.${osArch}:$swtVersion"
break
default:
throw new Exception('Unknown OS')
}
dependencies {
compileOnly("$swtDependency") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
testImplementation("$swtDependency") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
}
}
tasks.withType(Jar) {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'swt-common'
}