2014-08-16 00:09:55 +02:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
2015-09-13 18:12:33 +02:00
|
|
|
maven { url 'https://plugins.gradle.org/m2/' }
|
2015-11-12 04:08:40 +01:00
|
|
|
maven { url 'https://dl.bintray.com/content/aalmiray/kordamp' }
|
2014-08-16 00:09:55 +02:00
|
|
|
}
|
|
|
|
dependencies {
|
2015-03-07 21:05:31 +01:00
|
|
|
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'
|
2015-03-12 15:44:53 +01:00
|
|
|
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1"
|
2014-08-16 00:09:55 +02:00
|
|
|
}
|
|
|
|
}
|
2018-03-07 07:50:48 +01:00
|
|
|
|
|
|
|
plugins {
|
2019-05-17 18:04:27 +02:00
|
|
|
id 'ru.vyarus.animalsniffer' version '1.5.0'
|
2020-01-28 16:20:55 +01:00
|
|
|
id 'net.ltgt.errorprone' version '1.1.1'
|
2020-04-04 13:03:31 +02:00
|
|
|
// Use e.g. "gradle <task> taskTree" to show its dependency tree.
|
|
|
|
id 'com.dorongold.task-tree' version '1.5'
|
2018-03-07 07:50:48 +01:00
|
|
|
}
|
|
|
|
|
2014-08-16 00:09:55 +02:00
|
|
|
apply plugin: 'org.kordamp.gradle.markdown'
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
allprojects {
|
2019-05-06 22:06:13 +02:00
|
|
|
apply plugin: 'java-library'
|
2020-04-11 21:59:21 +02:00
|
|
|
apply plugin: 'java-test-fixtures'
|
2014-02-14 18:13:51 +01:00
|
|
|
apply plugin: 'eclipse'
|
2017-04-24 22:58:52 +02:00
|
|
|
apply plugin: 'idea'
|
2015-03-12 18:11:46 +01:00
|
|
|
apply plugin: 'jacoco'
|
2015-09-13 18:12:33 +02:00
|
|
|
apply plugin: 'net.ltgt.errorprone'
|
2014-02-14 18:13:51 +01:00
|
|
|
|
2020-05-15 21:12:51 +02:00
|
|
|
version readVersionFile()
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
ext {
|
2020-05-15 21:12:51 +02:00
|
|
|
isSnapshot = version.endsWith('-SNAPSHOT')
|
2014-02-14 18:13:51 +01:00
|
|
|
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
|
2019-09-15 19:49:22 +02:00
|
|
|
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
|
|
|
|
signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
|
2014-02-14 18:13:51 +01:00
|
|
|
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
|
|
|
|
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
2014-07-25 19:47:55 +02:00
|
|
|
// 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())
|
2014-02-19 23:26:56 +01:00
|
|
|
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
|
2017-06-02 12:26:37 +02:00
|
|
|
integrationTestProjects = [
|
|
|
|
':smack-integration-test',
|
|
|
|
':smack-omemo-signal-integration-test',
|
|
|
|
].collect{ project(it) }
|
|
|
|
javadocAllProjects = subprojects - integrationTestProjects
|
2015-03-12 18:11:46 +01:00
|
|
|
// 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-debug',
|
|
|
|
':smack-debug-slf4j',
|
|
|
|
':smack-java7',
|
|
|
|
':smack-jingle-old',
|
|
|
|
':smack-resolver-dnsjava',
|
|
|
|
':smack-resolver-javax',
|
|
|
|
':smack-resolver-minidns',
|
2017-06-02 12:26:37 +02:00
|
|
|
':smack-omemo-signal-integration-test',
|
2015-03-12 18:11:46 +01:00
|
|
|
].collect{ project(it) }
|
|
|
|
projectsWithUnitTests = subprojects - projectsWithoutUnitTests
|
2015-01-25 10:35:44 +01:00
|
|
|
androidProjects = [
|
|
|
|
':smack-tcp',
|
|
|
|
':smack-bosh',
|
|
|
|
':smack-core',
|
|
|
|
':smack-im',
|
|
|
|
':smack-resolver-minidns',
|
|
|
|
':smack-sasl-provided',
|
|
|
|
':smack-extensions',
|
|
|
|
':smack-experimental',
|
2017-06-02 12:26:37 +02:00
|
|
|
':smack-omemo',
|
|
|
|
':smack-omemo-signal',
|
2018-07-29 18:52:45 +02:00
|
|
|
':smack-openpgp',
|
2019-05-06 22:06:13 +02:00
|
|
|
':smack-xmlparser',
|
|
|
|
':smack-xmlparser-xpp3',
|
2015-01-25 10:35:44 +01:00
|
|
|
].collect{ project(it) }
|
2015-03-21 18:56:27 +01:00
|
|
|
androidBootClasspathProjects = [
|
|
|
|
':smack-android',
|
|
|
|
':smack-android-extensions',
|
|
|
|
].collect{ project(it) }
|
2017-10-27 20:54:06 +02:00
|
|
|
androidOptionalProjects = [
|
|
|
|
':smack-tcp',
|
|
|
|
':smack-extensions',
|
|
|
|
':smack-experimental',
|
|
|
|
':smack-bosh',
|
|
|
|
':smack-omemo',
|
|
|
|
':smack-omemo-signal',
|
|
|
|
].collect{ project(it) }
|
2017-06-02 12:26:37 +02:00
|
|
|
gplLicensedProjects = [
|
|
|
|
':smack-omemo-signal',
|
|
|
|
':smack-omemo-signal-integration-test',
|
2019-08-04 15:28:21 +02:00
|
|
|
':smack-repl'
|
2017-06-02 12:26:37 +02:00
|
|
|
].collect{ project(it) }
|
2019-02-14 12:29:54 +01:00
|
|
|
// Lazily evaluate the Android bootClasspath and offline
|
|
|
|
// Javadoc using a closure, so that targets which do not
|
|
|
|
// require it are still able to succeed without an Android
|
|
|
|
// SDK.
|
|
|
|
androidBootClasspath = { getAndroidRuntimeJar() }
|
|
|
|
androidJavadocOffline = { getAndroidJavadocOffline() }
|
2019-05-06 22:06:13 +02:00
|
|
|
junit4Projects = [
|
|
|
|
':smack-core',
|
|
|
|
':smack-im',
|
|
|
|
':smack-omemo',
|
|
|
|
':smack-omemo-signal',
|
|
|
|
':smack-openpgp',
|
|
|
|
].collect { project(it) }
|
2020-05-15 21:12:51 +02:00
|
|
|
|
|
|
|
// When using dynamic versions for those, do *not* use [1.0,
|
|
|
|
// 2.0), since this will also pull in 2.0-alpha1. Instead use
|
|
|
|
// [1.0, 1.0.99].
|
|
|
|
// See also:
|
|
|
|
// - https://issues.apache.org/jira/browse/MNG-6232
|
|
|
|
// - https://issues.igniterealtime.org/browse/SMACK-858
|
|
|
|
jxmppVersion = '0.7.0-alpha5'
|
|
|
|
miniDnsVersion = '0.4.0-alpha3'
|
|
|
|
smackMinAndroidSdk = 19
|
2020-02-23 18:30:59 +01:00
|
|
|
junitVersion = '5.6.0'
|
2019-09-15 23:51:26 +02:00
|
|
|
commonsIoVersion = '2.6'
|
2020-05-13 22:20:32 +02:00
|
|
|
bouncyCastleVersion = '1.65'
|
2020-05-15 21:12:51 +02:00
|
|
|
|
2020-04-07 16:56:54 +02:00
|
|
|
if (project.hasProperty("useSonatype")) {
|
|
|
|
useSonatype = project.getProperty("useSonatype").toBoolean()
|
|
|
|
} else {
|
|
|
|
// Default to true
|
|
|
|
useSonatype = true
|
|
|
|
}
|
Make java(c|doc) use --release when available
In order to truely stay Java 8 compatible, declaring a source and
target compatiblity is not sufficient. Source compatiblity means that
the input, i.e. the code written in Java is compatible with that
particular version of the Java Language Specification (JLS). And
target compatibitliy means that the produced Java bytecode is
compatible with that particular version of the Java Virtual Machine
Specificiation (JVMS).
But there is actually a third dimension: the runtime
library (rt.jar). If signatures of methods change over java releases
within the runtime library, then the produced bytecode, may contain
calls to methods that do not exist with that exact same signature in
older java versions.
For example the family of Buffer subclasses changed the return value
of certain functions, for example flip() to not return Buffer, but the
concrete type of the current instance, e.g. CharBuffer.
If we compile now with a newer JDK, where the return type is
CharBuffer and not Buffer, then executing on an older JDK, where the
return type is Buffer, then we get java.lang.NoSuchMethodError(s)
thrown at us.
Fixes SMACK-651.
2020-04-24 10:04:30 +02:00
|
|
|
javaCompatilibity = JavaVersion.VERSION_1_8
|
|
|
|
javaMajor = javaCompatilibity.getMajorVersion()
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
group = 'org.igniterealtime.smack'
|
Make java(c|doc) use --release when available
In order to truely stay Java 8 compatible, declaring a source and
target compatiblity is not sufficient. Source compatiblity means that
the input, i.e. the code written in Java is compatible with that
particular version of the Java Language Specification (JLS). And
target compatibitliy means that the produced Java bytecode is
compatible with that particular version of the Java Virtual Machine
Specificiation (JVMS).
But there is actually a third dimension: the runtime
library (rt.jar). If signatures of methods change over java releases
within the runtime library, then the produced bytecode, may contain
calls to methods that do not exist with that exact same signature in
older java versions.
For example the family of Buffer subclasses changed the return value
of certain functions, for example flip() to not return Buffer, but the
concrete type of the current instance, e.g. CharBuffer.
If we compile now with a newer JDK, where the return type is
CharBuffer and not Buffer, then executing on an older JDK, where the
return type is Buffer, then we get java.lang.NoSuchMethodError(s)
thrown at us.
Fixes SMACK-651.
2020-04-24 10:04:30 +02:00
|
|
|
sourceCompatibility = javaCompatilibity
|
2014-07-31 19:45:00 +02:00
|
|
|
targetCompatibility = sourceCompatibility
|
2019-02-22 23:02:40 +01:00
|
|
|
|
|
|
|
test {
|
2019-05-06 22:06:13 +02:00
|
|
|
useJUnitPlatform()
|
|
|
|
|
2019-06-02 10:40:44 +02:00
|
|
|
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
2019-05-06 22:06:13 +02:00
|
|
|
|
2019-02-22 23:02:40 +01:00
|
|
|
// Enable full stacktraces of failed tests. Especially handy
|
|
|
|
// for environments like Travis.
|
|
|
|
testLogging {
|
|
|
|
events "failed"
|
|
|
|
exceptionFormat "full"
|
|
|
|
}
|
|
|
|
}
|
2014-02-14 18:13:51 +01:00
|
|
|
|
|
|
|
ext.sharedManifest = manifest {
|
|
|
|
attributes('Implementation-Version': version,
|
|
|
|
'Implementation-GitRevision': ext.gitCommit,
|
2014-08-08 15:08:43 +02:00
|
|
|
'Built-Date': ext.builtDate,
|
2014-06-22 18:18:04 +02:00
|
|
|
'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 {
|
2015-03-12 18:11:46 +01:00
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
2014-06-01 12:23:13 +02:00
|
|
|
// Add OSS Sonatype Snapshot repository
|
|
|
|
maven {
|
|
|
|
url 'https://oss.sonatype.org/content/repositories/snapshots'
|
|
|
|
}
|
|
|
|
}
|
2014-07-25 09:26:26 +02:00
|
|
|
|
2015-03-23 09:27:15 +01: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
|
2017-02-26 18:13:10 +01:00
|
|
|
options.encoding = 'UTF-8'
|
2015-03-23 09:27:15 +01:00
|
|
|
options.compilerArgs = [
|
|
|
|
'-Xlint:all',
|
2015-04-03 19:15:35 +02:00
|
|
|
// 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',
|
2015-03-23 14:09:37 +01:00
|
|
|
'-Werror',
|
2018-10-31 16:06:31 +01:00
|
|
|
]
|
2019-05-07 22:58:02 +02:00
|
|
|
options.errorprone {
|
2019-09-07 23:01:39 +02:00
|
|
|
error(
|
|
|
|
"UnusedVariable",
|
|
|
|
"UnusedMethod",
|
|
|
|
"MethodCanBeStatic",
|
|
|
|
)
|
2019-05-07 22:58:02 +02:00
|
|
|
errorproneArgs = [
|
|
|
|
// Disable errorprone checks
|
|
|
|
'-Xep:TypeParameterUnusedInFormals:OFF',
|
|
|
|
// 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',
|
|
|
|
'-Xep:MixedMutabilityReturnType:OFF',
|
|
|
|
]
|
|
|
|
}
|
2014-08-19 00:46:59 +02:00
|
|
|
}
|
|
|
|
|
2018-11-16 22:18:47 +01:00
|
|
|
tasks.withType(ScalaCompile) {
|
|
|
|
scalaCompileOptions.additionalParameters = [
|
2018-11-16 22:25:55 +01:00
|
|
|
'-Xfatal-warnings',
|
2018-11-16 22:18:47 +01:00
|
|
|
'-feature',
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2015-03-12 18:11:46 +01:00
|
|
|
jacoco {
|
2019-02-05 13:41:44 +01:00
|
|
|
toolVersion = "0.8.3"
|
2015-03-12 18:11:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
jacocoTestReport {
|
|
|
|
dependsOn test
|
2019-02-05 13:47:38 +01:00
|
|
|
getSourceDirectories().setFrom(project.files(sourceSets.main.allSource.srcDirs))
|
|
|
|
getClassDirectories().setFrom(project.files(sourceSets.main.output))
|
2015-03-12 18:11:46 +01:00
|
|
|
reports {
|
|
|
|
xml.enabled true
|
|
|
|
}
|
|
|
|
}
|
2015-04-03 19:15:35 +02:00
|
|
|
|
|
|
|
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.
|
2017-12-25 12:51:41 +01:00
|
|
|
options.addStringOption('Xdoclint:all', '-quiet')
|
2018-10-07 09:55:36 +02:00
|
|
|
|
|
|
|
// Treat warnings as errors.
|
|
|
|
// See also https://bugs.openjdk.java.net/browse/JDK-8200363
|
2019-08-30 12:08:30 +02:00
|
|
|
options.addStringOption('Xwerror', '-quiet')
|
2015-04-03 19:15:35 +02:00
|
|
|
}
|
|
|
|
}
|
Make java(c|doc) use --release when available
In order to truely stay Java 8 compatible, declaring a source and
target compatiblity is not sufficient. Source compatiblity means that
the input, i.e. the code written in Java is compatible with that
particular version of the Java Language Specification (JLS). And
target compatibitliy means that the produced Java bytecode is
compatible with that particular version of the Java Virtual Machine
Specificiation (JVMS).
But there is actually a third dimension: the runtime
library (rt.jar). If signatures of methods change over java releases
within the runtime library, then the produced bytecode, may contain
calls to methods that do not exist with that exact same signature in
older java versions.
For example the family of Buffer subclasses changed the return value
of certain functions, for example flip() to not return Buffer, but the
concrete type of the current instance, e.g. CharBuffer.
If we compile now with a newer JDK, where the return type is
CharBuffer and not Buffer, then executing on an older JDK, where the
return type is Buffer, then we get java.lang.NoSuchMethodError(s)
thrown at us.
Fixes SMACK-651.
2020-04-24 10:04:30 +02:00
|
|
|
|
|
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
|
|
tasks.withType(Javadoc) {
|
|
|
|
options.addStringOption('-release', javaMajor)
|
|
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.compilerArgs.addAll([
|
|
|
|
'--release', javaMajor,
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(Javadoc) {
|
2015-04-04 18:46:07 +02:00
|
|
|
options.charSet = "UTF-8"
|
2017-02-26 18:13:10 +01:00
|
|
|
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 {
|
2020-04-11 21:59:21 +02:00
|
|
|
testFixturesApi "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
2019-05-06 22:06:13 +02:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
|
|
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
|
|
|
|
2020-04-11 21:59:21 +02:00
|
|
|
// The smack-extensions subproject uses mockito in its fest
|
|
|
|
// fixtures, and we want to have mockito also available in
|
|
|
|
// test, so we use API here.
|
|
|
|
testFixturesApi "org.mockito:mockito-core:3.3.3"
|
|
|
|
testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
|
|
|
|
|
2019-05-07 22:58:02 +02:00
|
|
|
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
|
2018-10-31 16:06:31 +01:00
|
|
|
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
|
2015-11-16 15:07:40 +01:00
|
|
|
}
|
2017-12-25 12:51:41 +01:00
|
|
|
|
|
|
|
// Make all project's 'test' target depend on javadoc, so that
|
|
|
|
// javadoc is also linted.
|
|
|
|
test { dependsOn javadoc }
|
2014-04-17 12:51:54 +02:00
|
|
|
}
|
|
|
|
|
2019-05-06 22:06:13 +02:00
|
|
|
configure (junit4Projects) {
|
|
|
|
dependencies {
|
|
|
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-04 13:03:31 +02:00
|
|
|
task javadocAll(type: Javadoc) {
|
2015-03-18 09:52:33 +01:00
|
|
|
source javadocAllProjects.collect {project ->
|
2019-09-01 17:14:51 +02:00
|
|
|
project.sourceSets.main.allJava.findAll {
|
|
|
|
// Filter out symbolic links to avoid
|
|
|
|
// "warning: a package-info.java file has already been seen for package"
|
|
|
|
// javadoc warnings.
|
|
|
|
!java.nio.file.Files.isSymbolicLink(it.toPath())
|
|
|
|
}
|
|
|
|
}
|
2014-02-14 18:13:51 +01:00
|
|
|
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)
|
2018-08-02 17:01:49 +02:00
|
|
|
options {
|
|
|
|
linkSource = true
|
|
|
|
use = true
|
|
|
|
links = [
|
Make java(c|doc) use --release when available
In order to truely stay Java 8 compatible, declaring a source and
target compatiblity is not sufficient. Source compatiblity means that
the input, i.e. the code written in Java is compatible with that
particular version of the Java Language Specification (JLS). And
target compatibitliy means that the produced Java bytecode is
compatible with that particular version of the Java Virtual Machine
Specificiation (JVMS).
But there is actually a third dimension: the runtime
library (rt.jar). If signatures of methods change over java releases
within the runtime library, then the produced bytecode, may contain
calls to methods that do not exist with that exact same signature in
older java versions.
For example the family of Buffer subclasses changed the return value
of certain functions, for example flip() to not return Buffer, but the
concrete type of the current instance, e.g. CharBuffer.
If we compile now with a newer JDK, where the return type is
CharBuffer and not Buffer, then executing on an older JDK, where the
return type is Buffer, then we get java.lang.NoSuchMethodError(s)
thrown at us.
Fixes SMACK-651.
2020-04-24 10:04:30 +02:00
|
|
|
"https://docs.oracle.com/javase/${javaMajor}/docs/api/",
|
2018-04-25 10:04:45 +02:00
|
|
|
"https://jxmpp.org/releases/$jxmppVersion/javadoc/",
|
2018-04-24 21:41:31 +02:00
|
|
|
"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"
|
2018-08-02 17:01:49 +02:00
|
|
|
}
|
2020-04-04 13:03:31 +02:00
|
|
|
|
|
|
|
// Finally copy the javadoc doc-files from the subprojects, which
|
|
|
|
// are potentially generated, to the javadocAll directory. Note
|
|
|
|
// that we use a copy *method* and not a *task* because the inputs
|
|
|
|
// of copy tasks is determined within the configuration phase. And
|
|
|
|
// since some of the inputs are generated, they will not get
|
|
|
|
// picked up if we used a copy method. See also
|
|
|
|
// https://stackoverflow.com/a/40518516/194894
|
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
javadocAllProjects.each {
|
|
|
|
from ("${it.projectDir}/src/javadoc") {
|
|
|
|
include '**/doc-files/*.*'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
into javadocAllDir
|
|
|
|
}
|
|
|
|
}
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-20 20:53:17 +02:00
|
|
|
task maybeCheckForSnapshotDependencies {
|
|
|
|
// Don't check for Snapshot dependencies if this is a snapshot.
|
2017-07-03 10:29:57 +02:00
|
|
|
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)
|
|
|
|
}
|
2014-08-20 20:53:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test { dependsOn maybeCheckForSnapshotDependencies }
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
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 {
|
2019-09-15 19:49:22 +02:00
|
|
|
apply plugin: 'maven-publish'
|
2014-02-14 18:13:51 +01:00
|
|
|
apply plugin: 'signing'
|
|
|
|
apply plugin: 'checkstyle'
|
2015-03-03 14:06:21 +01:00
|
|
|
apply plugin: 'org.kordamp.gradle.clirr'
|
2014-02-14 18:13:51 +01:00
|
|
|
|
|
|
|
checkstyle {
|
2020-05-23 23:36:05 +02:00
|
|
|
toolVersion = '8.27'
|
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
|
|
|
|
}
|
2019-09-15 19:49:22 +02:00
|
|
|
task testsJar(type: Jar, dependsOn: testClasses) {
|
2014-08-12 21:58:04 +02:00
|
|
|
classifier = 'tests'
|
|
|
|
from sourceSets.test.output
|
|
|
|
}
|
2015-09-08 14:02:31 +02:00
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
artifacts {
|
2017-02-24 19:25:29 +01:00
|
|
|
// See http://stackoverflow.com/a/21946676/194894
|
2019-09-15 19:49:22 +02:00
|
|
|
testRuntime testsJar
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
from components.java
|
|
|
|
artifact sourcesJar
|
|
|
|
artifact javadocJar
|
|
|
|
artifact testsJar
|
|
|
|
pom {
|
|
|
|
name = 'Smack'
|
|
|
|
packaging = 'jar'
|
|
|
|
inceptionYear = '2003'
|
|
|
|
url = 'http://www.igniterealtime.org/projects/smack/'
|
2020-05-16 21:42:36 +02:00
|
|
|
description = project.description
|
2014-05-10 21:00:40 +02:00
|
|
|
|
2014-02-18 10:51:24 +01:00
|
|
|
issueManagement {
|
2019-09-15 19:49:22 +02:00
|
|
|
system = 'JIRA'
|
|
|
|
url = 'https://igniterealtime.org/issues/browse/SMACK'
|
2014-02-18 10:51:24 +01:00
|
|
|
}
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
scm {
|
2019-09-15 19:49:22 +02:00
|
|
|
url = 'https://github.com/igniterealtime/Smack'
|
|
|
|
connection = 'scm:git:https://github.com/igniterealtime/Smack.git'
|
|
|
|
developerConnection = 'scm:git:https://github.com/igniterealtime/Smack.git'
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
developers {
|
|
|
|
developer {
|
2019-09-15 19:49:22 +02:00
|
|
|
id = 'flow'
|
|
|
|
name = 'Florian Schmaus'
|
|
|
|
email = 'flow@igniterealtime.org'
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-15 19:49:22 +02:00
|
|
|
repositories {
|
2020-04-07 16:56:54 +02:00
|
|
|
if (sonatypeCredentialsAvailable && useSonatype) {
|
|
|
|
maven {
|
|
|
|
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
|
2019-09-15 19:49:22 +02:00
|
|
|
credentials {
|
|
|
|
username = sonatypeUsername
|
|
|
|
password = sonatypePassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-07 16:56:54 +02:00
|
|
|
// Use
|
|
|
|
// gradle publish -P customRepoUrl=https://www.igniterealtime.org/archiva/repository/maven -P customRepoUsername=bamboo -P customRepoPassword=hidden -P useSonatype=false
|
|
|
|
// to deploy to this repo.
|
|
|
|
if (project.hasProperty("customRepoUrl")) {
|
|
|
|
maven {
|
|
|
|
name 'customRepo'
|
|
|
|
url customRepoUrl
|
|
|
|
if (project.hasProperty("customRepoUsername")) {
|
|
|
|
credentials {
|
|
|
|
username customRepoUsername
|
|
|
|
password customRepoPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-15 19:49:22 +02:00
|
|
|
}
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2019-07-21 09:01:07 +02:00
|
|
|
|
|
|
|
// Workaround for gpg signatory not supporting the 'required' option
|
|
|
|
// See https://github.com/gradle/gradle/issues/5064#issuecomment-381924984
|
|
|
|
// Note what we use 'signing.gnupg.keyName' instead of 'signing.keyId'.
|
|
|
|
tasks.withType(Sign) {
|
|
|
|
onlyIf {
|
|
|
|
project.hasProperty('signing.gnupg.keyName')
|
|
|
|
}
|
|
|
|
}
|
2014-02-14 18:13:51 +01:00
|
|
|
signing {
|
2019-07-20 22:34:05 +02:00
|
|
|
useGpgCmd()
|
2014-02-14 18:13:51 +01:00
|
|
|
required { signingRequired }
|
2019-09-15 19:49:22 +02:00
|
|
|
sign publishing.publications.mavenJava
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
2015-03-03 14:06:21 +01:00
|
|
|
|
|
|
|
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
|
2015-03-03 14:06:21 +01:00
|
|
|
}
|
2019-02-04 08:59:39 +01:00
|
|
|
|
|
|
|
// Work around https://github.com/gradle/gradle/issues/4046
|
|
|
|
task copyJavadocDocFiles(type: Copy) {
|
|
|
|
from('src/javadoc')
|
|
|
|
into 'build/docs/javadoc'
|
|
|
|
include '**/doc-files/*.*'
|
|
|
|
}
|
2020-04-04 13:03:31 +02:00
|
|
|
javadoc.dependsOn copyJavadocDocFiles
|
2019-02-04 08:59:39 +01:00
|
|
|
|
2020-04-04 13:03:31 +02:00
|
|
|
// Make sure root projects 'javadocAll' depends on the
|
|
|
|
// subproject's javadoc, to ensure that all all doc-files/ are
|
|
|
|
// generated and up-to-date. Obviously this means that the
|
|
|
|
// javadocAll task will also create the individual javadoc's of the
|
|
|
|
// subprojects.
|
|
|
|
javadocAll.dependsOn javadoc
|
|
|
|
}
|
2019-02-04 08:59:39 +01:00
|
|
|
|
2020-04-04 13:03:31 +02:00
|
|
|
// The smack-java8-full project generates the dot and png files of the
|
|
|
|
// current state graph. Ensure they are generated before copied.
|
|
|
|
configure (project(':smack-java8-full')) {
|
|
|
|
copyJavadocDocFiles.dependsOn convertModularXmppClientToServerConnectionStateGraphDotToPng
|
2014-02-14 18:13:51 +01:00
|
|
|
}
|
|
|
|
|
2018-05-06 13:35:11 +02:00
|
|
|
configure (androidProjects + androidBootClasspathProjects) {
|
2018-03-07 07:50:48 +01:00
|
|
|
apply plugin: 'ru.vyarus.animalsniffer'
|
|
|
|
dependencies {
|
2019-02-04 08:59:39 +01:00
|
|
|
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:4.4.2_r4@signature"
|
2018-03-07 07:50:48 +01:00
|
|
|
}
|
|
|
|
animalsniffer {
|
|
|
|
sourceSets = [sourceSets.main]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-02 12:26:37 +02:00
|
|
|
// 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
|
2015-03-18 09:52:33 +01:00
|
|
|
|
2014-05-30 22:35:18 +02:00
|
|
|
subprojects*.jar {
|
|
|
|
manifest {
|
|
|
|
from sharedManifest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-02 12:26:37 +02:00
|
|
|
configure(subprojects - gplLicensedProjects) {
|
|
|
|
checkstyle {
|
|
|
|
configProperties.checkstyleLicenseHeader = "header"
|
|
|
|
}
|
2019-09-15 19:49:22 +02:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
pom {
|
2017-06-02 12:26:37 +02:00
|
|
|
licenses {
|
|
|
|
license {
|
2019-09-15 19:49:22 +02:00
|
|
|
name = 'The Apache Software License, Version 2.0'
|
|
|
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
distribution = 'repo'
|
2017-06-02 12:26:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configure(gplLicensedProjects) {
|
|
|
|
checkstyle {
|
|
|
|
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
|
|
|
|
}
|
2019-09-15 19:49:22 +02:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
pom {
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name = 'GNU General Public License, version 3 or any later version'
|
|
|
|
url = 'https://www.gnu.org/licenses/gpl.txt'
|
|
|
|
distribution = 'repo'
|
|
|
|
}
|
2017-06-02 12:26:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-21 18:56:27 +01:00
|
|
|
configure(androidBootClasspathProjects) {
|
|
|
|
compileJava {
|
2018-03-27 22:08:16 +02:00
|
|
|
options.bootstrapClasspath = files(androidBootClasspath)
|
2015-03-21 18:56:27 +01:00
|
|
|
}
|
|
|
|
javadoc {
|
|
|
|
classpath += files(androidBootClasspath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-12 18:11:46 +01:00
|
|
|
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
|
2019-02-05 13:47:38 +01:00
|
|
|
getSourceDirectories().setFrom(files(projectsWithUnitTests.sourceSets.main.allSource.srcDirs))
|
|
|
|
getClassDirectories().setFrom(files(projectsWithUnitTests.sourceSets.main.output))
|
|
|
|
getExecutionData().setFrom(files(projectsWithUnitTests.jacocoTestReport.executionData))
|
2015-03-12 18:11:46 +01:00
|
|
|
reports {
|
|
|
|
xml.enabled true
|
2018-03-27 22:08:16 +02:00
|
|
|
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
|
2015-03-12 18:11:46 +01:00
|
|
|
}
|
|
|
|
// 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 }
|
|
|
|
}
|
|
|
|
|
2015-03-03 14:06:21 +01:00
|
|
|
// 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)
|
2015-03-03 14:06:21 +01:00
|
|
|
}
|
|
|
|
|
2015-03-18 09:52:33 +01:00
|
|
|
task integrationTest {
|
2018-06-13 12:29:16 +02:00
|
|
|
description 'Verify correct functionality of Smack by running some integration tests.'
|
2015-03-18 09:52:33 +01:00
|
|
|
dependsOn project(':smack-integration-test').tasks.run
|
|
|
|
}
|
|
|
|
|
2017-06-02 12:26:37 +02:00
|
|
|
task omemoSignalIntTest {
|
2018-06-13 12:29:16 +02:00
|
|
|
description 'Run integration tests of the smack-omemo module in combination with smack-omemo-signal.'
|
2017-06-02 12:26:37 +02:00
|
|
|
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'
|
|
|
|
|
2019-10-10 14:46:47 +02:00
|
|
|
def projectDir = dotGit.getParentFile()
|
2014-07-28 16:12:57 +02:00
|
|
|
def cmd = 'git describe --always --tags --dirty=+'
|
2019-10-10 14:46:47 +02:00
|
|
|
def proc = cmd.execute(null, projectDir)
|
|
|
|
proc.waitForOrKill(10 * 1000)
|
|
|
|
|
2014-02-14 18:13:51 +01:00
|
|
|
def gitCommit = proc.text.trim()
|
|
|
|
assert !gitCommit.isEmpty()
|
2016-06-12 11:28:17 +02:00
|
|
|
|
|
|
|
def srCmd = 'git symbolic-ref --short HEAD'
|
2019-10-10 14:46:47 +02:00
|
|
|
def srProc = srCmd.execute(null, projectDir)
|
2016-06-12 11:28:17 +02:00
|
|
|
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
|
|
|
|
}
|
2014-09-22 09:58:09 +02:00
|
|
|
|
|
|
|
def getAndroidRuntimeJar() {
|
2019-05-08 11:34:40 +02:00
|
|
|
def androidApiLevel = ext.smackMinAndroidSdk
|
2014-10-05 12:34:00 +02:00
|
|
|
def androidHome = getAndroidHome()
|
2018-05-06 13:35:11 +02:00
|
|
|
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar")
|
2014-09-22 09:58:09 +02:00
|
|
|
if (androidJar.isFile()) {
|
|
|
|
return androidJar
|
|
|
|
} else {
|
2019-12-13 16:12:18 +01:00
|
|
|
throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package")
|
2014-09-22 09:58:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def getAndroidJavadocOffline() {
|
2014-10-05 12:34:00 +02:00
|
|
|
def androidHome = getAndroidHome()
|
|
|
|
return androidHome.toString() + "/docs/reference"
|
2014-07-20 12:58:05 +02:00
|
|
|
}
|
2014-10-05 12:34:00 +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
|
|
|
}
|
2020-05-15 21:12:51 +02:00
|
|
|
|
|
|
|
def readVersionFile() {
|
|
|
|
def versionFile = new File(rootDir, 'version')
|
|
|
|
if (!versionFile.isFile()) {
|
|
|
|
throw new Exception("Could not find version file")
|
|
|
|
}
|
|
|
|
if (versionFile.text.isEmpty()) {
|
|
|
|
throw new Exception("Version file does not contain a version")
|
|
|
|
}
|
|
|
|
versionFile.text.trim()
|
|
|
|
}
|