1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 15:32:06 +01:00

Cleanup of build.gradle

- Moved helper code at the end
- Add description to the POM
This commit is contained in:
Florian Schmaus 2014-02-19 23:26:56 +01:00
parent 1a94812660
commit b4d735e862

View file

@ -17,6 +17,7 @@ allprojects {
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots' sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
buildDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date()) buildDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
} }
group = 'org.igniterealtime.smack' group = 'org.igniterealtime.smack'
sourceCompatibility = 1.6 sourceCompatibility = 1.6
@ -66,41 +67,18 @@ jar {
enabled = false enabled = false
} }
import org.gradle.plugins.signing.Sign
gradle.taskGraph.whenReady { taskGraph ->
if (signingRequired && taskGraph.allTasks.any { it instanceof Sign }) {
// Use Java 6's console to read from the console (no good for a CI environment)
Console console = System.console()
console.printf '\n\nWe have to sign some things in this build.\n\nPlease enter your signing details.\n\n'
def password = console.readPassword('GnuPG Private Key Password: ')
allprojects { ext.'signing.password' = password }
console.printf '\nThanks.\n\n'
}
}
description = """\ description = """\
Smack ${version} Smack ${version}
An Open Source XMPP (Jabber) client library. ${oneLineDesc}."""
"""
subprojects { subprojects {
apply plugin: 'osgi' apply plugin: 'osgi'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'pmd'
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
apply plugin: 'findbugs'
checkstyle { checkstyle {
configFile = new File(rootConfigDir, 'checkstyle.xml') configFile = new File(rootConfigDir, 'checkstyle.xml')
} }
pmd {
ignoreFailures = true
}
findbugs {
ignoreFailures = true
}
repositories { repositories {
mavenCentral() mavenCentral()
} }
@ -141,8 +119,9 @@ subprojects {
pom.project { pom.project {
name 'Smack' name 'Smack'
packaging 'jar' packaging 'jar'
inceptionYear '2003'
url 'http://www.igniterealtime.org/projects/smack/' url 'http://www.igniterealtime.org/projects/smack/'
issueManagement { issueManagement {
system 'JIRA' system 'JIRA'
url 'http://issues.igniterealtime.org/browse/SMACK' url 'http://issues.igniterealtime.org/browse/SMACK'
@ -194,8 +173,8 @@ subprojects {
project(':core') { project(':core') {
description = """\ description = """\
Smack core components. Smack core components."""
"""
configurations { configurations {
compression compression
dns dns
@ -238,24 +217,11 @@ Smack core components.
compileJava.dependsOn(createVersionResource) compileJava.dependsOn(createVersionResource)
} }
class CreateFileTask extends DefaultTask {
@Input
String fileContent
@OutputFile
File outputFile
@TaskAction
def createFile() {
outputFile.text = fileContent
}
}
project(':compression-jzlib') { project(':compression-jzlib') {
description = """\ description = """\
Compression with jzlib Compression with jzlib
Allow to compress the XMPP stream with help of jzlib. Allow to compress the XMPP stream with help of jzlib."""
"""
dependencies { dependencies {
compile project(path: ':core', configuration: 'compression') compile project(path: ':core', configuration: 'compression')
compile 'com.jcraft:jzlib:1.1.3' compile 'com.jcraft:jzlib:1.1.3'
@ -266,8 +232,8 @@ project(':resolver-dnsjava') {
description = """\ description = """\
DNS SRV with dnsjava DNS SRV with dnsjava
Use dnsjava for DNS SRV lookups. For platforms that don't provide the Use dnsjava for DNS SRV lookups. For platforms that don't provide the
javax.naming API (e.g. Android) javax.naming API (e.g. Android)."""
"""
dependencies { dependencies {
compile project(path: ':core', configuration: 'dns') compile project(path: ':core', configuration: 'dns')
compile 'dnsjava:dnsjava:2.1.1' compile 'dnsjava:dnsjava:2.1.1'
@ -278,24 +244,25 @@ project(':resolver-javax') {
description = """\ description = """\
DNS SRV with Java7 DNS SRV with Java7
Use javax.naming for DNS SRV lookups. The javax.naming API is availabe in JavaSE Use javax.naming for DNS SRV lookups. The javax.naming API is availabe in JavaSE
since Java7. since Java7."""
"""
dependencies { dependencies {
compile project(path: ':core', configuration: 'dns') compile project(path: ':core', configuration: 'dns')
} }
} }
// Now the "real" Smack sub-projects
// Note that test dependencies (junit, ) are interfered from the sourceSet.test of the core sub-project
project(':extensions') { project(':extensions') {
description = """\ description = """\
Smack extensions. Smack extensions.
Classes and methods that implement support for the various XMPP XEPs Classes and methods that implement support for the various XMPP XEPs
(Multi-User Chat, PubSub, ) and other XMPP extensions. (Multi-User Chat, PubSub, ) and other XMPP extensions."""
"""
dependencies { dependencies {
compile project(':core') compile project(':core')
testCompile project(':core').sourceSets.test.runtimeClasspath testCompile project(':core').sourceSets.test.runtimeClasspath
// Test dependencies (junit, ) are interfered from the sourceSet.test of the core project
// So there is no need to add them explicitly here again
} }
} }
@ -304,14 +271,12 @@ project(':experimental') {
Smack experimental extensions. Smack experimental extensions.
Classes and methods for XEPs that are in status 'experimental' or that should Classes and methods for XEPs that are in status 'experimental' or that should
otherwise carefully considered for deployment. The API may change even otherwise carefully considered for deployment. The API may change even
between patch versions. between patch versions."""
"""
dependencies { dependencies {
compile project(':core') compile project(':core')
compile project(':extensions') compile project(':extensions')
testCompile project(':core').sourceSets.test.runtimeClasspath testCompile project(':core').sourceSets.test.runtimeClasspath
// Test dependencies (junit, ) are interfered from the sourceSet.test of the core project
// So there is no need to add them explicitly here again
} }
} }
@ -319,51 +284,45 @@ project(':legacy') {
description = """\ description = """\
Smack legacy extensions. Smack legacy extensions.
Usually XEPs in the state 'retracted', 'rejected', 'deprecated', Usually XEPs in the state 'retracted', 'rejected', 'deprecated',
'obsolete' or in a long standing 'deferred' state. 'obsolete' or in a long standing 'deferred' state."""
"""
dependencies { dependencies {
compile project(':core') compile project(':core')
compile project(':extensions') compile project(':extensions')
testCompile project(':core').sourceSets.test.runtimeClasspath testCompile project(':core').sourceSets.test.runtimeClasspath
// Test dependencies (junit, ) are interfered from the sourceSet.test of the core project
// So there is no need to add them explicitly here again
} }
} }
project(':debug') { project(':debug') {
description = """\ description = """\
Smack GUI debugger. Smack GUI debugger.
Inspect the exchanged XMPP stanzas. Inspect the exchanged XMPP stanzas."""
"""
dependencies { dependencies {
compile project(':core') compile project(':core')
testCompile project(':core').sourceSets.test.runtimeClasspath testCompile project(':core').sourceSets.test.runtimeClasspath
// Test dependencies (junit, ) are interfered from the sourceSet.test of the core project
// So there is no need to add them explicitly here again
} }
} }
project(':jingle') { project(':jingle') {
description = """\ description = """\
Smack Jingle API. Smack Jingle API.
Warning: This API is beta, outdated and currenlty unmaintained. Warning: This API is beta, outdated and currenlty unmaintained."""
"""
dependencies { dependencies {
compile project(':core') compile project(':core')
compile project(':extensions') compile project(':extensions')
compile 'javax.media:jmf:2.1.1e' compile 'javax.media:jmf:2.1.1e'
compile files('libs/jspeex-0.9.7-jfcom.jar', 'libs/jstun.jar', 'libs/Speex.jar') compile files('libs/jspeex-0.9.7-jfcom.jar', 'libs/jstun.jar', 'libs/Speex.jar')
testCompile project(':core').sourceSets.test.runtimeClasspath testCompile project(':core').sourceSets.test.runtimeClasspath
// Test dependencies (junit, ) are interfered from the sourceSet.test of the core project
// So there is no need to add them explicitly here again
} }
} }
project(':bosh') { project(':bosh') {
description = """\ description = """\
Smack BOSH API. Smack BOSH API.
This API is considered beta quality. This API is considered beta quality."""
"""
dependencies { dependencies {
compile project(':core') compile project(':core')
compile 'org.igniterealtime.jbosh:jbosh:0.6.0' compile 'org.igniterealtime.jbosh:jbosh:0.6.0'
@ -378,6 +337,45 @@ This API is considered beta quality.
} }
} }
// This is not really beautifully, but it's the only way I found to add
// the sub-projects description as description element to the POM
subprojects*.uploadArchives {
repositories {
mavenDeployer {
pom.project {
description project.description
}
}
}
}
import org.gradle.plugins.signing.Sign
gradle.taskGraph.whenReady { taskGraph ->
if (signingRequired && taskGraph.allTasks.any { it instanceof Sign }) {
// Use Java 6's console to read from the console (no good for a CI environment)
Console console = System.console()
console.printf '\n\nWe have to sign some things in this build.\n\nPlease enter your signing details.\n\n'
def password = console.readPassword('GnuPG Private Key Password: ')
allprojects { ext.'signing.password' = password }
console.printf '\nThanks.\n\n'
}
}
class CreateFileTask extends DefaultTask {
@Input
String fileContent
@OutputFile
File outputFile
@TaskAction
def createFile() {
outputFile.text = fileContent
}
}
def getGitCommit() { def getGitCommit() {
def dotGit = new File("$projectDir/.git") def dotGit = new File("$projectDir/.git")
if (!dotGit.isDirectory()) return 'non-git build' if (!dotGit.isDirectory()) return 'non-git build'