1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00
Smack/build.gradle

628 lines
18 KiB
Groovy
Raw Normal View History

import org.gradle.plugins.signing.Sign
2014-08-16 00:09:55 +02:00
buildscript {
repositories {
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://dl.bintray.com/content/aalmiray/kordamp' }
2014-08-16 00:09:55 +02:00
}
dependencies {
classpath 'org.kordamp:markdown-gradle-plugin:1.0.0'
2017-05-16 09:47:22 +02:00
classpath 'org.kordamp.gradle:clirr-gradle-plugin:0.2.2'
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1"
2014-08-16 00:09:55 +02:00
}
}
plugins {
2018-07-30 11:51:20 +02:00
id 'ru.vyarus.animalsniffer' version '1.4.5'
id 'net.ltgt.errorprone' version '0.6'
}
2014-08-16 00:09:55 +02:00
apply plugin: 'org.kordamp.gradle.markdown'
2014-11-04 14:43:41 +01:00
apply from: 'version.gradle'
2014-02-14 18:13:51 +01:00
allprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
2017-04-24 22:58:52 +02:00
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'net.ltgt.errorprone'
2014-02-14 18:13:51 +01:00
ext {
gitCommit = getGitCommit()
javadocAllDir = new File(buildDir, 'javadoc')
2014-08-16 00:09:55 +02:00
documentationDir = new File(buildDir, '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'
// 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.
2014-08-08 15:08:43 +02:00
builtDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
integrationTestProjects = [
':smack-integration-test',
':smack-omemo-signal-integration-test',
].collect{ project(it) }
javadocAllProjects = subprojects - integrationTestProjects
// A dirty hack used for Gradle's jacoco plugin, since is not
// hable to handle the case when a (sub)project has no unit
// tests. :-(
projectsWithoutUnitTests = [
':smack-android',
':smack-android-extensions',
':smack-bosh',
':smack-compression-jzlib',
':smack-debug',
':smack-debug-slf4j',
':smack-java7',
':smack-jingle-old',
':smack-resolver-dnsjava',
':smack-resolver-javax',
':smack-resolver-minidns',
':smack-omemo-signal-integration-test',
].collect{ project(it) }
projectsWithUnitTests = subprojects - projectsWithoutUnitTests
androidProjects = [
':smack-tcp',
':smack-bosh',
':smack-core',
':smack-im',
':smack-resolver-minidns',
':smack-sasl-provided',
':smack-extensions',
':smack-experimental',
':smack-omemo',
':smack-omemo-signal',
':smack-openpgp',
].collect{ project(it) }
2015-03-21 18:56:27 +01:00
androidBootClasspathProjects = [
':smack-android',
':smack-android-extensions',
].collect{ project(it) }
androidOptionalProjects = [
':smack-tcp',
':smack-extensions',
':smack-experimental',
':smack-bosh',
':smack-omemo',
':smack-omemo-signal',
].collect{ project(it) }
gplLicensedProjects = [
':smack-omemo-signal',
':smack-omemo-signal-integration-test',
].collect{ project(it) }
androidBootClasspath = getAndroidRuntimeJar()
androidJavadocOffline = getAndroidJavadocOffline()
2018-05-09 19:59:39 +02:00
junitVersion = '5.2.0'
2014-02-14 18:13:51 +01:00
}
group = 'org.igniterealtime.smack'
sourceCompatibility = 1.7
targetCompatibility = sourceCompatibility
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,
// 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("-", "."),
2014-08-08 15:08:43 +02:00
'Built-Date': ext.builtDate,
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion,
'Built-By': System.getProperty('user.name')
)
2014-02-14 18:13:51 +01:00
}
eclipse {
classpath {
downloadJavadoc = true
}
}
repositories {
mavenLocal()
mavenCentral()
// Add OSS Sonatype Snapshot repository
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
2014-07-25 09:26:26 +02:00
tasks.withType(JavaCompile) {
2014-08-19 00:46:59 +02:00
// Some systems may not have set their platform default
// converter to 'utf8', but we use unicode in our source
// files. Therefore ensure that javac uses unicode
options.encoding = 'UTF-8'
options.compilerArgs = [
'-Xlint:all',
// Set '-options' because a non-java7 javac will emit a
// warning if source/traget is set to 1.7 and
// bootclasspath is *not* set.
// TODO implement a sound heuristic to determine a java7
// rt.jar on the build host. And if none is found,
// fallback to using a environment variable,
// e.g. JAVA7_HOME. See SMACK-651.
'-Xlint:-options',
'-Werror',
]
options.errorprone.errorproneArgs = [
// Disable errorprone checks
'-Xep:TypeParameterUnusedInFormals:OFF',
2018-03-28 15:56:04 +02:00
// Disable errorpone StringSplitter check, as it
// recommends using Splitter from Guava, which we don't
// have (nor want to use in Smack).
'-Xep:StringSplitter:OFF',
'-Xep:JdkObsolete:OFF',
// Disabled because sinttest re-uses BeforeClass from junit.
// TODO: change sinttest so that it has it's own
// BeforeClass and re-enable this check.
'-Xep:JUnit4ClassAnnotationNonStatic:OFF',
// Disabled but should be re-enabled at some point
//'-Xep:InconsistentCapitalization:OFF',
]
2014-08-19 00:46:59 +02:00
}
jacoco {
2018-03-27 19:07:03 +02:00
toolVersion = "0.8.1"
}
jacocoTestReport {
dependsOn test
sourceDirectories = project.files(sourceSets.main.allSource.srcDirs)
classDirectories = project.files(sourceSets.main.output)
reports {
xml.enabled true
}
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// The '-quiet' as second argument is actually a hack,
// since the one paramater addStringOption doesn't seem to
// work, we extra add '-quiet', which is added anyway by
// gradle.
options.addStringOption('Xdoclint:all', '-quiet')
// TODO: Add
// Treat warnings as errors.
// See also https://bugs.openjdk.java.net/browse/JDK-8200363
// options.addStringOption('Xwerror', '-quiet')
// after all javadoc warnings have been resolved and
// remove Xwerror from the subprojects build.gradle files
// (e.g. smack-android-extensions).
}
}
2015-04-04 18:46:07 +02:00
tasks.withType(Javadoc) {
options.charSet = "UTF-8"
options.encoding = 'UTF-8'
2015-04-04 18:46:07 +02:00
}
2015-11-16 15:07:40 +01:00
2018-03-28 15:56:04 +02:00
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
2015-11-16 15:07:40 +01:00
}
// Make all project's 'test' target depend on javadoc, so that
// javadoc is also linted.
test { dependsOn javadoc }
}
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)
build.gradle: Use "def console" as otherwhise there may be a GroovyCastException: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'java.io.Console@148b13e5' with class 'java.io.Console' to class 'org.gradle.api.tasks.Console' at build_5dq456k95ni7h1f54hn45uzb7$_run_closure2.doCall(/home/flo/data/code/smack/build.gradle:194) at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40) at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25) at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42) at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:221) at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:145) at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58) at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:315) at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:225) at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:138) at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:35) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy59.graphPopulated(Unknown Source) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:111) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:230) at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:227) at org.gradle.internal.Transformers$4.transform(Transformers.java:169) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:161) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:95) at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49) at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49) at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:281) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:254) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:247) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:182) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) with some Gradle versions.
2017-07-03 10:32:20 +02:00
def console = System.console()
if (console == null) {
throw new Exception("Could not obtain system console (Console is 'null'). Did you build with gradle daemon? Try the same Gradle command with \"--no-daemon\".")
}
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'
}
2014-02-14 18:13:51 +01:00
}
task javadocAll(type: Javadoc) {
source javadocAllProjects.collect {project ->
2014-02-14 18:13:51 +01:00
project.sourceSets.main.allJava }
destinationDir = javadocAllDir
// Might need a classpath
classpath = files(subprojects.collect {project ->
project.sourceSets.main.compileClasspath})
2015-03-21 18:56:27 +01:00
classpath += files(androidBootClasspath)
options {
linkSource = true
use = true
links = [
2018-04-23 21:26:19 +02:00
"https://docs.oracle.com/javase/${sourceCompatibility.getMajorVersion()}/docs/api/",
"https://jxmpp.org/releases/$jxmppVersion/javadoc/",
"https://minidns.org/releases/$miniDnsVersion/javadoc/",
2015-03-21 18:56:27 +01:00
] as String[]
2018-08-02 17:02:08 +02:00
overview = "$projectDir/resources/javadoc-overview.html"
}
2014-02-14 18:13:51 +01:00
}
import org.apache.tools.ant.filters.ReplaceTokens
task prepareReleasedocs(type: Copy) {
from 'resources/releasedocs'
into releasedocsDir
2014-08-08 15:08:43 +02:00
filter(ReplaceTokens, tokens: [version: version, releasedate: builtDate, targetCompatibility: targetCompatibility.toString()])
2014-02-14 18:13:51 +01:00
}
2014-08-16 00:09:55 +02:00
markdownToHtml {
sourceDir = new File(projectDir, "/documentation")
outputDir documentationDir
configuration = [tables: true, fencedCodeBlocks: true]
}
task distributionZip(type: Zip, dependsOn: [javadocAll, prepareReleasedocs, markdownToHtml]) {
2014-08-08 15:08:43 +02:00
classifier builtDate
2014-02-14 18:13:51 +01:00
into ('javadoc') {
from(javadocAllDir)
}
into ('releasedocs') {
from(releasedocsDir)
}
into ('releasedocs/documentation') {
from(documentationDir)
}
}
task maybeCheckForSnapshotDependencies {
// Don't check for Snapshot dependencies if this is a snapshot.
onlyIf { isReleaseVersion }
// Run in the execution phase, not in configuration phase, as the
// 'each' forces the runtime configuration to be resovled, which
// causes "Cannot change dependencies of configuration after it
// has been included in dependency resolution." errors.
// See https://discuss.gradle.org/t/23153
doLast {
allprojects { project ->
project.configurations.runtime.each {
if (it.toString().contains("-SNAPSHOT"))
throw new Exception("Release build contains snapshot dependencies: " + it)
}
}
}
}
test { dependsOn maybeCheckForSnapshotDependencies }
2014-02-14 18:13:51 +01:00
jar {
// Root project should not create empty jar artifact
enabled = false
}
// Disable upload archives for the root project
uploadArchives.enabled = false
2014-02-14 18:13:51 +01:00
description = """\
Smack ${version}
${oneLineDesc}."""
2014-02-14 18:13:51 +01:00
evaluationDependsOnChildren()
2014-02-14 18:13:51 +01:00
subprojects {
apply plugin: 'maven'
2014-02-14 18:13:51 +01:00
apply plugin: 'osgi'
apply plugin: 'signing'
apply plugin: 'checkstyle'
apply plugin: 'org.kordamp.gradle.clirr'
2014-02-14 18:13:51 +01:00
checkstyle {
configFile = new File(rootConfigDir, 'checkstyle.xml')
2018-05-09 21:14:52 +02:00
toolVersion = '8.10'
2014-02-14 18:13:51 +01:00
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task testJar(type: Jar, dependsOn: testClasses) {
2014-08-12 21:58:04 +02:00
classifier = 'tests'
from sourceSets.test.output
}
// Does install unique snapshosts (and release)s in the local maven
// repository, unlike the 'install' task.
// You can specify the path of the local maven repository using 'maven.repo.local', e.g.
// gradle uploadLocal -Dmaven.repo.local=/var/www/repo
task uploadLocal(type: Upload) {
description "Uploads artifacts into the local maven repositories URL."
configuration = configurations['archives']
repositories {
mavenDeployer {
repository url: repositories.mavenLocal().url
}
}
}
configurations {
archivesOutput.extendsFrom (testCompile)
}
2014-02-14 18:13:51 +01:00
artifacts {
archives sourcesJar
archives javadocJar
2014-08-12 21:58:04 +02:00
archives testJar
// See http://stackoverflow.com/a/21946676/194894
testRuntime testJar
2014-02-14 18:13:51 +01: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-02-14 18:13:51 +01:00
pom.project {
name 'Smack'
packaging 'jar'
inceptionYear '2003'
2014-02-14 18:13:51 +01:00
url 'http://www.igniterealtime.org/projects/smack/'
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'
}
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"
2014-02-14 18:13:51 +01:00
}
}
signing {
required { signingRequired }
sign configurations.archives
}
clirr {
2017-08-14 20:50:41 +02:00
// 2018-08-14: Disabled Clirr because
// - It reports an breaking change in android.jar (seems right, but there is nothing we can do about it)
// - Only the first smack-* projects are correctly checked,
// the other ones have the output of a clirr report from a previous project
// (Look at the clirr reports).
enabled false
2015-03-12 13:22:11 +01:00
semver false
}
2014-02-14 18:13:51 +01:00
}
configure (androidProjects + androidBootClasspathProjects) {
apply plugin: 'ru.vyarus.animalsniffer'
dependencies {
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:2.3.1_r2@signature"
}
animalsniffer {
sourceSets = [sourceSets.main]
}
}
// There is no need to ever clirr integration test projects and the
// smack-repl project.
configure(integrationTestProjects + project(':smack-repl')) {
clirr {
enabled false
}
}
// Disable clirr on omemo modules
project(':smack-omemo').clirr.enabled = false
project(':smack-omemo-signal').clirr.enabled = false
2017-08-14 14:32:26 +02:00
configure(
[ ':smack-omemo',
':smack-omemo-signal',
':smack-omemo-signal-integration-test',
].collect{ project(it) }) {
}
subprojects*.jar {
manifest {
from sharedManifest
}
}
configure(subprojects - gplLicensedProjects) {
checkstyle {
configProperties.checkstyleLicenseHeader = "header"
}
uploadArchives {
repositories {
mavenDeployer {
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
}
}
}
configure(gplLicensedProjects) {
checkstyle {
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
}
uploadArchives {
repositories {
mavenDeployer {
pom.project {
licenses {
license {
name 'GNU General Public License, version 3 or any later version'
url 'https://www.gnu.org/licenses/gpl.txt'
distribution 'repo'
}
}
}
}
}
}
}
2015-03-21 18:56:27 +01:00
configure(androidBootClasspathProjects) {
compileJava {
options.bootstrapClasspath = files(androidBootClasspath)
2015-03-21 18:56:27 +01:00
}
javadoc {
classpath += files(androidBootClasspath)
}
}
apply plugin: "com.github.kt3k.coveralls"
coveralls {
sourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = projectsWithUnitTests.jacocoTestReport
sourceDirectories = files(projectsWithUnitTests.sourceSets.main.allSource.srcDirs)
classDirectories = files(projectsWithUnitTests.sourceSets.main.output)
executionData = files(projectsWithUnitTests.jacocoTestReport.executionData)
reports {
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
// We could remove the following setOnlyIf line, but then
// jacocoRootReport would silently be SKIPPED if something with
// the projectsWithUnitTests is wrong (e.g. a project is missing
// in there).
setOnlyIf { true }
}
// Important to specify this task after the subprojects block
task clirrRootReport(type: org.kordamp.gradle.clirr.ClirrReportTask) {
dependsOn = subprojects.tasks.clirr
2015-03-12 13:22:11 +01:00
reports = files((subprojects.findAll { it.clirr.enabled == true }).tasks.clirr.xmlReport)
}
task integrationTest {
Rework support for XEP-0384: OMEMO Encryption Changes: Rework integration tests New structure of base integration test classes bump dependency on signal-protocol-java from 2.4.0 to 2.6.2 Introduced CachingOmemoStore implementations Use CachingOmemoStore classes in integration tests Removed OmemoSession classes (replaced with more logical OmemoRatchet classes) Consequently also removed load/storeOmemoSession methods from OmemoStore Removed some clutter from KeyUtil classes Moved trust decision related code from OmemoStore to TrustCallback Require authenticated connection for many functions Add async initialization function in OmemoStore Refactor omemo test package (/java/org/jivesoftware/smack/omemo -> /java/org/jivesoftware/smackx) Remove OmemoStore method isFreshInstallation() as well as defaultDeviceId related stuff FileBasedOmemoStore: Add cleaner methods to store/load base data types (Using tryWithResource, only for future releases, once Android API gets bumped) Attempt to make OmemoManager thread safe new logic for getInstanceFor() deviceId determination OmemoManagers encrypt methods now don't throw exceptions when encryption for some devices fails. Instead message gets encrypted when possible and more information about failures gets returned alongside the message itself Added OmemoMessage class for that purpose Reworked entire OmemoService class Use safer logic for creating trust-ignoring messages (like ratchet-update messages) Restructure elements/provider in order to prepare for OMEMO namespace bumps Remove OmemoManager.regenerate() methods in favor of getInstanceFor(connection, randomDeviceId) Removed some unnecessary configuration options Prepare for support of more AES message key types Simplify session creation Where possible, avoid side effects in methods Add UntrustedOmemoIdentityException Add TrustState enum More improved tests
2018-06-13 12:29:16 +02:00
description 'Verify correct functionality of Smack by running some integration tests.'
dependsOn project(':smack-integration-test').tasks.run
}
task omemoSignalIntTest {
Rework support for XEP-0384: OMEMO Encryption Changes: Rework integration tests New structure of base integration test classes bump dependency on signal-protocol-java from 2.4.0 to 2.6.2 Introduced CachingOmemoStore implementations Use CachingOmemoStore classes in integration tests Removed OmemoSession classes (replaced with more logical OmemoRatchet classes) Consequently also removed load/storeOmemoSession methods from OmemoStore Removed some clutter from KeyUtil classes Moved trust decision related code from OmemoStore to TrustCallback Require authenticated connection for many functions Add async initialization function in OmemoStore Refactor omemo test package (/java/org/jivesoftware/smack/omemo -> /java/org/jivesoftware/smackx) Remove OmemoStore method isFreshInstallation() as well as defaultDeviceId related stuff FileBasedOmemoStore: Add cleaner methods to store/load base data types (Using tryWithResource, only for future releases, once Android API gets bumped) Attempt to make OmemoManager thread safe new logic for getInstanceFor() deviceId determination OmemoManagers encrypt methods now don't throw exceptions when encryption for some devices fails. Instead message gets encrypted when possible and more information about failures gets returned alongside the message itself Added OmemoMessage class for that purpose Reworked entire OmemoService class Use safer logic for creating trust-ignoring messages (like ratchet-update messages) Restructure elements/provider in order to prepare for OMEMO namespace bumps Remove OmemoManager.regenerate() methods in favor of getInstanceFor(connection, randomDeviceId) Removed some unnecessary configuration options Prepare for support of more AES message key types Simplify session creation Where possible, avoid side effects in methods Add UntrustedOmemoIdentityException Add TrustState enum More improved tests
2018-06-13 12:29:16 +02:00
description 'Run integration tests of the smack-omemo module in combination with smack-omemo-signal.'
dependsOn project(':smack-omemo-signal-integration-test').tasks.run
}
2014-02-14 18:13:51 +01:00
def getGitCommit() {
def dotGit = new File("$projectDir/.git")
if (!dotGit.isDirectory()) return 'non-git build'
2014-07-28 16:12:57 +02:00
def cmd = 'git describe --always --tags --dirty=+'
2014-02-14 18:13:51 +01:00
def proc = cmd.execute()
def gitCommit = proc.text.trim()
assert !gitCommit.isEmpty()
def srCmd = 'git symbolic-ref --short HEAD'
def srProc = srCmd.execute()
srProc.waitForOrKill(10 * 1000)
if (srProc.exitValue() == 0) {
// Only add the information if the git command was
// successful. There may be no symbolic reference for HEAD if
// e.g. in detached mode.
def symbolicReference = srProc.text.trim()
assert !symbolicReference.isEmpty()
gitCommit += "-$symbolicReference"
}
2014-02-14 18:13:51 +01:00
gitCommit
}
def getAndroidRuntimeJar() {
// We set a different Android API level compared to
// smackMinAndroidSdk here. The runtime jar retrieved via this
// method is, compared to earlier Smack versions, not used to
// check for Android API compatibility. Instead it is used to for
// the eclipse classpath, for javadoc and when compiling the pure
// Android subprojects of Smack. Currently we require level 16
// here, because of the @TargetApi annotation found in
// AndroidUsingLinkProperties of minidns-android21.
def androidApiLevel = 16
def androidHome = getAndroidHome()
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar")
if (androidJar.isFile()) {
return androidJar
} else {
throw new Exception("Can't find android.jar for $androidApiLevel API. Please install corresponding SDK platform package")
}
}
def getAndroidJavadocOffline() {
def androidHome = getAndroidHome()
return androidHome.toString() + "/docs/reference"
2014-07-20 12:58:05 +02:00
}
def getAndroidHome() {
def androidHomeEnv = System.getenv("ANDROID_HOME")
if (androidHomeEnv == null) {
throw new Exception("ANDROID_HOME environment variable is not set")
}
def androidHome = new File(androidHomeEnv)
if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory")
return androidHome
2014-07-20 12:58:05 +02:00
}