2014-03-08 11:47:40 +01:00
|
|
|
import org.gradle.plugins.signing.Sign
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
allprojects {
|
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'eclipse'
|
|
|
|
|
|
|
|
ext {
|
2014-05-24 16:02:28 +02:00
|
|
|
shortVersion = '4.1.0-alpha1'
|
|
|
|
isSnapshot = true
|
2014-02-14 18:13:51 +01:00
|
|
|
gitCommit = getGitCommit()
|
|
|
|
javadocAllDir = new File(buildDir, 'javadoc')
|
|
|
|
documentationDir = new File(projectDir, 'documentation')
|
2014-02-18 10:51:24 +01:00
|
|
|
releasedocsDir = new File(buildDir, 'releasedocs')
|
2014-02-14 18:13:51 +01:00
|
|
|
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())
|
2014-02-19 23:26:56 +01:00
|
|
|
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
|
2014-07-15 18:00:55 +02:00
|
|
|
jxmppVersion = "0.2.0"
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
group = 'org.igniterealtime.smack'
|
2014-03-23 23:12:15 +01:00
|
|
|
sourceCompatibility = 1.7
|
2014-02-14 18:13:51 +01:00
|
|
|
version = shortVersion
|
|
|
|
if (isSnapshot) {
|
|
|
|
version += '-SNAPSHOT'
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.sharedManifest = manifest {
|
|
|
|
attributes('Implementation-Version': version,
|
|
|
|
'Implementation-GitRevision': ext.gitCommit,
|
2014-04-28 11:22:42 +02:00
|
|
|
// According to OSGi core 5.0 section 3.2.5 the qualifier (the fourth
|
|
|
|
// version element) must begin with a dot. So we replace only the
|
|
|
|
// first occurence of an dash with a dot.
|
|
|
|
// For example 4.0.0-rc1 becomes 4.0.0.rc1, but
|
|
|
|
// 4.0.0-SNAPSHOT-2014-05-01 becomes 4.0.0.SNAPSHOT-2014-05-01
|
2014-06-22 18:18:04 +02:00
|
|
|
'Bundle-Version': version.replaceFirst("-", "."),
|
|
|
|
'Built-Date': new Date(),
|
|
|
|
'Built-JDK': System.getProperty('java.version'),
|
|
|
|
'Built-Gradle': gradle.gradleVersion,
|
|
|
|
'Built-By': System.getProperty('user.name')
|
|
|
|
)
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
2014-05-11 09:38:13 +02:00
|
|
|
|
|
|
|
eclipse {
|
|
|
|
classpath {
|
|
|
|
downloadJavadoc = true
|
|
|
|
}
|
|
|
|
}
|
2014-06-01 12:23:13 +02:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
// Add OSS Sonatype Snapshot repository
|
|
|
|
maven {
|
|
|
|
url 'https://oss.sonatype.org/content/repositories/snapshots'
|
|
|
|
}
|
|
|
|
}
|
2014-04-17 12:51:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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: ')
|
2014-03-08 11:47:40 +01:00
|
|
|
|
2014-04-17 12:51:54 +02:00
|
|
|
allprojects { ext.'signing.password' = password }
|
2014-03-08 11:47:40 +01:00
|
|
|
|
2014-04-17 12:51:54 +02:00
|
|
|
console.printf '\nThanks.\n\n'
|
2014-03-08 11:47:40 +01:00
|
|
|
}
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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})
|
2014-06-17 12:08:36 +02:00
|
|
|
options.linkSource = true
|
|
|
|
options.use = true
|
|
|
|
options.links = ["http://docs.oracle.com/javase/$sourceCompatibility/docs/api/"] as String[]
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2014-06-26 22:44:31 +02:00
|
|
|
// Disable upload archives for the root project
|
|
|
|
uploadArchives.enabled = false
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
description = """\
|
|
|
|
Smack ${version}
|
2014-02-19 23:26:56 +01:00
|
|
|
${oneLineDesc}."""
|
2014-02-14 18:13:51 +01:00
|
|
|
|
2014-05-10 21:00:40 +02:00
|
|
|
evaluationDependsOnChildren()
|
2014-02-14 18:13:51 +01:00
|
|
|
subprojects {
|
2014-04-28 17:10:53 +02:00
|
|
|
apply plugin: 'maven'
|
2014-02-14 18:13:51 +01:00
|
|
|
apply plugin: 'osgi'
|
|
|
|
apply plugin: 'signing'
|
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
|
|
|
|
checkstyle {
|
|
|
|
configFile = new File(rootConfigDir, 'checkstyle.xml')
|
|
|
|
}
|
|
|
|
repositories {
|
2014-04-17 13:43:25 +02:00
|
|
|
mavenLocal()
|
2014-02-14 18:13:51 +01:00
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
|
|
classifier = 'javadoc'
|
|
|
|
from javadoc.destinationDir
|
|
|
|
}
|
|
|
|
artifacts {
|
|
|
|
archives sourcesJar
|
|
|
|
archives javadocJar
|
|
|
|
}
|
2014-05-10 21:00:40 +02:00
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2014-05-10 21:00:40 +02:00
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
pom.project {
|
|
|
|
name 'Smack'
|
|
|
|
packaging 'jar'
|
2014-02-19 23:26:56 +01:00
|
|
|
inceptionYear '2003'
|
2014-02-14 18:13:51 +01:00
|
|
|
url 'http://www.igniterealtime.org/projects/smack/'
|
2014-05-10 21:00:40 +02:00
|
|
|
description project.description
|
|
|
|
|
2014-02-18 10:51:24 +01:00
|
|
|
issueManagement {
|
|
|
|
system 'JIRA'
|
2014-06-22 22:44:00 +02:00
|
|
|
url 'https://igniterealtime.org/issues/browse/SMACK'
|
2014-02-18 10:51:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
distributionManagement {
|
|
|
|
snapshotRepository {
|
|
|
|
id 'smack.snapshot'
|
|
|
|
url project.sonatypeSnapshotUrl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
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) {
|
2014-06-27 12:22:45 +02:00
|
|
|
include "$libsDirName/*${version}.jar"
|
|
|
|
include "$libsDirName/*${version}-javadoc.jar"
|
|
|
|
include "$libsDirName/*${version}-sources.jar"
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
signing {
|
|
|
|
required { signingRequired }
|
|
|
|
sign configurations.archives
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-17 18:01:36 +02:00
|
|
|
['smack-resolver-javax', 'smack-extensions', 'smack-experimental', 'smack-legacy'].each { name ->
|
2014-05-15 15:04:46 +02:00
|
|
|
project(":$name") {
|
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
instruction 'Service-Component', "org.jivesoftware.smackx/$name-components.xml"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-30 22:35:18 +02:00
|
|
|
subprojects*.jar {
|
|
|
|
manifest {
|
|
|
|
from sharedManifest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
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
|
|
|
|
}
|