mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-12 19:02:06 +01:00
89dc3a0e85
This commit marks an important milestone with the addition of the smack-android subproject. Smack is now able to run native on Android without requiring any modifications, which makes the aSmack build environment obsolete. It was necessary to redesign the code for SASL authentication to achieve this. Smack now comes with smack-sasl-provided for SASL implementations that do not rely on additional APIs like javax for platforms where those APIs are not available like Android.
265 lines
6.9 KiB
Groovy
265 lines
6.9 KiB
Groovy
import org.gradle.plugins.signing.Sign
|
|
|
|
allprojects {
|
|
apply plugin: 'java'
|
|
apply plugin: 'eclipse'
|
|
|
|
ext {
|
|
shortVersion = '4.1.0-alpha1'
|
|
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'
|
|
// Returns only the date in yyyy-MM-dd format, as otherwise, with
|
|
// hh:mm:ss information, the manifest files would change with every
|
|
// build, causing unnecessary rebuilds.
|
|
buildDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
|
|
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
|
|
jxmppVersion = "0.2.0"
|
|
}
|
|
group = 'org.igniterealtime.smack'
|
|
sourceCompatibility = 1.7
|
|
version = shortVersion
|
|
if (isSnapshot) {
|
|
version += '-SNAPSHOT'
|
|
}
|
|
|
|
ext.sharedManifest = manifest {
|
|
attributes('Implementation-Version': version,
|
|
'Implementation-GitRevision': ext.gitCommit,
|
|
// 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
|
|
'Bundle-Version': version.replaceFirst("-", "."),
|
|
'Built-Date': ext.buildDate,
|
|
'Built-JDK': System.getProperty('java.version'),
|
|
'Built-Gradle': gradle.gradleVersion,
|
|
'Built-By': System.getProperty('user.name')
|
|
)
|
|
}
|
|
|
|
eclipse {
|
|
classpath {
|
|
downloadJavadoc = true
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
// Add OSS Sonatype Snapshot repository
|
|
maven {
|
|
url 'https://oss.sonatype.org/content/repositories/snapshots'
|
|
}
|
|
}
|
|
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
}
|
|
|
|
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'
|
|
}
|
|
}
|
|
|
|
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})
|
|
options.linkSource = true
|
|
options.use = true
|
|
options.links = ["http://docs.oracle.com/javase/$sourceCompatibility/docs/api/"] as String[]
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// Disable upload archives for the root project
|
|
uploadArchives.enabled = false
|
|
|
|
description = """\
|
|
Smack ${version}
|
|
${oneLineDesc}."""
|
|
|
|
evaluationDependsOnChildren()
|
|
subprojects {
|
|
apply plugin: 'maven'
|
|
apply plugin: 'osgi'
|
|
apply plugin: 'signing'
|
|
apply plugin: 'checkstyle'
|
|
|
|
checkstyle {
|
|
configFile = new File(rootConfigDir, 'checkstyle.xml')
|
|
}
|
|
repositories {
|
|
mavenLocal()
|
|
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
|
|
}
|
|
|
|
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/'
|
|
description project.description
|
|
|
|
issueManagement {
|
|
system 'JIRA'
|
|
url 'https://igniterealtime.org/issues/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/*${version}.jar"
|
|
include "$libsDirName/*${version}-javadoc.jar"
|
|
include "$libsDirName/*${version}-sources.jar"
|
|
}
|
|
}
|
|
signing {
|
|
required { signingRequired }
|
|
sign configurations.archives
|
|
}
|
|
}
|
|
|
|
['smack-extensions', 'smack-experimental', 'smack-legacy'].each { name ->
|
|
project(":$name") {
|
|
jar {
|
|
manifest {
|
|
instruction 'Service-Component', "org.jivesoftware.smackx/$name-components.xml"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
['smack-resolver-javax', 'smack-sasl-javax', 'smack-sasl-provided'].each { name ->
|
|
project(":$name") {
|
|
jar {
|
|
manifest {
|
|
instruction 'Service-Component', "org.jivesoftware.smack/$name-components.xml"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects*.jar {
|
|
manifest {
|
|
from sharedManifest
|
|
}
|
|
}
|
|
|
|
def getGitCommit() {
|
|
def dotGit = new File("$projectDir/.git")
|
|
if (!dotGit.isDirectory()) return 'non-git build'
|
|
|
|
def cmd = 'git describe --always --tags --dirty=+'
|
|
def proc = cmd.execute()
|
|
def gitCommit = proc.text.trim()
|
|
assert !gitCommit.isEmpty()
|
|
gitCommit
|
|
}
|