Futzing with Gradle build. This seems to build the right POM, upload the right files, and build the JAR files correctly.
This commit is contained in:
parent
41ac815c42
commit
c5a69c0673
230
build.gradle
230
build.gradle
|
@ -1,129 +1,207 @@
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
// SWT libraries
|
// SWT libraries
|
||||||
url "http://maven-eclipse.github.io/maven"
|
url "http://maven-eclipse.github.io/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'application'
|
apply plugin: 'application'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
apply plugin: 'signing'
|
||||||
|
|
||||||
mainClassName = 'com.webcodepro.applecommander.ui.AppleCommander'
|
mainClassName = 'com.webcodepro.applecommander.ui.AppleCommander'
|
||||||
version "${version}"
|
version "${version}"
|
||||||
|
|
||||||
test {
|
test {
|
||||||
String swtDependency
|
String swtDependency
|
||||||
switch (System.getProperty('os.name').toLowerCase().split()[0]) {
|
switch (System.getProperty('os.name').toLowerCase().split()[0]) {
|
||||||
case 'windows':
|
case 'windows':
|
||||||
swtDependency = "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
|
swtDependency = "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
|
||||||
break
|
break
|
||||||
case 'linux':
|
case 'linux':
|
||||||
swtDependency = "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
|
swtDependency = "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
|
||||||
break
|
break
|
||||||
case 'mac':
|
case 'mac':
|
||||||
swtDependency = "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
|
swtDependency = "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unknown OS')
|
throw new Exception('Unknown OS')
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "$swtDependency"
|
compile "$swtDependency"
|
||||||
}
|
}
|
||||||
testLogging {
|
testLogging {
|
||||||
exceptionFormat = 'full'
|
exceptionFormat = 'full'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable default JAR creation
|
// Disable default JAR creation
|
||||||
jar {
|
project.tasks.remove(jar)
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Javadoc) {
|
// Generic additions to JAR creation
|
||||||
// disable the crazy super-strict doclint tool in Java 8
|
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
|
||||||
}
|
|
||||||
tasks.withType(Jar) {
|
tasks.withType(Jar) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Main-Class': 'com.webcodepro.applecommander.ui.AppleCommander'
|
attributes 'Main-Class': 'com.webcodepro.applecommander.ui.AppleCommander'
|
||||||
attributes 'Implementation-Title': 'AppleCommander',
|
attributes 'Implementation-Title': 'AppleCommander',
|
||||||
'Implementation-Version': version
|
'Implementation-Version': version
|
||||||
}
|
}
|
||||||
from('LICENSE', 'CONTRIB', 'TODO', 'VERSIONS')
|
from('LICENSE')
|
||||||
doFirst {
|
doFirst {
|
||||||
// Pick and include ShrinkIt contents
|
// Jar files with an appendix are standalone applications and need to have ShrinkIt included.
|
||||||
from { configurations.runtime.collect { it.name.startsWith('ShrinkItArchive') ? zipTree(it) : 'fake' } }
|
if (appendix) {
|
||||||
}
|
from { configurations.runtime.collect { it.name.startsWith('ShrinkItArchive') ? zipTree(it) : 'fake' } }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "net.sf.applecommander:ShrinkItArchive:$shkVersion"
|
compile "net.sf.applecommander:ShrinkItArchive:$shkVersion"
|
||||||
compileOnly "org.apache.ant:ant:$antVersion"
|
compileOnly "org.apache.ant:ant:$antVersion"
|
||||||
|
|
||||||
testCompile "junit:junit:$junitVersion"
|
testCompile "junit:junit:$junitVersion"
|
||||||
testCompile "org.apache.commons:commons-lang3:$commonsLang3Version"
|
testCompile "org.apache.commons:commons-lang3:$commonsLang3Version"
|
||||||
}
|
}
|
||||||
|
|
||||||
task acJar(type: Jar) {
|
task mavenJar(type: Jar) {
|
||||||
dependencies {
|
dependencies {
|
||||||
// Just to pass the compile step; these classes are stripped out below.
|
// Just to pass the compile step; these classes are stripped out below.
|
||||||
compile "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
|
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) {
|
from(sourceSets.main.output) {
|
||||||
include 'com/webcodepro/**'
|
include 'com/webcodepro/applecommander/**'
|
||||||
exclude 'com/webcodepro/applecommander/ui/images/**'
|
exclude 'com/webcodepro/applecommander/ui/images/**'
|
||||||
exclude 'com/webcodepro/applecommander/ui/swing/**'
|
exclude 'com/webcodepro/applecommander/ui/swing/**'
|
||||||
exclude 'com/webcodepro/applecommander/ui/swt/**'
|
exclude 'com/webcodepro/applecommander/ui/swt/**'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
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) {
|
task linuxJar(type: Jar) {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
|
compile "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
|
||||||
}
|
}
|
||||||
appendix 'linux64-gtk'
|
appendix 'linux64-gtk'
|
||||||
from(sourceSets.main.output) {
|
from(sourceSets.main.output) {
|
||||||
include 'com/webcodepro/**'
|
include 'com/webcodepro/**'
|
||||||
}
|
}
|
||||||
doFirst {
|
doFirst {
|
||||||
// Pick and include just the Linux JAR contents
|
// Pick and include just the Linux JAR contents
|
||||||
from { configurations.runtime.collect { it.name.contains('.linux.') ? zipTree(it) : 'fake' } }
|
from { configurations.runtime.collect { it.name.contains('.linux.') ? zipTree(it) : 'fake' } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
task macosxJar(type: Jar) {
|
task macosxJar(type: Jar) {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
|
compile "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
|
||||||
}
|
}
|
||||||
appendix 'macosx'
|
appendix 'macosx'
|
||||||
from(sourceSets.main.output) {
|
from(sourceSets.main.output) {
|
||||||
include 'com/webcodepro/**'
|
include 'com/webcodepro/**'
|
||||||
}
|
}
|
||||||
doFirst {
|
doFirst {
|
||||||
// Pick and include just the Mac OS X JAR contents
|
// Pick and include just the Mac OS X JAR contents
|
||||||
from { configurations.runtime.collect { it.name.contains('.macosx.') ? zipTree(it) : 'fake' } }
|
from { configurations.runtime.collect { it.name.contains('.macosx.') ? zipTree(it) : 'fake' } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
task windowsJar(type: Jar) {
|
task windowsJar(type: Jar) {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
|
compile "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
|
||||||
}
|
}
|
||||||
appendix 'win64'
|
appendix 'win64'
|
||||||
from(sourceSets.main.output) {
|
from(sourceSets.main.output) {
|
||||||
include 'com/webcodepro/**'
|
include 'com/webcodepro/**'
|
||||||
}
|
}
|
||||||
doFirst {
|
doFirst {
|
||||||
// Pick and include just the Windows SWT JAR contents
|
// Pick and include just the Windows SWT JAR contents
|
||||||
from { configurations.runtime.collect { it.name.contains('.win32.') ? zipTree(it) : 'fake' } }
|
from { configurations.runtime.collect { it.name.contains('.win32.') ? zipTree(it) : 'fake' } }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar) {
|
||||||
|
classifier = 'javadoc'
|
||||||
|
from javadoc
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
classifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives acJar
|
archives mavenJar, acJar
|
||||||
archives linuxJar
|
archives linuxJar, macosxJar, windowsJar
|
||||||
archives macosxJar
|
archives javadocJar, sourcesJar
|
||||||
archives windowsJar
|
}
|
||||||
}
|
|
||||||
|
signing {
|
||||||
|
// Only sign if we're uploading...
|
||||||
|
required { gradle.taskGraph.hasTask("uploadArchives") }
|
||||||
|
sign configurations.archives
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadArchives {
|
||||||
|
repositories {
|
||||||
|
mavenDeployer {
|
||||||
|
addFilter('AppleCommander') { artifact, file ->
|
||||||
|
// Note that the other executables all have suffixes which change their name.
|
||||||
|
return artifact.name == 'AppleCommander' && artifact.ext == 'jar'
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||||
|
|
||||||
|
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
|
||||||
|
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
|
||||||
|
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only preserve the compile and non-SWT POM dependencies
|
||||||
|
pom('AppleCommander').whenConfigured { p ->
|
||||||
|
p.dependencies = p.dependencies.findAll { it.scope == "compile" }
|
||||||
|
p.dependencies = p.dependencies.findAll { it.groupId != "org.eclipse.swt" }
|
||||||
|
}
|
||||||
|
|
||||||
|
pom('AppleCommander').project {
|
||||||
|
name archivesBaseName
|
||||||
|
packaging 'jar'
|
||||||
|
description 'AppleCommander is a general utility for Apple II disk images.'
|
||||||
|
url 'https://applecommander.github.io/'
|
||||||
|
|
||||||
|
scm {
|
||||||
|
url 'https://github.com/AppleCommander/AppleCommander'
|
||||||
|
}
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name 'The GNU General Public License (GPL) Version 2, June 1991'
|
||||||
|
url 'https://www.gnu.org/licenses/gpl-2.0.html'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id 'robgreene'
|
||||||
|
email 'robgreene@gmail.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
# Universal AppleCommander version number. Used for:
|
# Universal AppleCommander version number. Used for:
|
||||||
# - Naming JAR file.
|
# - Naming JAR file.
|
||||||
# - The build will insert this into a file that is read at run time as well.
|
# - The build will insert this into a file that is read at run time as well.
|
||||||
version=1.4.0-BETA
|
version=1.4.0
|
||||||
|
|
||||||
|
# Dependency versions
|
||||||
shkVersion=1.1.0
|
shkVersion=1.1.0
|
||||||
swtVersion=4.6.1
|
swtVersion=4.6.1
|
||||||
junitVersion=4.12
|
junitVersion=4.12
|
||||||
antVersion=1.8.2
|
antVersion=1.8.2
|
||||||
commonsLang3Version=3.7
|
commonsLang3Version=3.7
|
||||||
|
|
||||||
|
# Maven Central Repository G and A of GAV coordinate. :-)
|
||||||
|
group=net.sf.applecommander
|
||||||
|
archivesBaseName=AppleCommander
|
||||||
|
|
Loading…
Reference in New Issue