mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 12:12:06 +01:00
388 lines
9.5 KiB
Groovy
388 lines
9.5 KiB
Groovy
allprojects {
|
|
apply plugin: 'java'
|
|
apply plugin: 'maven'
|
|
apply plugin: 'eclipse'
|
|
|
|
ext {
|
|
shortVersion = '4.0.0'
|
|
isSnapshot = true
|
|
gitCommit = getGitCommit()
|
|
javadocAllDir = new File(buildDir, 'javadoc')
|
|
documentationDir = new File(projectDir, 'documentation')
|
|
releasedocsDir = new File(buildDir, 'releasedocs')
|
|
rootConfigDir = new File(rootDir, 'config')
|
|
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
|
|
isReleaseVersion = !isSnapshot
|
|
signingRequired = isReleaseVersion
|
|
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
|
|
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
|
buildDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
|
|
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
|
|
}
|
|
group = 'org.igniterealtime.smack'
|
|
sourceCompatibility = 1.6
|
|
version = shortVersion
|
|
if (isSnapshot) {
|
|
version += '-SNAPSHOT'
|
|
}
|
|
|
|
ext.sharedManifest = manifest {
|
|
attributes('Implementation-Version': version,
|
|
'Implementation-GitRevision': ext.gitCommit,
|
|
'Bundle-Version': version)
|
|
}
|
|
}
|
|
|
|
task javadocAll(type: Javadoc) {
|
|
source subprojects.collect {project ->
|
|
project.sourceSets.main.allJava }
|
|
destinationDir = javadocAllDir
|
|
// Might need a classpath
|
|
classpath = files(subprojects.collect {project ->
|
|
project.sourceSets.main.compileClasspath})
|
|
}
|
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
task prepareReleasedocs(type: Copy) {
|
|
from 'resources/releasedocs'
|
|
into releasedocsDir
|
|
filter(ReplaceTokens, tokens: [version: version, releasedate: buildDate])
|
|
}
|
|
|
|
task distributionZip(type: Zip, dependsOn: [javadocAll, prepareReleasedocs]) {
|
|
classifier buildDate
|
|
into ('javadoc') {
|
|
from(javadocAllDir)
|
|
}
|
|
into ('releasedocs') {
|
|
from(releasedocsDir)
|
|
}
|
|
into ('releasedocs/documentation') {
|
|
from(documentationDir)
|
|
}
|
|
}
|
|
|
|
jar {
|
|
// Root project should not create empty jar artifact
|
|
enabled = false
|
|
}
|
|
|
|
description = """\
|
|
Smack ${version}
|
|
${oneLineDesc}."""
|
|
|
|
subprojects {
|
|
apply plugin: 'osgi'
|
|
apply plugin: 'signing'
|
|
apply plugin: 'checkstyle'
|
|
|
|
checkstyle {
|
|
configFile = new File(rootConfigDir, 'checkstyle.xml')
|
|
}
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
tasks.withType(Jar) {
|
|
baseName = 'smack'
|
|
appendix project.name
|
|
}
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
appendix project.name
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
appendix project.name
|
|
classifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
}
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
}
|
|
uploadArchives {
|
|
repositories {
|
|
mavenDeployer {
|
|
if (signingRequired) {
|
|
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
|
}
|
|
repository(url: project.sonatypeStagingUrl) {
|
|
if (sonatypeCredentialsAvailable) {
|
|
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
|
}
|
|
}
|
|
snapshotRepository(url: project.sonatypeSnapshotUrl) {
|
|
if (sonatypeCredentialsAvailable) {
|
|
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
|
}
|
|
}
|
|
pom.project {
|
|
name 'Smack'
|
|
packaging 'jar'
|
|
inceptionYear '2003'
|
|
url 'http://www.igniterealtime.org/projects/smack/'
|
|
|
|
issueManagement {
|
|
system 'JIRA'
|
|
url 'http://issues.igniterealtime.org/browse/SMACK'
|
|
}
|
|
|
|
distributionManagement {
|
|
snapshotRepository {
|
|
id 'smack.snapshot'
|
|
url project.sonatypeSnapshotUrl
|
|
}
|
|
}
|
|
|
|
scm {
|
|
url 'https://github.com/igniterealtime/Smack'
|
|
connection 'scm:git:https://github.com/igniterealtime/Smack.git'
|
|
developerConnection 'scm:git:https://github.com/igniterealtime/Smack.git'
|
|
}
|
|
|
|
licenses {
|
|
license {
|
|
name 'The Apache Software License, Version 2.0'
|
|
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
distribution 'repo'
|
|
}
|
|
}
|
|
|
|
developers {
|
|
developer {
|
|
id 'flow'
|
|
name 'Florian Schmaus'
|
|
email 'flow@igniterealtime.org'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
rootProject.distributionZip {
|
|
dependsOn build
|
|
from(buildDir) {
|
|
include "$libsDirName/**"
|
|
}
|
|
}
|
|
signing {
|
|
required { signingRequired }
|
|
sign configurations.archives
|
|
}
|
|
}
|
|
|
|
project(':core') {
|
|
description = """\
|
|
Smack core components."""
|
|
|
|
configurations {
|
|
compression
|
|
dns
|
|
}
|
|
dependencies {
|
|
compile 'xpp3:xpp3:1.1.4c'
|
|
testCompile 'junit:junit:4.+'
|
|
testCompile 'xmlunit:xmlunit:1.5'
|
|
testCompile 'org.powermock:powermock-module-junit4:1.5.+'
|
|
testCompile 'org.powermock:powermock-api-mockito:1.5.+'
|
|
testCompile 'com.jamesmurty.utils:java-xmlbuilder:0.6+'
|
|
}
|
|
jar {
|
|
manifest {
|
|
attributes('Bundle-SymbolicName': project.group)
|
|
from sharedManifest
|
|
}
|
|
}
|
|
task compressionJar(type: Jar) {
|
|
appendix += '-compression'
|
|
dependsOn classes
|
|
from sourceSets.main.output
|
|
include('org/jivesoftware/smack/compression/**')
|
|
}
|
|
task dnsJar(type: Jar) {
|
|
appendix += '-dns'
|
|
dependsOn classes
|
|
from sourceSets.main.output
|
|
include('org/jivesoftware/smack/util/dns/**')
|
|
include('org/jivesoftware/smack/util/DNSUtil.class')
|
|
}
|
|
artifacts {
|
|
compression compressionJar
|
|
dns dnsJar
|
|
}
|
|
task createVersionResource(type: CreateFileTask) {
|
|
fileContent = version
|
|
outputFile = new File(projectDir, 'src/main/resources/org.jivesoftware.smack/version')
|
|
}
|
|
compileJava.dependsOn(createVersionResource)
|
|
}
|
|
|
|
project(':compression-jzlib') {
|
|
description = """\
|
|
Compression with jzlib
|
|
Allow to compress the XMPP stream with help of jzlib."""
|
|
|
|
dependencies {
|
|
compile project(path: ':core', configuration: 'compression')
|
|
compile 'com.jcraft:jzlib:1.1.3'
|
|
}
|
|
}
|
|
|
|
project(':resolver-dnsjava') {
|
|
description = """\
|
|
DNS SRV with dnsjava
|
|
Use dnsjava for DNS SRV lookups. For platforms that don't provide the
|
|
javax.naming API (e.g. Android)."""
|
|
|
|
dependencies {
|
|
compile project(path: ':core', configuration: 'dns')
|
|
compile 'dnsjava:dnsjava:2.1.1'
|
|
}
|
|
}
|
|
|
|
project(':resolver-javax') {
|
|
description = """\
|
|
DNS SRV with Java7
|
|
Use javax.naming for DNS SRV lookups. The javax.naming API is availabe in JavaSE
|
|
since Java7."""
|
|
|
|
dependencies {
|
|
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') {
|
|
description = """\
|
|
Smack extensions.
|
|
Classes and methods that implement support for the various XMPP XEPs
|
|
(Multi-User Chat, PubSub, …) and other XMPP extensions."""
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
testCompile project(':core').sourceSets.test.runtimeClasspath
|
|
}
|
|
}
|
|
|
|
project(':experimental') {
|
|
description = """\
|
|
Smack experimental extensions.
|
|
Classes and methods for XEPs that are in status 'experimental' or that should
|
|
otherwise carefully considered for deployment. The API may change even
|
|
between patch versions."""
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
compile project(':extensions')
|
|
testCompile project(':core').sourceSets.test.runtimeClasspath
|
|
}
|
|
}
|
|
|
|
project(':legacy') {
|
|
description = """\
|
|
Smack legacy extensions.
|
|
Usually XEPs in the state 'retracted', 'rejected', 'deprecated',
|
|
'obsolete' or in a long standing 'deferred' state."""
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
compile project(':extensions')
|
|
testCompile project(':core').sourceSets.test.runtimeClasspath
|
|
}
|
|
}
|
|
|
|
project(':debug') {
|
|
description = """\
|
|
Smack GUI debugger.
|
|
Inspect the exchanged XMPP stanzas."""
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
testCompile project(':core').sourceSets.test.runtimeClasspath
|
|
}
|
|
}
|
|
|
|
project(':jingle') {
|
|
description = """\
|
|
Smack Jingle API.
|
|
Warning: This API is beta, outdated and currenlty unmaintained."""
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
compile project(':extensions')
|
|
compile 'javax.media:jmf:2.1.1e'
|
|
compile files('libs/jspeex-0.9.7-jfcom.jar', 'libs/jstun.jar', 'libs/Speex.jar')
|
|
testCompile project(':core').sourceSets.test.runtimeClasspath
|
|
}
|
|
}
|
|
|
|
project(':bosh') {
|
|
description = """\
|
|
Smack BOSH API.
|
|
This API is considered beta quality."""
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
compile 'org.igniterealtime.jbosh:jbosh:0.7.0'
|
|
}
|
|
}
|
|
|
|
(subprojects - project(':core'))*.jar {
|
|
manifest {
|
|
attributes('Bundle-SymbolicName': project.group + '-' + appendix,
|
|
'Fragment-Host': project.group)
|
|
from sharedManifest
|
|
}
|
|
}
|
|
|
|
// 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 dotGit = new File("$projectDir/.git")
|
|
if (!dotGit.isDirectory()) return 'non-git build'
|
|
|
|
def cmd = 'git describe --tags --dirty=+'
|
|
def proc = cmd.execute()
|
|
def gitCommit = proc.text.trim()
|
|
assert !gitCommit.isEmpty()
|
|
gitCommit
|
|
}
|