AppleCommander/build.gradle

129 lines
3.6 KiB
Groovy

repositories {
mavenCentral()
maven {
// SWT libraries
url "http://maven-eclipse.github.io/maven"
}
}
apply plugin: 'java'
apply plugin: 'application'
mainClassName = 'com.webcodepro.applecommander.ui.AppleCommander'
version "${version}"
test {
String swtDependency
switch (System.getProperty('os.name').toLowerCase().split()[0]) {
case 'windows':
swtDependency = "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
break
case 'linux':
swtDependency = "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
break
case 'mac':
swtDependency = "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
break
default:
throw new Exception('Unknown OS')
}
dependencies {
compile "$swtDependency"
}
testLogging {
exceptionFormat = 'full'
}
}
// Disable default JAR creation
jar {
enabled = false
}
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.withType(Jar) {
manifest {
attributes 'Main-Class': 'com.webcodepro.applecommander.ui.AppleCommander'
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': version
}
from('LICENSE', 'CONTRIB', 'TODO', 'VERSIONS')
doFirst {
// Pick and include ShrinkIt contents
from { configurations.runtime.collect { it.name.startsWith('ShrinkItArchive') ? zipTree(it) : 'fake' } }
}
}
dependencies {
compile "net.sf.applecommander:ShrinkItArchive:$shkVersion"
compileOnly "org.apache.ant:ant:$antVersion"
testCompile "junit:junit:$junitVersion"
testCompile "org.apache.commons:commons-lang3:$commonsLang3Version"
}
task acJar(type: Jar) {
dependencies {
// Just to pass the compile step; these classes are stripped out below.
compile "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
}
appendix 'ac'
manifest {
attributes 'Main-Class' : 'com.webcodepro.applecommander.ui.ac'
}
from(sourceSets.main.output) {
include 'com/webcodepro/**'
exclude 'com/webcodepro/applecommander/ui/images/**'
exclude 'com/webcodepro/applecommander/ui/swing/**'
exclude 'com/webcodepro/applecommander/ui/swt/**'
}
}
task linuxJar(type: Jar) {
dependencies {
compile "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
}
appendix 'linux64-gtk'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Linux JAR contents
from { configurations.runtime.collect { it.name.contains('.linux.') ? zipTree(it) : 'fake' } }
}
}
task macosxJar(type: Jar) {
dependencies {
compile "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
}
appendix 'macosx'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Mac OS X JAR contents
from { configurations.runtime.collect { it.name.contains('.macosx.') ? zipTree(it) : 'fake' } }
}
}
task windowsJar(type: Jar) {
dependencies {
compile "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
}
appendix 'win64'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Windows SWT JAR contents
from { configurations.runtime.collect { it.name.contains('.win32.') ? zipTree(it) : 'fake' } }
}
}
artifacts {
archives acJar
archives linuxJar
archives macosxJar
archives windowsJar
}