mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Merge pull request #632 from Flowdalic/smack-gradle-bump
Bump to Gradle 8.10.2, require Java 11
This commit is contained in:
commit
f59d7f3257
136 changed files with 1161 additions and 1220 deletions
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
|
@ -6,13 +6,13 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Smack
|
name: Build Smack
|
||||||
|
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java:
|
java:
|
||||||
- 11
|
- 17
|
||||||
env:
|
env:
|
||||||
PRIMARY_JAVA_VERSION: 11
|
PRIMARY_JAVA_VERSION: 17
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -57,6 +57,17 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
sdkmanager "platforms;android-21"
|
sdkmanager "platforms;android-21"
|
||||||
|
|
||||||
|
# Workaround
|
||||||
|
- name: Create gradle.properties
|
||||||
|
run: |
|
||||||
|
cat <<-EOF > gradle.properties
|
||||||
|
# Workaround for https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/349
|
||||||
|
# suggested at https://docs.gradle.org/current/userguide/upgrading_version_8.html#xml_parsing_now_requires_recent_parsers
|
||||||
|
systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
|
||||||
|
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
|
||||||
|
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
|
||||||
|
EOF
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
- name: Gradle Check
|
- name: Gradle Check
|
||||||
run: ./gradlew check --stacktrace
|
run: ./gradlew check --stacktrace
|
||||||
|
@ -72,10 +83,19 @@ jobs:
|
||||||
|
|
||||||
# Test Coverage Report
|
# Test Coverage Report
|
||||||
- name: Jacoco Test Coverage
|
- name: Jacoco Test Coverage
|
||||||
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
|
|
||||||
run: ./gradlew jacocoRootReport coveralls
|
|
||||||
env:
|
env:
|
||||||
COVERALLS_REPO_TOKEN: S2ecSJja2cKJa9yv45C8ZFPohXuRrTXKd
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||||
|
if: |
|
||||||
|
${{ matrix.java == env.PRIMARY_JAVA_VERSION }} &&
|
||||||
|
${{ env.COVERALLS_REPO_TOKEN != '' }}
|
||||||
|
run: |
|
||||||
|
if [[ -z ${COVERALLS_REPO_TOKEN} ]]; then
|
||||||
|
echo WARNING: COVERALLS_REPO_TOKEN is empty
|
||||||
|
else
|
||||||
|
echo COVERALLS_REPO_TOKEN is not empty
|
||||||
|
fi
|
||||||
|
./gradlew smack-java8-full:testCodeCoverageReport
|
||||||
|
./gradlew smack-java8-full:coveralls
|
||||||
|
|
||||||
# Upload build artifacts
|
# Upload build artifacts
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
|
|
30
Makefile
Normal file
30
Makefile
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
GRADLE ?= ./gradlew
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: check jacocoRootReport javadocAll sinttest
|
||||||
|
|
||||||
|
.PHONY: codecov
|
||||||
|
codecov:
|
||||||
|
$(GRADLE) smack-java8-full:testCodeCoverageReport
|
||||||
|
echo "Report available at smack-java8-full/build/reports/jacoco/testCodeCoverageReport/html/index.html"
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check:
|
||||||
|
$(GRADLE) $@
|
||||||
|
|
||||||
|
.PHONY: eclipse
|
||||||
|
eclipse:
|
||||||
|
$(GRADLE) $@
|
||||||
|
|
||||||
|
.PHONY: sinttest
|
||||||
|
sinttest:
|
||||||
|
$(GRADLE) $@
|
||||||
|
|
||||||
|
.PHONY: jacocoRootReport
|
||||||
|
jacocoRootReport:
|
||||||
|
$(GRADLE) $@
|
||||||
|
|
||||||
|
.PHONY: javadocAll
|
||||||
|
javadocAll:
|
||||||
|
$(GRADLE) $@
|
||||||
|
echo "Smack javadoc available at build/javadoc/index.html"
|
16
build-logic/build.gradle
Normal file
16
build-logic/build.gradle
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
plugins {
|
||||||
|
id 'groovy-gradle-plugin'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0"
|
||||||
|
implementation "io.freefair.gradle:maven-plugin:8.10" // for io.freefair.agregate-javadoc
|
||||||
|
implementation "me.champeau.jmh:jmh-gradle-plugin:0.7.2"
|
||||||
|
implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1"
|
||||||
|
implementation "gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2"
|
||||||
|
implementation "ru.vyarus:gradle-animalsniffer-plugin:1.7.1"
|
||||||
|
}
|
1
build-logic/settings.gradle
Normal file
1
build-logic/settings.gradle
Normal file
|
@ -0,0 +1 @@
|
||||||
|
rootProject.name = 'smack-build-logic'
|
|
@ -0,0 +1,6 @@
|
||||||
|
compileJava {
|
||||||
|
options.bootstrapClasspath = files(androidBootClasspath)
|
||||||
|
}
|
||||||
|
javadoc {
|
||||||
|
classpath += files(androidBootClasspath)
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
plugins {
|
||||||
|
id 'ru.vyarus.animalsniffer'
|
||||||
|
id 'org.igniterealtime.smack.global-conventions'
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:5.0.1_r2@signature"
|
||||||
|
}
|
||||||
|
animalsniffer {
|
||||||
|
sourceSets = [sourceSets.main]
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
plugins {
|
||||||
|
id 'application'
|
||||||
|
}
|
||||||
|
|
||||||
|
application {
|
||||||
|
applicationDefaultJvmArgs = ["-enableassertions"]
|
||||||
|
}
|
||||||
|
|
||||||
|
run {
|
||||||
|
// Pass all system properties down to the "application" run
|
||||||
|
systemProperties System.getProperties()
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
ext {
|
||||||
|
javaVersion = JavaVersion.VERSION_11
|
||||||
|
javaMajor = javaVersion.getMajorVersion()
|
||||||
|
smackMinAndroidSdk = 21
|
||||||
|
|
||||||
|
androidBootClasspath = { getAndroidRuntimeJar() }
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
def getAndroidRuntimeJar() {
|
||||||
|
def androidApiLevel = ext.smackMinAndroidSdk
|
||||||
|
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 API level ${androidApiLevel}. Please install corresponding SDK platform package")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def getAndroidJavadocOffline() {
|
||||||
|
def androidHome = getAndroidHome()
|
||||||
|
return androidHome.toString() + "/docs/reference"
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
|
@ -0,0 +1,373 @@
|
||||||
|
plugins {
|
||||||
|
id 'biz.aQute.bnd.builder'
|
||||||
|
id 'checkstyle'
|
||||||
|
id 'com.github.kt3k.coveralls'
|
||||||
|
id 'eclipse'
|
||||||
|
id 'idea'
|
||||||
|
id 'jacoco'
|
||||||
|
id 'java'
|
||||||
|
id 'java-library'
|
||||||
|
id 'java-test-fixtures'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'net.ltgt.errorprone'
|
||||||
|
id 'signing'
|
||||||
|
|
||||||
|
id 'jacoco-report-aggregation'
|
||||||
|
id 'test-report-aggregation'
|
||||||
|
|
||||||
|
id 'org.igniterealtime.smack.global-conventions'
|
||||||
|
id 'org.igniterealtime.smack.javadoc-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
|
version readVersionFile()
|
||||||
|
|
||||||
|
ext {
|
||||||
|
isSnapshot = version.endsWith('-SNAPSHOT')
|
||||||
|
gitCommit = getGitCommit()
|
||||||
|
rootConfigDir = new File(rootDir, 'config')
|
||||||
|
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
|
||||||
|
isReleaseVersion = !isSnapshot
|
||||||
|
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
|
||||||
|
signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
|
||||||
|
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
|
||||||
|
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
||||||
|
builtDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
|
||||||
|
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
|
||||||
|
|
||||||
|
jxmppVersion = '[1.1.0-beta1, 1.1.999]'
|
||||||
|
miniDnsVersion = '[1.1.0-alpha3, 1.1.999]'
|
||||||
|
junitVersion = '5.9.2'
|
||||||
|
commonsIoVersion = '2.6'
|
||||||
|
bouncyCastleVersion = '1.73'
|
||||||
|
guavaVersion = '30.1-jre'
|
||||||
|
mockitoVersion = '5.13.0'
|
||||||
|
orgReflectionsVersion = '0.9.11'
|
||||||
|
|
||||||
|
if (project.hasProperty("useSonatype")) {
|
||||||
|
useSonatype = project.getProperty("useSonatype").toBoolean()
|
||||||
|
} else {
|
||||||
|
// Default to true
|
||||||
|
useSonatype = true
|
||||||
|
}
|
||||||
|
|
||||||
|
gplLicensedProjects = [
|
||||||
|
':smack-examples',
|
||||||
|
':smack-omemo-signal',
|
||||||
|
':smack-omemo-signal-integration-test',
|
||||||
|
':smack-repl'
|
||||||
|
].collect{ project(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'org.igniterealtime.smack'
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = javaVersion
|
||||||
|
targetCompatibility = sourceCompatibility
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
classpath {
|
||||||
|
downloadJavadoc = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make all project's 'test' target depend on javadoc, so that
|
||||||
|
// javadoc is also linted.
|
||||||
|
test.dependsOn javadoc
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
// 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 = "utf8"
|
||||||
|
options.compilerArgs = [
|
||||||
|
'-Xlint:all',
|
||||||
|
// Set '-options' because a non-java7 javac will emit a
|
||||||
|
// warning if source/target is set to 1.7 and
|
||||||
|
// bootclasspath is *not* set.
|
||||||
|
'-Xlint:-options',
|
||||||
|
// TODO: Enable xlint serial
|
||||||
|
'-Xlint:-serial',
|
||||||
|
'-Werror',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
if (JavaVersion.current().isJava8Compatible()) {
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
// The '-quiet' as second argument is actually a hack,
|
||||||
|
// since the one parameter addStringOption doesn't seem to
|
||||||
|
// work, we extra add '-quiet', which is added anyway by
|
||||||
|
// gradle.
|
||||||
|
// We disable 'missing' as we do most of javadoc checking via checkstyle.
|
||||||
|
options.addStringOption('Xdoclint:all,-missing', '-quiet')
|
||||||
|
// Abort on javadoc warnings.
|
||||||
|
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
|
||||||
|
// for information about the -Xwerror option.
|
||||||
|
options.addStringOption('Xwerror', '-quiet')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JavaVersion.current().isJava9Compatible()) {
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.compilerArgs.addAll([
|
||||||
|
'--release', javaMajor,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jacoco {
|
||||||
|
toolVersion = "0.8.12"
|
||||||
|
}
|
||||||
|
|
||||||
|
jacocoTestReport {
|
||||||
|
dependsOn test
|
||||||
|
reports {
|
||||||
|
xml.required = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||||
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||||
|
|
||||||
|
testFixturesApi "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
|
||||||
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||||
|
// https://stackoverflow.com/a/77274251/194894
|
||||||
|
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.11.0"
|
||||||
|
|
||||||
|
// 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:${mockitoVersion}"
|
||||||
|
|
||||||
|
testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
|
||||||
|
|
||||||
|
errorprone 'com.google.errorprone:error_prone_core:2.9.0'
|
||||||
|
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
|
||||||
|
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
||||||
|
|
||||||
|
// Enable full stacktraces of failed tests. Especially handy
|
||||||
|
// for CI environments.
|
||||||
|
testLogging {
|
||||||
|
events "failed"
|
||||||
|
exceptionFormat "full"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes(
|
||||||
|
'Implementation-Version': version,
|
||||||
|
'Implementation-GitRevision': gitCommit,
|
||||||
|
'Built-JDK': System.getProperty('java.version'),
|
||||||
|
'Built-Gradle': gradle.gradleVersion,
|
||||||
|
'Built-By': System.getProperty('user.name')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
bundle {
|
||||||
|
bnd(
|
||||||
|
'-removeheaders': 'Tool, Bnd-*',
|
||||||
|
'-exportcontents': '*',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkstyle {
|
||||||
|
toolVersion = '8.27'
|
||||||
|
|
||||||
|
if (project in gplLicensedProjects) {
|
||||||
|
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
|
||||||
|
} else {
|
||||||
|
configProperties.checkstyleLicenseHeader = "header"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
archiveClassifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
|
archiveClassifier = 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
|
}
|
||||||
|
task testsJar(type: Jar) {
|
||||||
|
archiveClassifier = 'tests'
|
||||||
|
from sourceSets.test.output
|
||||||
|
}
|
||||||
|
configurations {
|
||||||
|
testRuntime
|
||||||
|
}
|
||||||
|
artifacts {
|
||||||
|
// Add a 'testRuntime' configuration including the tests so that
|
||||||
|
// it can be consumed by other projects (smack-omemo-signal for
|
||||||
|
// example). See http://stackoverflow.com/a/21946676/194894
|
||||||
|
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/jxmpp/'
|
||||||
|
afterEvaluate {
|
||||||
|
description = project.description
|
||||||
|
}
|
||||||
|
|
||||||
|
issueManagement {
|
||||||
|
system = 'JIRA'
|
||||||
|
url = 'http://issues.igniterealtime.org/browse/SMACK'
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
if (project in gplLicensedProjects) {
|
||||||
|
license {
|
||||||
|
name = 'GNU General Public License, version 3 or any later version'
|
||||||
|
url = 'https://www.gnu.org/licenses/gpl.txt'
|
||||||
|
distribution = 'repo'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
if (sonatypeCredentialsAvailable && useSonatype) {
|
||||||
|
maven {
|
||||||
|
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
|
||||||
|
credentials {
|
||||||
|
username = sonatypeUsername
|
||||||
|
password = sonatypePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signing {
|
||||||
|
required { signingRequired }
|
||||||
|
useGpgCmd()
|
||||||
|
sign publishing.publications.mavenJava
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.errorprone {
|
||||||
|
disableWarningsInGeneratedCode = true
|
||||||
|
excludedPaths = ".*/jmh_generated/.*"
|
||||||
|
error(
|
||||||
|
"UnusedVariable",
|
||||||
|
"UnusedMethod",
|
||||||
|
"MethodCanBeStatic",
|
||||||
|
)
|
||||||
|
errorproneArgs = [
|
||||||
|
// Disable MissingCasesInEnumSwitch error prone check
|
||||||
|
// because this check is already done by javac as incomplete-switch.
|
||||||
|
'-Xep:MissingCasesInEnumSwitch:OFF',
|
||||||
|
'-Xep:StringSplitter:OFF',
|
||||||
|
'-Xep:JavaTimeDefaultTimeZone:OFF',
|
||||||
|
'-Xep:InlineMeSuggester:OFF',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Work around https://github.com/gradle/gradle/issues/4046
|
||||||
|
task copyJavadocDocFiles(type: Copy) {
|
||||||
|
from('src/javadoc')
|
||||||
|
into 'build/docs/javadoc'
|
||||||
|
include '**/doc-files/*.*'
|
||||||
|
}
|
||||||
|
javadoc.dependsOn copyJavadocDocFiles
|
||||||
|
|
||||||
|
coveralls {
|
||||||
|
jacocoReportPath 'build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml'
|
||||||
|
}
|
||||||
|
|
||||||
|
def getGitCommit() {
|
||||||
|
def projectDirFile = new File("$projectDir")
|
||||||
|
|
||||||
|
def cmd = 'git describe --always --tags --dirty=+'
|
||||||
|
def proc = cmd.execute(null, projectDirFile)
|
||||||
|
|
||||||
|
def exitStatus = proc.waitFor()
|
||||||
|
if (exitStatus != 0) return "non-git build"
|
||||||
|
|
||||||
|
def gitCommit = proc.text.trim()
|
||||||
|
assert !gitCommit.isEmpty()
|
||||||
|
gitCommit
|
||||||
|
}
|
||||||
|
|
||||||
|
def getAndroidRuntimeJar() {
|
||||||
|
def androidHome = new File("$System.env.ANDROID_HOME")
|
||||||
|
if (!androidHome.isDirectory()) throw new Exception("ANDROID_HOME not found or set")
|
||||||
|
def androidJar = new File("$androidHome/platforms/android-$smackMinAndroidSdk/android.jar")
|
||||||
|
if (androidJar.isFile()) {
|
||||||
|
return androidJar
|
||||||
|
} else {
|
||||||
|
throw new Exception("Can't find android.jar for $smackMinAndroidSdk API. Please install corresponding SDK platform package")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
plugins {
|
||||||
|
// Javadoc linking requires repositories to bet configured. And
|
||||||
|
// those are declared in global-conventions, hence we add it here.
|
||||||
|
id 'org.igniterealtime.smack.global-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JavaVersion.current().isJava8Compatible()) {
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
// The '-quiet' as second argument is actually a hack,
|
||||||
|
// since the one parameter addStringOption doesn't seem to
|
||||||
|
// work, we extra add '-quiet', which is added anyway by
|
||||||
|
// gradle.
|
||||||
|
// We disable 'missing' as we do most of javadoc checking via checkstyle.
|
||||||
|
options.addStringOption('Xdoclint:all,-missing', '-quiet')
|
||||||
|
// Abort on javadoc warnings.
|
||||||
|
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
|
||||||
|
// for information about the -Xwerror option.
|
||||||
|
options.addStringOption('Xwerror', '-quiet')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JavaVersion.current().isJava9Compatible()) {
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
options.addStringOption('-release', javaMajor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
options.charSet = "UTF-8"
|
||||||
|
}
|
682
build.gradle
682
build.gradle
|
@ -1,346 +1,20 @@
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
gradlePluginPortal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'ru.vyarus.animalsniffer' version '1.5.0'
|
// The scalastyle plugin of smack-repl wants the root project to
|
||||||
id 'net.ltgt.errorprone' version '1.3.0'
|
// have a ideaProject task, so let's add one.
|
||||||
// Use e.g. "gradle <task> taskTree" to show its dependency tree.
|
id 'idea'
|
||||||
id 'com.dorongold.task-tree' version '1.5'
|
|
||||||
id 'com.github.kt3k.coveralls' version '2.10.2'
|
id 'org.igniterealtime.smack.javadoc-conventions'
|
||||||
id 'biz.aQute.bnd.builder' version '6.4.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
java11Projects = [
|
|
||||||
':smack-examples',
|
|
||||||
':smack-integration-test',
|
|
||||||
':smack-omemo-signal-integration-test',
|
|
||||||
':smack-repl',
|
|
||||||
':smack-websocket-java11',
|
|
||||||
].collect { project(it) }
|
|
||||||
java11Projects += getRootProject()
|
|
||||||
java8Projects = allprojects - java11Projects
|
|
||||||
}
|
|
||||||
|
|
||||||
configure (java8Projects) {
|
|
||||||
ext {
|
|
||||||
javaCompatilibity = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure (java11Projects) {
|
|
||||||
ext {
|
|
||||||
javaCompatilibity = JavaVersion.VERSION_11
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'java-test-fixtures'
|
|
||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'net.ltgt.errorprone'
|
|
||||||
|
|
||||||
version readVersionFile()
|
|
||||||
|
|
||||||
ext {
|
|
||||||
isSnapshot = version.endsWith('-SNAPSHOT')
|
|
||||||
gitCommit = getGitCommit()
|
|
||||||
javadocAllDir = new File(buildDir, 'javadoc')
|
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
|
|
||||||
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
|
|
||||||
signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
|
|
||||||
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.
|
|
||||||
builtDate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(new Date())
|
|
||||||
oneLineDesc = 'An Open Source XMPP (Jabber) client library'
|
|
||||||
integrationTestProjects = [
|
integrationTestProjects = [
|
||||||
':smack-integration-test',
|
':smack-integration-test',
|
||||||
':smack-omemo-signal-integration-test',
|
':smack-omemo-signal-integration-test',
|
||||||
].collect{ project(it) }
|
].collect{ project(it) }
|
||||||
javadocAllProjects = subprojects - integrationTestProjects
|
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-debug',
|
|
||||||
':smack-debug-slf4j',
|
|
||||||
':smack-java8',
|
|
||||||
':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',
|
|
||||||
':smack-xmlparser',
|
|
||||||
':smack-xmlparser-xpp3',
|
|
||||||
].collect{ project(it) }
|
|
||||||
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-examples',
|
|
||||||
':smack-omemo-signal',
|
|
||||||
':smack-omemo-signal-integration-test',
|
|
||||||
':smack-repl'
|
|
||||||
].collect{ project(it) }
|
|
||||||
// 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() }
|
|
||||||
junit4Projects = [
|
|
||||||
':smack-core',
|
|
||||||
':smack-im',
|
|
||||||
':smack-omemo',
|
|
||||||
':smack-omemo-signal',
|
|
||||||
':smack-openpgp',
|
|
||||||
].collect { project(it) }
|
|
||||||
|
|
||||||
// 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 = '[1.1.0-beta1, 1.1.999]'
|
|
||||||
miniDnsVersion = '[1.1.0-alpha3, 1.1.999]'
|
|
||||||
smackMinAndroidSdk = 21
|
|
||||||
junitVersion = '5.7.1'
|
|
||||||
commonsIoVersion = '2.6'
|
|
||||||
bouncyCastleVersion = '1.73'
|
|
||||||
guavaVersion = '30.1-jre'
|
|
||||||
mockitoVersion = '3.7.7'
|
|
||||||
orgReflectionsVersion = '0.9.11'
|
|
||||||
|
|
||||||
if (project.hasProperty("useSonatype")) {
|
|
||||||
useSonatype = project.getProperty("useSonatype").toBoolean()
|
|
||||||
} else {
|
|
||||||
// Default to true
|
|
||||||
useSonatype = true
|
|
||||||
}
|
|
||||||
javaMajor = javaCompatilibity.getMajorVersion()
|
|
||||||
}
|
|
||||||
group = 'org.igniterealtime.smack'
|
|
||||||
sourceCompatibility = javaCompatilibity
|
|
||||||
targetCompatibility = sourceCompatibility
|
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
|
|
||||||
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
|
||||||
|
|
||||||
// Enable full stacktraces of failed tests. Especially handy
|
|
||||||
// for environments like Travis.
|
|
||||||
testLogging {
|
|
||||||
events "failed"
|
|
||||||
exceptionFormat "full"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.sharedManifest = manifest {
|
|
||||||
attributes('Implementation-Version': version,
|
|
||||||
'Implementation-GitRevision': ext.gitCommit,
|
|
||||||
'Built-Date': ext.builtDate,
|
|
||||||
'Built-JDK': System.getProperty('java.version'),
|
|
||||||
'Built-Gradle': gradle.gradleVersion,
|
|
||||||
'Built-By': System.getProperty('user.name')
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
eclipse {
|
|
||||||
classpath {
|
|
||||||
downloadJavadoc = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
// 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/target 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 {
|
|
||||||
error(
|
|
||||||
"UnusedVariable",
|
|
||||||
"UnusedMethod",
|
|
||||||
"MethodCanBeStatic",
|
|
||||||
)
|
|
||||||
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',
|
|
||||||
// TODO: Re-enable once Smack's minimum Android SDK level is 26 or higher.
|
|
||||||
'-Xep:JavaUtilDate:OFF',
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(ScalaCompile) {
|
|
||||||
scalaCompileOptions.additionalParameters = [
|
|
||||||
'-Xfatal-warnings',
|
|
||||||
'-feature',
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
jacoco {
|
|
||||||
toolVersion = "0.8.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
jacocoTestReport {
|
|
||||||
dependsOn test
|
|
||||||
getSourceDirectories().setFrom(project.files(sourceSets.main.allSource.srcDirs))
|
|
||||||
getClassDirectories().setFrom(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 parameter addStringOption doesn't seem to
|
|
||||||
// work, we extra add '-quiet', which is added anyway by
|
|
||||||
// gradle.
|
|
||||||
// TODO: This enables all doclint check but
|
|
||||||
// 'missing'. Re-enable 'missing' once every public API in
|
|
||||||
// Smack has a javadoc comment.
|
|
||||||
options.addStringOption('Xdoclint:accessibility,html,reference,syntax', '-quiet')
|
|
||||||
|
|
||||||
// Treat warnings as errors.
|
|
||||||
// See also https://bugs.openjdk.java.net/browse/JDK-8200363
|
|
||||||
options.addStringOption('Xwerror', '-quiet')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JavaVersion.current().isJava9Compatible()) {
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
options.addStringOption('-release', javaMajor)
|
|
||||||
|
|
||||||
// The -no-modules-directories javadoc option was removed in Java 13
|
|
||||||
// See https://bugs.openjdk.java.net/browse/JDK-8215582
|
|
||||||
if (JavaVersion.current() < JavaVersion.VERSION_13) {
|
|
||||||
// Fix for javadoc search. If not set, the search result would direct to
|
|
||||||
// javadoc/undefined/org/jivesoftware/smack/altconnections/HttpLookupMethod.html
|
|
||||||
// instead of
|
|
||||||
// javadoc/org/jivesoftware/smack/altconnections/HttpLookupMethod.html
|
|
||||||
// https://stackoverflow.com/a/53732633/194894
|
|
||||||
options.addBooleanOption("-no-module-directories", true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.compilerArgs.addAll([
|
|
||||||
'--release', javaMajor,
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
options.charSet = "UTF-8"
|
|
||||||
options.encoding = 'UTF-8'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
testFixturesApi "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
|
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
|
||||||
// https://stackoverflow.com/a/77274251/194894
|
|
||||||
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
|
||||||
|
|
||||||
// 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:${mockitoVersion}"
|
|
||||||
|
|
||||||
// To mock final classes
|
|
||||||
testImplementation "org.mockito:mockito-inline:${mockitoVersion}"
|
|
||||||
testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
|
|
||||||
|
|
||||||
errorprone 'com.google.errorprone:error_prone_core:2.5.1'
|
|
||||||
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make all project's 'test' target depend on javadoc, so that
|
|
||||||
// javadoc is also linted.
|
|
||||||
test { dependsOn javadoc }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configure (junit4Projects) {
|
|
||||||
dependencies {
|
|
||||||
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We need to evaluate the child projects first because
|
|
||||||
// - javadocAll needs the smack-core child to have already resolved
|
|
||||||
// the jXMPP/MiniDNS dependencies, so that we can the resolved
|
|
||||||
// version to link to those project's javadoc.
|
|
||||||
// - We use the child's project description as description for the
|
|
||||||
// Maven POM.
|
|
||||||
evaluationDependsOnChildren()
|
evaluationDependsOnChildren()
|
||||||
task javadocAll(type: Javadoc) {
|
task javadocAll(type: Javadoc) {
|
||||||
source javadocAllProjects.collect {project ->
|
source javadocAllProjects.collect {project ->
|
||||||
|
@ -389,286 +63,6 @@ task javadocAll(type: Javadoc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
|
||||||
task prepareReleasedocs(type: Copy) {
|
|
||||||
from 'resources/releasedocs'
|
|
||||||
into releasedocsDir
|
|
||||||
filter(ReplaceTokens, tokens: [version: version, releasedate: builtDate, targetCompatibility: targetCompatibility.toString()])
|
|
||||||
}
|
|
||||||
|
|
||||||
task distributionZip(type: Zip, dependsOn: [javadocAll, prepareReleasedocs]) {
|
|
||||||
classifier builtDate
|
|
||||||
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 resolved, 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 }
|
|
||||||
|
|
||||||
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}."""
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
apply plugin: 'signing'
|
|
||||||
apply plugin: 'checkstyle'
|
|
||||||
apply plugin: 'biz.aQute.bnd.builder'
|
|
||||||
|
|
||||||
checkstyle {
|
|
||||||
toolVersion = '8.27'
|
|
||||||
}
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
classifier = 'javadoc'
|
|
||||||
from javadoc.destinationDir
|
|
||||||
}
|
|
||||||
task testsJar(type: Jar, dependsOn: testClasses) {
|
|
||||||
classifier = 'tests'
|
|
||||||
from sourceSets.test.output
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
// See http://stackoverflow.com/a/21946676/194894
|
|
||||||
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/'
|
|
||||||
description = project.description
|
|
||||||
|
|
||||||
issueManagement {
|
|
||||||
system = 'JIRA'
|
|
||||||
url = 'https://igniterealtime.org/issues/browse/SMACK'
|
|
||||||
}
|
|
||||||
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
if (sonatypeCredentialsAvailable && useSonatype) {
|
|
||||||
maven {
|
|
||||||
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
|
|
||||||
credentials {
|
|
||||||
username = sonatypeUsername
|
|
||||||
password = sonatypePassword
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rootProject.distributionZip {
|
|
||||||
dependsOn build
|
|
||||||
from(buildDir) {
|
|
||||||
include "$libsDirName/*${version}.jar"
|
|
||||||
include "$libsDirName/*${version}-javadoc.jar"
|
|
||||||
include "$libsDirName/*${version}-sources.jar"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
signing {
|
|
||||||
useGpgCmd()
|
|
||||||
required { signingRequired }
|
|
||||||
sign publishing.publications.mavenJava
|
|
||||||
}
|
|
||||||
|
|
||||||
// Work around https://github.com/gradle/gradle/issues/4046
|
|
||||||
task copyJavadocDocFiles(type: Copy) {
|
|
||||||
from('src/javadoc')
|
|
||||||
into 'build/docs/javadoc'
|
|
||||||
include '**/doc-files/*.*'
|
|
||||||
}
|
|
||||||
javadoc.dependsOn copyJavadocDocFiles
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|
||||||
configure (androidProjects + androidBootClasspathProjects) {
|
|
||||||
apply plugin: 'ru.vyarus.animalsniffer'
|
|
||||||
dependencies {
|
|
||||||
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:5.0.1_r2@signature"
|
|
||||||
}
|
|
||||||
animalsniffer {
|
|
||||||
sourceSets = [sourceSets.main]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects*.jar {
|
|
||||||
manifest {
|
|
||||||
from sharedManifest
|
|
||||||
}
|
|
||||||
bundle {
|
|
||||||
bnd(
|
|
||||||
'-removeheaders': 'Tool, Bnd-*',
|
|
||||||
'-exportcontents': '*',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(subprojects - gplLicensedProjects) {
|
|
||||||
checkstyle {
|
|
||||||
configProperties.checkstyleLicenseHeader = "header"
|
|
||||||
}
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
pom {
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(androidBootClasspathProjects) {
|
|
||||||
compileJava {
|
|
||||||
options.bootstrapClasspath = files(androidBootClasspath)
|
|
||||||
}
|
|
||||||
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
|
|
||||||
getSourceDirectories().setFrom(files(projectsWithUnitTests.sourceSets.main.allSource.srcDirs))
|
|
||||||
getClassDirectories().setFrom(files(projectsWithUnitTests.sourceSets.main.output))
|
|
||||||
getExecutionData().setFrom(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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
task integrationTest {
|
task integrationTest {
|
||||||
description 'Verify correct functionality of Smack by running some integration tests.'
|
description 'Verify correct functionality of Smack by running some integration tests.'
|
||||||
dependsOn project(':smack-integration-test').tasks.run
|
dependsOn project(':smack-integration-test').tasks.run
|
||||||
|
@ -676,7 +70,7 @@ task integrationTest {
|
||||||
|
|
||||||
task omemoSignalIntTest {
|
task omemoSignalIntTest {
|
||||||
description 'Run integration tests of the smack-omemo module in combination with smack-omemo-signal.'
|
description 'Run integration tests of the smack-omemo module in combination with smack-omemo-signal.'
|
||||||
dependsOn project(':smack-omemo-signal-integration-test').tasks.run
|
dependsOn 'smack-omemo-signal-integration-test:run'
|
||||||
}
|
}
|
||||||
|
|
||||||
task sinttestAll {
|
task sinttestAll {
|
||||||
|
@ -687,70 +81,6 @@ task sinttestAll {
|
||||||
]}
|
]}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getGitCommit() {
|
|
||||||
def projectDirFile = new File("$projectDir")
|
|
||||||
def dotGit = new File(projectDirFile, ".git")
|
|
||||||
if (!dotGit.isDirectory()) return 'non-git build'
|
|
||||||
|
|
||||||
def cmd = 'git describe --always --tags --dirty=+'
|
|
||||||
def proc = cmd.execute(null, projectDirFile)
|
|
||||||
proc.waitForOrKill(10 * 1000)
|
|
||||||
|
|
||||||
def gitCommit = proc.text.trim()
|
|
||||||
assert !gitCommit.isEmpty()
|
|
||||||
|
|
||||||
def srCmd = 'git symbolic-ref --short HEAD'
|
|
||||||
def srProc = srCmd.execute(null, projectDirFile)
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
gitCommit
|
|
||||||
}
|
|
||||||
|
|
||||||
def getAndroidRuntimeJar() {
|
|
||||||
def androidApiLevel = ext.smackMinAndroidSdk
|
|
||||||
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 API level ${androidApiLevel}. Please install corresponding SDK platform package")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getAndroidJavadocOffline() {
|
|
||||||
def androidHome = getAndroidHome()
|
|
||||||
return androidHome.toString() + "/docs/reference"
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
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()
|
|
||||||
}
|
|
||||||
|
|
||||||
def getResolvedVersion(queriedProject = 'smack-core', component) {
|
def getResolvedVersion(queriedProject = 'smack-core', component) {
|
||||||
def configuration = project(queriedProject)
|
def configuration = project(queriedProject)
|
||||||
.configurations
|
.configurations
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,7 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
297
gradlew
vendored
297
gradlew
vendored
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -15,69 +15,104 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
@ -87,9 +122,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -98,88 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
37
gradlew.bat
vendored
37
gradlew.bat
vendored
|
@ -13,8 +13,10 @@
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
|
@ -25,7 +27,8 @@
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
11
repl
11
repl
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
JDWP=false
|
JDWP=false
|
||||||
JDWP_PORT=8000
|
JDWP_PORT=8000
|
||||||
|
@ -37,12 +35,13 @@ echo "Compiling and computing classpath (May take a while)"
|
||||||
# /smack/smack-repl/build/classes/main:/smack/smack-repl/build/
|
# /smack/smack-repl/build/classes/main:/smack/smack-repl/build/
|
||||||
# resources/main:/smack/smack-tcp/build/libs/smack-tcp-4.2.0-alpha4-SNAPSHOT.jar
|
# resources/main:/smack/smack-tcp/build/libs/smack-tcp-4.2.0-alpha4-SNAPSHOT.jar
|
||||||
# So perform a "tail -n1" on the output of gradle
|
# So perform a "tail -n1" on the output of gradle
|
||||||
GRADLE_CLASSPATH="$(gradle :smack-repl:printClasspath --quiet |\
|
GRADLE_CLASSPATH="$(${GRADLE_BIN:-./gradlew} :smack-repl:printClasspath --quiet |\
|
||||||
tail -n1)"
|
tail -n1)"
|
||||||
echo "Finished, starting REPL"
|
echo "Finished, starting REPL"
|
||||||
|
|
||||||
java "${EXTRA_JAVA_ARGS[@]}" \
|
exec java \
|
||||||
|
"${EXTRA_JAVA_ARGS[@]}" \
|
||||||
-Dscala.usejavacp=true \
|
-Dscala.usejavacp=true \
|
||||||
-classpath "${GRADLE_CLASSPATH}" \
|
-classpath "${GRADLE_CLASSPATH}" \
|
||||||
ammonite.Main \
|
ammonite.Main \
|
||||||
--predef "smack-repl/scala.repl"
|
--predef smack-repl/scala.repl
|
||||||
|
|
|
@ -1,221 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Smack Readme</title>
|
|
||||||
<style type="text/css">
|
|
||||||
/* global font and body settings */
|
|
||||||
body {
|
|
||||||
font-size : 100%;
|
|
||||||
background-color : #d3d6d9;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0 0 30px 0;
|
|
||||||
}
|
|
||||||
body, td, th {
|
|
||||||
font-family : arial, helvetica, sans-serif;
|
|
||||||
font-size : 10pt;
|
|
||||||
}
|
|
||||||
pre, tt, code {
|
|
||||||
font-family : courier new, monospace;
|
|
||||||
font-size : 9pt;
|
|
||||||
}
|
|
||||||
#pageContainer {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
clear: both;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #999;
|
|
||||||
padding: 40px;
|
|
||||||
margin: 30px;
|
|
||||||
-moz-border-radius: 6px;
|
|
||||||
}
|
|
||||||
#pageHeader {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
height: 80px;
|
|
||||||
background-color: #e7eaee;
|
|
||||||
border: 1px solid #cccccc;
|
|
||||||
border-bottom: none;
|
|
||||||
-moz-border-radius: 5px 5px 0 0;
|
|
||||||
margin: 10px 0 0 0;
|
|
||||||
}
|
|
||||||
#pageBody {
|
|
||||||
margin: 0 18px 0 20px;
|
|
||||||
}
|
|
||||||
/* anchors */
|
|
||||||
a:link {
|
|
||||||
color: #11568c;
|
|
||||||
}
|
|
||||||
a:visited {
|
|
||||||
color: #571c8d;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #7a1d42;
|
|
||||||
text-decoration : underline;
|
|
||||||
}
|
|
||||||
a:active {
|
|
||||||
color: #7a1d42;
|
|
||||||
}
|
|
||||||
/* page header elements (logo and navigation) */
|
|
||||||
.navigation {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
height: 20px;
|
|
||||||
background-color: #335588;
|
|
||||||
border: 1px solid #cccccc;
|
|
||||||
border-top: none;
|
|
||||||
color: #ffffff;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 18px;
|
|
||||||
padding: 0 0 0 0;
|
|
||||||
margin: 0 0 25px 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.navigation a {
|
|
||||||
margin: 0 20px 0 20px;
|
|
||||||
}
|
|
||||||
.navigation a:link { color: #ffffff; }
|
|
||||||
.navigation a:visited { color: #ffffff; }
|
|
||||||
.navigation a:hover { color: #ffffff; }
|
|
||||||
.navigation a:active { color: #ffffff; }
|
|
||||||
/* headings */
|
|
||||||
h1 {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
font-size : 1.7em;
|
|
||||||
font-weight : bold;
|
|
||||||
color: #670e15;
|
|
||||||
padding: 0;
|
|
||||||
margin: 30px 0 0 20px;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
font-size : 1.3em;
|
|
||||||
font-weight : bold;
|
|
||||||
margin: 40px 0 6px 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #335588;
|
|
||||||
}
|
|
||||||
h3 {
|
|
||||||
font-size : 1.0em;
|
|
||||||
font-weight : bold;
|
|
||||||
margin: 25px 0 3px 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #334466;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* general elements */
|
|
||||||
p {
|
|
||||||
margin: 0 0 15px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
margin: 5px 0 15px 15px;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
padding-bottom : 4px;
|
|
||||||
}
|
|
||||||
tt {
|
|
||||||
font-family : courier new, monospace;
|
|
||||||
font-weight : bold;
|
|
||||||
color : #060;
|
|
||||||
}
|
|
||||||
hr {
|
|
||||||
display: block;
|
|
||||||
height: 1px;
|
|
||||||
background-color: #999999;
|
|
||||||
border: none;
|
|
||||||
margin: 40px 0 20px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div id="pageContainer">
|
|
||||||
|
|
||||||
<div id="pageHeader">
|
|
||||||
<h1>Smack Readme</h1>
|
|
||||||
</div>
|
|
||||||
<div class="navigation">
|
|
||||||
<a href="README.html">Readme</a>|<a href="changelog.html"><strong>Changelog</strong></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="pageBody">
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<table border=0>
|
|
||||||
<tr>
|
|
||||||
<td align="right">version:</td>
|
|
||||||
<td><b>@version@</b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right">released:</td>
|
|
||||||
<td><b>@releasedate@</b></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Thank you for downloading Smack! This version of Smack is compatible
|
|
||||||
with JVMs @targetCompatibility@ or higher. Using a build system which
|
|
||||||
is able to consume Maven artifacts, like gradle or Maven, is highly
|
|
||||||
recommended when using Smack.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>This is not the real README.</b> Please visit
|
|
||||||
<center>
|
|
||||||
<a href="https://www.igniterealtime.org/projects/smack/readme">https://www.igniterealtime.org/projects/smack/readme</a>
|
|
||||||
</center>
|
|
||||||
for the README of the current stable Smack version.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Smack tries to depend on as few as possible libraries. The only
|
|
||||||
requirement is <a href="http://jxmpp.org">jXMPP</a>. For DNS
|
|
||||||
resolution we recommend to
|
|
||||||
use <a href="http://minidns.org">MiniDNS</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Start off by viewing the <a href="documentation/index.html">documentation</a>
|
|
||||||
that can be found in the "documentation" directory included with this distribution.
|
|
||||||
</p>
|
|
||||||
Further information can be found on the <a href="http://www.igniterealtime.org/projects/smack">
|
|
||||||
Smack website</a>. If you need help using or would like to make contributions or
|
|
||||||
fixes to the code, please visit the
|
|
||||||
<a href="https://community.igniterealtime.org">online forum</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p><b>Changelog and Upgrading</b><p>
|
|
||||||
|
|
||||||
View the <a href="changelog.html">changelog</a> for a list of changes since the
|
|
||||||
last release.
|
|
||||||
|
|
||||||
<p><b>License Agreements</b><p>
|
|
||||||
<ul>
|
|
||||||
<li>Use of the Smack source code is governed by the Apache License Version 2.0:
|
|
||||||
<pre>
|
|
||||||
Copyright 2002-2008 Jive Software.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
</pre></li>
|
|
||||||
|
|
||||||
<li>Smack contains icons and images licensed from INCORS GmbH. You are not licensed
|
|
||||||
to use these icons outside of Smack.</li>
|
|
||||||
|
|
||||||
<li>Third-party source code is licensed as noted in their source files.
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
pluginManagement {
|
||||||
|
includeBuild('build-logic')
|
||||||
|
}
|
||||||
|
|
||||||
// The name of the root project.
|
// The name of the root project.
|
||||||
// If we would not set the name, then gradle would use the directory
|
// If we would not set the name, then gradle would use the directory
|
||||||
// name of the root directory
|
// name of the root directory
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-boot-classpath-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Extra Smack extensions for Android."""
|
Extra Smack extensions for Android."""
|
||||||
|
|
||||||
|
@ -8,5 +14,5 @@ dependencies {
|
||||||
api project(':smack-extensions')
|
api project(':smack-extensions')
|
||||||
|
|
||||||
// Add the Android jar to the Eclipse .classpath.
|
// Add the Android jar to the Eclipse .classpath.
|
||||||
compileClasspath files(androidBootClasspath)
|
implementation files(androidBootClasspath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-boot-classpath-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack for Android.
|
Smack for Android.
|
||||||
All the required dependencies to run Smack on Android.
|
All the required dependencies to run Smack on Android.
|
||||||
|
@ -16,13 +22,13 @@ dependencies {
|
||||||
// used in non-Android projects.
|
// used in non-Android projects.
|
||||||
implementation "org.minidns:minidns-android21:$miniDnsVersion"
|
implementation "org.minidns:minidns-android21:$miniDnsVersion"
|
||||||
|
|
||||||
// androidProjects lists all projects that are checked to compile against android.jar
|
api project(':smack-core')
|
||||||
// Filter out the optional Smack dependencies from androidProjects
|
api project(':smack-im')
|
||||||
(androidProjects - androidOptionalProjects)
|
api project(':smack-resolver-minidns')
|
||||||
.each { project ->
|
api project(':smack-sasl-provided')
|
||||||
api project
|
api project(':smack-xmlparser')
|
||||||
}
|
api project(':smack-xmlparser-xpp3')
|
||||||
|
|
||||||
// Add the Android jar to the Eclipse .classpath.
|
// Add the Android jar to the Eclipse .classpath.
|
||||||
compileClasspath files(androidBootClasspath)
|
implementation files(androidBootClasspath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack BOSH API.
|
Smack BOSH API.
|
||||||
This API is considered beta quality."""
|
This API is considered beta quality."""
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Note that this is also declared in the main build.gradle for
|
plugins {
|
||||||
// subprojects, but since evaluationDependsOnChildren is enabled we
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
// need to declare it here too to have bundle{bnd{...}} available
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
apply plugin: 'biz.aQute.bnd.builder'
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack core components."""
|
Smack core components."""
|
||||||
|
@ -16,6 +16,9 @@ dependencies {
|
||||||
api "org.jxmpp:jxmpp-jid:$jxmppVersion"
|
api "org.jxmpp:jxmpp-jid:$jxmppVersion"
|
||||||
api "org.minidns:minidns-core:$miniDnsVersion"
|
api "org.minidns:minidns-core:$miniDnsVersion"
|
||||||
|
|
||||||
|
// TODO: Migrate Junit4 tests to Junit5.
|
||||||
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||||
|
|
||||||
testFixturesImplementation project(':smack-xmlparser-stax')
|
testFixturesImplementation project(':smack-xmlparser-stax')
|
||||||
testFixturesImplementation project(':smack-xmlparser-xpp3')
|
testFixturesImplementation project(':smack-xmlparser-xpp3')
|
||||||
|
|
||||||
|
@ -59,7 +62,7 @@ task createVersionResource(type: CreateFileTask) {
|
||||||
outputFile = new File(projectDir, 'src/main/resources/org.jivesoftware.smack/version')
|
outputFile = new File(projectDir, 'src/main/resources/org.jivesoftware.smack/version')
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.dependsOn(createVersionResource)
|
processResources.dependsOn(createVersionResource)
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
bundle {
|
bundle {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2009 Jive Software, 2018-2022 Florian Schmaus.
|
* Copyright 2009 Jive Software, 2018-2024 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,6 +19,7 @@ package org.jivesoftware.smack;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -1067,6 +1068,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <I extends IQ> I sendIqRequestAndWaitForResponse(IQ request)
|
public <I extends IQ> I sendIqRequestAndWaitForResponse(IQ request)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
StanzaCollector collector = createStanzaCollectorAndSend(request);
|
StanzaCollector collector = createStanzaCollectorAndSend(request);
|
||||||
|
@ -1214,7 +1216,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
Stanza packet = (Stanza) sendTopLevelStreamElement;
|
Stanza packet = (Stanza) sendTopLevelStreamElement;
|
||||||
|
|
||||||
final List<StanzaListener> listenersToNotify = new LinkedList<>();
|
final List<StanzaListener> listenersToNotify = new ArrayList<>();
|
||||||
synchronized (sendListeners) {
|
synchronized (sendListeners) {
|
||||||
for (ListenerWrapper listenerWrapper : sendListeners.values()) {
|
for (ListenerWrapper listenerWrapper : sendListeners.values()) {
|
||||||
if (listenerWrapper.filterMatches(packet)) {
|
if (listenerWrapper.filterMatches(packet)) {
|
||||||
|
@ -1284,7 +1286,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
private static <MPB extends MessageOrPresenceBuilder<MP, MPB>, MP extends MessageOrPresence<MPB>> MP fireMessageOrPresenceInterceptors(
|
private static <MPB extends MessageOrPresenceBuilder<MP, MPB>, MP extends MessageOrPresence<MPB>> MP fireMessageOrPresenceInterceptors(
|
||||||
MP messageOrPresence, Map<Consumer<MPB>, GenericInterceptorWrapper<MPB, MP>> interceptors) {
|
MP messageOrPresence, Map<Consumer<MPB>, GenericInterceptorWrapper<MPB, MP>> interceptors) {
|
||||||
List<Consumer<MPB>> interceptorsToInvoke = new LinkedList<>();
|
List<Consumer<MPB>> interceptorsToInvoke = new ArrayList<>();
|
||||||
synchronized (interceptors) {
|
synchronized (interceptors) {
|
||||||
for (GenericInterceptorWrapper<MPB, MP> interceptorWrapper : interceptors.values()) {
|
for (GenericInterceptorWrapper<MPB, MP> interceptorWrapper : interceptors.values()) {
|
||||||
if (interceptorWrapper.filterMatches(messageOrPresence)) {
|
if (interceptorWrapper.filterMatches(messageOrPresence)) {
|
||||||
|
@ -1319,7 +1321,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* @return the, potentially modified stanza, after the interceptors are run.
|
* @return the, potentially modified stanza, after the interceptors are run.
|
||||||
*/
|
*/
|
||||||
private Stanza firePacketInterceptors(Stanza packet) {
|
private Stanza firePacketInterceptors(Stanza packet) {
|
||||||
List<StanzaListener> interceptorsToInvoke = new LinkedList<>();
|
List<StanzaListener> interceptorsToInvoke = new ArrayList<>();
|
||||||
synchronized (interceptors) {
|
synchronized (interceptors) {
|
||||||
for (InterceptorWrapper interceptorWrapper : interceptors.values()) {
|
for (InterceptorWrapper interceptorWrapper : interceptors.values()) {
|
||||||
if (interceptorWrapper.filterMatches(packet)) {
|
if (interceptorWrapper.filterMatches(packet)) {
|
||||||
|
@ -1604,7 +1606,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
// First handle the async recv listeners. Note that this code is very similar to what follows a few lines below,
|
// First handle the async recv listeners. Note that this code is very similar to what follows a few lines below,
|
||||||
// the only difference is that asyncRecvListeners is used here and that the packet listeners are started in
|
// the only difference is that asyncRecvListeners is used here and that the packet listeners are started in
|
||||||
// their own thread.
|
// their own thread.
|
||||||
final Collection<StanzaListener> listenersToNotify = new LinkedList<>();
|
final Collection<StanzaListener> listenersToNotify = new ArrayList<>();
|
||||||
extractMatchingListeners(packet, asyncRecvListeners, listenersToNotify);
|
extractMatchingListeners(packet, asyncRecvListeners, listenersToNotify);
|
||||||
for (final StanzaListener listener : listenersToNotify) {
|
for (final StanzaListener listener : listenersToNotify) {
|
||||||
asyncGoLimited(new Runnable() {
|
asyncGoLimited(new Runnable() {
|
||||||
|
@ -1930,7 +1932,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
// Default implementation does nothing
|
// Default implementation does nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
@Override
|
@Override
|
||||||
public <F extends XmlElement> F getFeature(QName qname) {
|
public <F extends XmlElement> F getFeature(QName qname) {
|
||||||
return (F) streamFeatures.get(qname);
|
return (F) streamFeatures.get(qname);
|
||||||
|
@ -2175,6 +2177,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* {@link #maxAsyncRunnables}. Note that we use a {@code LinkedList} in order to avoid space blowups in case the
|
* {@link #maxAsyncRunnables}. Note that we use a {@code LinkedList} in order to avoid space blowups in case the
|
||||||
* list ever becomes very big and shrinks again.
|
* list ever becomes very big and shrinks again.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JdkObsolete")
|
||||||
private final Queue<Runnable> deferredAsyncRunnables = new LinkedList<>();
|
private final Queue<Runnable> deferredAsyncRunnables = new LinkedList<>();
|
||||||
|
|
||||||
private int deferredAsyncRunnablesCount;
|
private int deferredAsyncRunnablesCount;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2018 Florian Schmaus
|
* Copyright 2018-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -50,11 +50,13 @@ public class ScheduledAction implements Delayed {
|
||||||
return smackReactor.cancel(this);
|
return smackReactor.cancel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public boolean isDue() {
|
public boolean isDue() {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
return now.after(releaseTime);
|
return now.after(releaseTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public long getTimeToDueMillis() {
|
public long getTimeToDueMillis() {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
return releaseTime.getTime() - now;
|
return releaseTime.getTime() - now;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2018-2023 Florian Schmaus
|
* Copyright 2018-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -144,6 +144,7 @@ public class SmackReactor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
ScheduledAction schedule(Runnable runnable, long delay, TimeUnit unit, ScheduledAction.Kind scheduledActionKind) {
|
ScheduledAction schedule(Runnable runnable, long delay, TimeUnit unit, ScheduledAction.Kind scheduledActionKind) {
|
||||||
long releaseTimeEpoch = System.currentTimeMillis() + unit.toMillis(delay);
|
long releaseTimeEpoch = System.currentTimeMillis() + unit.toMillis(delay);
|
||||||
Date releaseTimeDate = new Date(releaseTimeEpoch);
|
Date releaseTimeDate = new Date(releaseTimeEpoch);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2016-2019 Florian Schmaus.
|
* Copyright 2003-2007 Jive Software, 2016-2024 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -117,7 +117,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @return the next stanza result, or <code>null</code> if there are no more
|
* @return the next stanza result, or <code>null</code> if there are no more
|
||||||
* results.
|
* results.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public synchronized <P extends Stanza> P pollResult() {
|
public synchronized <P extends Stanza> P pollResult() {
|
||||||
return (P) resultQueue.poll();
|
return (P) resultQueue.poll();
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws XMPPErrorException in case an error response.
|
* @throws XMPPErrorException in case an error response.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <P extends Stanza> P pollResultOrThrow() throws XMPPErrorException {
|
public <P extends Stanza> P pollResultOrThrow() throws XMPPErrorException {
|
||||||
P result = pollResult();
|
P result = pollResult();
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
@ -150,7 +151,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
// TODO: Consider removing this method as it is hardly ever useful.
|
// TODO: Consider removing this method as it is hardly ever useful.
|
||||||
public synchronized <P extends Stanza> P nextResultBlockForever() throws InterruptedException {
|
public synchronized <P extends Stanza> P nextResultBlockForever() throws InterruptedException {
|
||||||
throwIfCancelled();
|
throwIfCancelled();
|
||||||
|
@ -175,6 +176,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <P extends Stanza> P nextResult() throws InterruptedException {
|
public <P extends Stanza> P nextResult() throws InterruptedException {
|
||||||
return nextResult(connection.getReplyTimeout());
|
return nextResult(connection.getReplyTimeout());
|
||||||
}
|
}
|
||||||
|
@ -191,7 +193,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @return the next available stanza or <code>null</code> on timeout or connection error.
|
* @return the next available stanza or <code>null</code> on timeout or connection error.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
|
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
|
||||||
throwIfCancelled();
|
throwIfCancelled();
|
||||||
P res = null;
|
P res = null;
|
||||||
|
@ -223,6 +225,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||||
* @see #nextResultOrThrow(long)
|
* @see #nextResultOrThrow(long)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <P extends Stanza> P nextResultOrThrow() throws NoResponseException, XMPPErrorException,
|
public <P extends Stanza> P nextResultOrThrow() throws NoResponseException, XMPPErrorException,
|
||||||
InterruptedException, NotConnectedException {
|
InterruptedException, NotConnectedException {
|
||||||
return nextResultOrThrow(connection.getReplyTimeout());
|
return nextResultOrThrow(connection.getReplyTimeout());
|
||||||
|
@ -263,6 +266,7 @@ public final class StanzaCollector implements AutoCloseable {
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
* @throws NotConnectedException if there was no response and the connection got disconnected.
|
* @throws NotConnectedException if there was no response and the connection got disconnected.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException,
|
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException,
|
||||||
XMPPErrorException, InterruptedException, NotConnectedException {
|
XMPPErrorException, InterruptedException, NotConnectedException {
|
||||||
P result;
|
P result;
|
||||||
|
|
|
@ -318,6 +318,7 @@ public interface XMPPConnection {
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
<I extends IQ> I sendIqRequestAndWaitForResponse(IQ request)
|
<I extends IQ> I sendIqRequestAndWaitForResponse(IQ request)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
||||||
|
|
||||||
|
@ -590,6 +591,7 @@ public interface XMPPConnection {
|
||||||
* @return a stanza extensions of the feature or <code>null</code>
|
* @return a stanza extensions of the feature or <code>null</code>
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
<F extends XmlElement> F getFeature(QName qname);
|
<F extends XmlElement> F getFeature(QName qname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -301,7 +301,7 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
||||||
currentStateVertex = StateDescriptorGraph.convertToStateGraph(initialStateDescriptorVertex, connectionInternal);
|
currentStateVertex = StateDescriptorGraph.convertToStateGraph(initialStateDescriptorVertex, connectionInternal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public <CM extends ModularXmppClientToServerConnectionModule<? extends ModularXmppClientToServerConnectionModuleDescriptor>> CM getConnectionModuleFor(
|
public <CM extends ModularXmppClientToServerConnectionModule<? extends ModularXmppClientToServerConnectionModuleDescriptor>> CM getConnectionModuleFor(
|
||||||
Class<? extends ModularXmppClientToServerConnectionModuleDescriptor> descriptorClass) {
|
Class<? extends ModularXmppClientToServerConnectionModuleDescriptor> descriptorClass) {
|
||||||
return (CM) connectionModules.get(descriptorClass);
|
return (CM) connectionModules.get(descriptorClass);
|
||||||
|
|
|
@ -143,7 +143,9 @@ public final class ZlibXmppCompressionFactory extends XmppCompressionFactory {
|
||||||
int bytesWritten = compressor.deflate(buffer, initialOutputBufferPosition, length, flushMode);
|
int bytesWritten = compressor.deflate(buffer, initialOutputBufferPosition, length, flushMode);
|
||||||
|
|
||||||
int newOutputBufferPosition = initialOutputBufferPosition + bytesWritten;
|
int newOutputBufferPosition = initialOutputBufferPosition + bytesWritten;
|
||||||
outputBuffer.position(newOutputBufferPosition);
|
// Workaround for Android API not matching Java >=9 API.
|
||||||
|
// See https://issuetracker.google.com/issues/369219141
|
||||||
|
((java.nio.Buffer) outputBuffer).position(newOutputBufferPosition);
|
||||||
|
|
||||||
totalBytesWritten += bytesWritten;
|
totalBytesWritten += bytesWritten;
|
||||||
|
|
||||||
|
@ -156,7 +158,9 @@ public final class ZlibXmppCompressionFactory extends XmppCompressionFactory {
|
||||||
increasedBufferSize = MINIMUM_OUTPUT_BUFFER_INCREASE;
|
increasedBufferSize = MINIMUM_OUTPUT_BUFFER_INCREASE;
|
||||||
}
|
}
|
||||||
ByteBuffer newCurrentOutputBuffer = ByteBuffer.allocate(increasedBufferSize);
|
ByteBuffer newCurrentOutputBuffer = ByteBuffer.allocate(increasedBufferSize);
|
||||||
outputBuffer.flip();
|
// Workaround for Android API not matching Java >=9 API.
|
||||||
|
// See https://issuetracker.google.com/issues/369219141
|
||||||
|
((java.nio.Buffer) outputBuffer).flip();
|
||||||
newCurrentOutputBuffer.put(outputBuffer);
|
newCurrentOutputBuffer.put(outputBuffer);
|
||||||
outputBuffer = newCurrentOutputBuffer;
|
outputBuffer = newCurrentOutputBuffer;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +206,9 @@ public final class ZlibXmppCompressionFactory extends XmppCompressionFactory {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputBuffer.position(inflateOutputBufferOffset + bytesInflated);
|
// Workaround for Android API not matching Java >=9 API.
|
||||||
|
// See https://issuetracker.google.com/issues/369219141
|
||||||
|
((java.nio.Buffer) outputBuffer).position(inflateOutputBufferOffset + bytesInflated);
|
||||||
|
|
||||||
decompressorOutBytes += bytesInflated;
|
decompressorOutBytes += bytesInflated;
|
||||||
|
|
||||||
|
@ -212,7 +218,9 @@ public final class ZlibXmppCompressionFactory extends XmppCompressionFactory {
|
||||||
|
|
||||||
int increasedBufferSize = outputBuffer.capacity() * 2;
|
int increasedBufferSize = outputBuffer.capacity() * 2;
|
||||||
ByteBuffer increasedOutputBuffer = ByteBuffer.allocate(increasedBufferSize);
|
ByteBuffer increasedOutputBuffer = ByteBuffer.allocate(increasedBufferSize);
|
||||||
outputBuffer.flip();
|
// Workaround for Android API not matching Java >=9 API.
|
||||||
|
// See https://issuetracker.google.com/issues/369219141
|
||||||
|
((java.nio.Buffer) outputBuffer).flip();
|
||||||
increasedOutputBuffer.put(outputBuffer);
|
increasedOutputBuffer.put(outputBuffer);
|
||||||
outputBuffer = increasedOutputBuffer;
|
outputBuffer = increasedOutputBuffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class ConsoleDebugger extends AbstractDebugger {
|
||||||
super(connection);
|
super(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Override
|
@Override
|
||||||
protected void log(String logMessage) {
|
protected void log(String logMessage) {
|
||||||
String formatedDate;
|
String formatedDate;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014-2018 Florian Schmaus
|
* Copyright 2014-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,7 +18,7 @@ package org.jivesoftware.smack.initializer;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.LinkedList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -42,7 +42,7 @@ public abstract class UrlInitializer implements SmackInitializer {
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
final ClassLoader classLoader = this.getClass().getClassLoader();
|
final ClassLoader classLoader = this.getClass().getClassLoader();
|
||||||
final List<Exception> exceptions = new LinkedList<Exception>();
|
final List<Exception> exceptions = new ArrayList<Exception>();
|
||||||
final String providerUriString = getProvidersUri();
|
final String providerUriString = getProvidersUri();
|
||||||
if (providerUriString != null) {
|
if (providerUriString != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014-2021 Florian Schmaus
|
* Copyright 2014-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -108,6 +108,7 @@ public class AbstractError {
|
||||||
* @param <PE> type of the ExtensionElement.
|
* @param <PE> type of the ExtensionElement.
|
||||||
* @return the extension, or <code>null</code> if it doesn't exist.
|
* @return the extension, or <code>null</code> if it doesn't exist.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <PE extends XmlElement> PE getExtension(String elementName, String namespace) {
|
public <PE extends XmlElement> PE getExtension(String elementName, String namespace) {
|
||||||
return PacketUtil.extensionElementFrom(extensions, elementName, namespace);
|
return PacketUtil.extensionElementFrom(extensions, elementName, namespace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2020 Florian Schmaus
|
* Copyright © 2014-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,9 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
@ -31,7 +31,7 @@ public class Mechanisms implements ExtensionElement {
|
||||||
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-sasl";
|
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-sasl";
|
||||||
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
public final List<String> mechanisms = new LinkedList<String>();
|
public final List<String> mechanisms = new ArrayList<String>();
|
||||||
|
|
||||||
public Mechanisms(String mechanism) {
|
public Mechanisms(String mechanism) {
|
||||||
mechanisms.add(mechanism);
|
mechanisms.add(mechanism);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2015-2021 Florian Schmaus.
|
* Copyright 2015-2024 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -53,9 +53,7 @@ public final class StandardExtensionElement implements XmlElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new extension element with the given name and namespace and nothing else.
|
* Constructs a new extension element with the given name and namespace and nothing else.
|
||||||
* <p>
|
|
||||||
* This is meant to construct extension elements used as simple flags in Stanzas.
|
* This is meant to construct extension elements used as simple flags in Stanzas.
|
||||||
* <p>
|
|
||||||
*
|
*
|
||||||
* @param name the name of the extension element.
|
* @param name the name of the extension element.
|
||||||
* @param namespace the namespace of the extension element.
|
* @param namespace the namespace of the extension element.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2019-2021 Florian Schmaus
|
* Copyright 2019-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,7 +36,7 @@ public interface StanzaView extends XmlLangElement {
|
||||||
/**
|
/**
|
||||||
* Returns who the stanza is being sent "to", or <code>null</code> if
|
* Returns who the stanza is being sent "to", or <code>null</code> if
|
||||||
* the value is not set. The XMPP protocol often makes the "to"
|
* the value is not set. The XMPP protocol often makes the "to"
|
||||||
* attribute optional, so it does not always need to be set.<p>
|
* attribute optional, so it does not always need to be set.
|
||||||
*
|
*
|
||||||
* @return who the stanza is being sent to, or <code>null</code> if the
|
* @return who the stanza is being sent to, or <code>null</code> if the
|
||||||
* value has not been set.
|
* value has not been set.
|
||||||
|
@ -46,7 +46,7 @@ public interface StanzaView extends XmlLangElement {
|
||||||
/**
|
/**
|
||||||
* Returns who the stanza is being sent "from" or <code>null</code> if
|
* Returns who the stanza is being sent "from" or <code>null</code> if
|
||||||
* the value is not set. The XMPP protocol often makes the "from"
|
* the value is not set. The XMPP protocol often makes the "from"
|
||||||
* attribute optional, so it does not always need to be set.<p>
|
* attribute optional, so it does not always need to be set.
|
||||||
*
|
*
|
||||||
* @return who the stanza is being sent from, or <code>null</code> if the
|
* @return who the stanza is being sent from, or <code>null</code> if the
|
||||||
* value has not been set.
|
* value has not been set.
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
package org.jivesoftware.smack.provider;
|
package org.jivesoftware.smack.provider;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -39,11 +39,11 @@ import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
public class ProviderFileLoader implements ProviderLoader {
|
public class ProviderFileLoader implements ProviderLoader {
|
||||||
private static final Logger LOGGER = Logger.getLogger(ProviderFileLoader.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ProviderFileLoader.class.getName());
|
||||||
|
|
||||||
private final Collection<IQProviderInfo> iqProviders = new LinkedList<IQProviderInfo>();
|
private final Collection<IQProviderInfo> iqProviders = new ArrayList<IQProviderInfo>();
|
||||||
private final Collection<ExtensionProviderInfo> extProviders = new LinkedList<ExtensionProviderInfo>();
|
private final Collection<ExtensionProviderInfo> extProviders = new ArrayList<ExtensionProviderInfo>();
|
||||||
private final Collection<StreamFeatureProviderInfo> sfProviders = new LinkedList<StreamFeatureProviderInfo>();
|
private final Collection<StreamFeatureProviderInfo> sfProviders = new ArrayList<StreamFeatureProviderInfo>();
|
||||||
|
|
||||||
private List<Exception> exceptions = new LinkedList<Exception>();
|
private List<Exception> exceptions = new ArrayList<Exception>();
|
||||||
|
|
||||||
public ProviderFileLoader(InputStream providerStream) {
|
public ProviderFileLoader(InputStream providerStream) {
|
||||||
this(providerStream, ProviderFileLoader.class.getClassLoader());
|
this(providerStream, ProviderFileLoader.class.getClassLoader());
|
||||||
|
|
|
@ -97,6 +97,7 @@ import org.jivesoftware.smack.util.XmppElementUtil;
|
||||||
* </extensionProvider>
|
* </extensionProvider>
|
||||||
* </smackProviders></pre>
|
* </smackProviders></pre>
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
* If multiple provider entries attempt to register to handle the same element name and namespace,
|
* If multiple provider entries attempt to register to handle the same element name and namespace,
|
||||||
* the first entry loaded from the classpath will take precedence. Whenever a stanza extension
|
* the first entry loaded from the classpath will take precedence. Whenever a stanza extension
|
||||||
* is found in a packet, parsing will be passed to the correct provider. Each provider
|
* is found in a packet, parsing will be passed to the correct provider. Each provider
|
||||||
|
@ -106,7 +107,8 @@ import org.jivesoftware.smack.util.XmppElementUtil;
|
||||||
* set the properties of th class using the values in the stanza extension sub-element. When an
|
* set the properties of th class using the values in the stanza extension sub-element. When an
|
||||||
* extension provider is not registered for an element name and namespace combination, Smack will
|
* extension provider is not registered for an element name and namespace combination, Smack will
|
||||||
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
|
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
|
||||||
* attach it to the packet.<p>
|
* attach it to the packet.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -271,6 +271,7 @@ public abstract class ScramMechanism extends SASLMechanism {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("MixedMutabilityReturnType")
|
||||||
private static Map<Character, String> parseAttributes(String string) throws SmackSaslException {
|
private static Map<Character, String> parseAttributes(String string) throws SmackSaslException {
|
||||||
if (string.length() == 0) {
|
if (string.length() == 0) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2015-2021 Florian Schmaus
|
* Copyright © 2015-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -184,13 +184,14 @@ public class MultiMap<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given number of values for a given key. May return less values then requested.
|
* Remove the given number of values for a given key. May return less values than requested.
|
||||||
*
|
*
|
||||||
* @param key the key to remove from.
|
* @param key the key to remove from.
|
||||||
* @param num the number of values to remove.
|
* @param num the number of values to remove.
|
||||||
* @return a list of the removed values.
|
* @return a list of the removed values.
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("MixedMutabilityReturnType")
|
||||||
public List<V> remove(K key, int num) {
|
public List<V> remove(K key, int num) {
|
||||||
List<V> values = map.get(key);
|
List<V> values = map.get(key);
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2019-2023 Florian Schmaus.
|
* Copyright 2003-2007 Jive Software, 2019-2024 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -25,7 +25,6 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -87,7 +86,7 @@ public class PacketParserUtils {
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public static <S extends Stanza> S parseStanza(String stanza) throws XmlPullParserException, SmackParsingException, IOException {
|
public static <S extends Stanza> S parseStanza(String stanza) throws XmlPullParserException, SmackParsingException, IOException {
|
||||||
return (S) parseStanza(getParserFor(stanza), XmlEnvironment.EMPTY);
|
return (S) parseStanza(getParserFor(stanza), XmlEnvironment.EMPTY);
|
||||||
}
|
}
|
||||||
|
@ -644,7 +643,7 @@ public class PacketParserUtils {
|
||||||
assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
|
assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
|
||||||
String name;
|
String name;
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
List<String> methods = new LinkedList<>();
|
List<String> methods = new ArrayList<>();
|
||||||
outerloop: while (true) {
|
outerloop: while (true) {
|
||||||
XmlPullParser.Event eventType = parser.next();
|
XmlPullParser.Event eventType = parser.next();
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2021 Florian Schmaus
|
* Copyright © 2014-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -32,7 +32,7 @@ public class PacketUtil {
|
||||||
*
|
*
|
||||||
* @return the extension element
|
* @return the extension element
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public static <PE extends XmlElement> PE extensionElementFrom(Collection<XmlElement> collection,
|
public static <PE extends XmlElement> PE extensionElementFrom(Collection<XmlElement> collection,
|
||||||
String element, String namespace) {
|
String element, String namespace) {
|
||||||
for (XmlElement packetExtension : collection) {
|
for (XmlElement packetExtension : collection) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2020 Florian Schmaus.
|
* Copyright 2020-2024 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -30,6 +30,7 @@ public final class Pair<F, S> {
|
||||||
return new Pair<>(first, second);
|
return new Pair<>(first, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ReturnValueIgnored")
|
||||||
public static <F extends Object, S extends Object> Pair<F, S> createAndInitHashCode(F first, S second) {
|
public static <F extends Object, S extends Object> Pair<F, S> createAndInitHashCode(F first, S second) {
|
||||||
Pair<F, S> pair = new Pair<>(first, second);
|
Pair<F, S> pair = new Pair<>(first, second);
|
||||||
pair.hashCode();
|
pair.hashCode();
|
||||||
|
|
|
@ -329,7 +329,10 @@ public class StringUtils {
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return charBuffer.flip().toString();
|
// Workaround for Android API not matching Java >=9 API.
|
||||||
|
// See https://issuetracker.google.com/issues/369219141
|
||||||
|
((java.nio.Buffer) charBuffer).flip();
|
||||||
|
return charBuffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void randomString(Appendable appendable, Random random, char[] alphabet, int numRandomChars)
|
private static void randomString(Appendable appendable, Random random, char[] alphabet, int numRandomChars)
|
||||||
|
|
|
@ -71,6 +71,7 @@ public class XmppElementUtil {
|
||||||
return qname;
|
return qname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("MixedMutabilityReturnType")
|
||||||
public static <E extends ExtensionElement> List<E> getElementsFrom(
|
public static <E extends ExtensionElement> List<E> getElementsFrom(
|
||||||
MultiMap<QName, XmlElement> elementMap, Class<E> extensionElementClass) {
|
MultiMap<QName, XmlElement> elementMap, Class<E> extensionElementClass) {
|
||||||
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
user = getUserJid();
|
user = getUserJid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Override
|
@Override
|
||||||
protected void connectInternal() {
|
protected void connectInternal() {
|
||||||
connected = true;
|
connected = true;
|
||||||
|
@ -162,6 +163,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
* @param <P> the top level stream element class.
|
* @param <P> the top level stream element class.
|
||||||
* @return a sent packet.
|
* @return a sent packet.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <P extends TopLevelStreamElement> P getSentPacket() {
|
public <P extends TopLevelStreamElement> P getSentPacket() {
|
||||||
return getSentPacket(5 * 60);
|
return getSentPacket(5 * 60);
|
||||||
}
|
}
|
||||||
|
@ -176,7 +178,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
* @param <P> the top level stream element class.
|
* @param <P> the top level stream element class.
|
||||||
* @return a sent packet.
|
* @return a sent packet.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public <P extends TopLevelStreamElement> P getSentPacket(int wait) {
|
public <P extends TopLevelStreamElement> P getSentPacket(int wait) {
|
||||||
try {
|
try {
|
||||||
return (P) queue.poll(wait, TimeUnit.SECONDS);
|
return (P) queue.poll(wait, TimeUnit.SECONDS);
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack slf4j debugger.
|
Smack slf4j debugger.
|
||||||
Inspect the exchanged XMPP stanzas.
|
Inspect the exchanged XMPP stanzas.
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack GUI debugger.
|
Smack GUI debugger.
|
||||||
Inspect the exchanged XMPP stanzas."""
|
Inspect the exchanged XMPP stanzas."""
|
||||||
|
|
|
@ -160,6 +160,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
private ReaderListener readerListener;
|
private ReaderListener readerListener;
|
||||||
private WriterListener writerListener;
|
private WriterListener writerListener;
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private Date creationTime = new Date();
|
private Date creationTime = new Date();
|
||||||
|
|
||||||
// Statistics variables
|
// Statistics variables
|
||||||
|
@ -756,6 +757,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
||||||
* @param packet the read stanza to add to the table
|
* @param packet the read stanza to add to the table
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
|
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -827,6 +829,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
* @param dateFormatter the SimpleDateFormat to use to format Dates
|
||||||
* @param packet the sent stanza to add to the table
|
* @param packet the sent stanza to add to the table
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
|
private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -204,7 +204,7 @@ public final class EnhancedDebuggerWindow {
|
||||||
* Creates the main debug window that provides information about Smack and also shows
|
* Creates the main debug window that provides information about Smack and also shows
|
||||||
* a tab panel for each connection that is being debugged.
|
* a tab panel for each connection that is being debugged.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked", "JdkObsolete" })
|
||||||
private void createDebug() {
|
private void createDebug() {
|
||||||
|
|
||||||
frame = new JFrame("Smack Debug Window");
|
frame = new JFrame("Smack Debug Window");
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Examples and test applications for Smack"""
|
Examples and test applications for Smack"""
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2016-2021 Florian Schmaus
|
* Copyright 2016-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* This file is part of smack-examples.
|
* This file is part of smack-examples.
|
||||||
*
|
*
|
||||||
|
@ -136,6 +136,7 @@ public class XmppTools {
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public static void sendItsAlive(String to, XMPPConnection connection)
|
public static void sendItsAlive(String to, XMPPConnection connection)
|
||||||
throws XmppStringprepException, NotConnectedException, InterruptedException {
|
throws XmppStringprepException, NotConnectedException, InterruptedException {
|
||||||
if (to == null) {
|
if (to == null) {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack experimental extensions.
|
Smack experimental extensions.
|
||||||
Classes and methods for XEPs that are in status 'experimental' or that should
|
Classes and methods for XEPs that are in status 'experimental' or that should
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class IoTFieldsExtension implements ExtensionElement {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public static IoTFieldsExtension buildFor(int seqNr, boolean done, NodeInfo nodeInfo,
|
public static IoTFieldsExtension buildFor(int seqNr, boolean done, NodeInfo nodeInfo,
|
||||||
List<? extends IoTDataField> data) {
|
List<? extends IoTDataField> data) {
|
||||||
TimestampElement timestampElement = new TimestampElement(new Date(), data);
|
TimestampElement timestampElement = new TimestampElement(new Date(), data);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2017 Paul Schaub, 2019 Florian Schmaus
|
* Copyright 2017 Paul Schaub, 2019-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -167,6 +167,7 @@ public class JingleFileTransferChild implements JingleContentDescriptionChildEle
|
||||||
return new JingleFileTransferChild(date, desc, hash, mediaType, name, size, range);
|
return new JingleFileTransferChild(date, desc, hash, mediaType, name, size, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public Builder setFile(File file) {
|
public Builder setFile(File file) {
|
||||||
return setDate(new Date(file.lastModified()))
|
return setDate(new Date(file.lastModified()))
|
||||||
.setName(file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("/") + 1))
|
.setName(file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("/") + 1))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2017-2023 Florian Schmaus, 2016-2017 Fernando Ramirez
|
* Copyright © 2017-2024 Florian Schmaus, 2016-2017 Fernando Ramirez
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -387,6 +387,7 @@ public final class MamManager extends Manager {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public Builder limitResultsSince(Date start) {
|
public Builder limitResultsSince(Date start) {
|
||||||
if (start == null) {
|
if (start == null) {
|
||||||
return this;
|
return this;
|
||||||
|
@ -415,6 +416,7 @@ public final class MamManager extends Manager {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public Builder limitResultsBefore(Date end) {
|
public Builder limitResultsBefore(Date end) {
|
||||||
if (end == null) {
|
if (end == null) {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class SpoilerElement implements ExtensionElement {
|
||||||
* @param message message
|
* @param message message
|
||||||
* @return map of spoilers
|
* @return map of spoilers
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("MixedMutabilityReturnType")
|
||||||
public static Map<String, String> getSpoilers(Message message) {
|
public static Map<String, String> getSpoilers(Message message) {
|
||||||
if (!containsSpoiler(message)) {
|
if (!containsSpoiler(message)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class TimestampAffixElement implements NamedElement, AffixElement {
|
||||||
return EqualsUtil.equals(this, obj, (e, o) -> e.append(getTimestamp(), o.getTimestamp()));
|
return EqualsUtil.equals(this, obj, (e, o) -> e.append(getTimestamp(), o.getTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return timestamp.hashCode();
|
return timestamp.hashCode();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2016 Fernando Ramirez, 2018-2020 Florian Schmaus
|
* Copyright 2016 Fernando Ramirez, 2018-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -46,6 +46,7 @@ public class FiltersTest extends MamTest {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Test
|
@Test
|
||||||
public void checkStartDateFilter() throws Exception {
|
public void checkStartDateFilter() throws Exception {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
@ -61,6 +62,7 @@ public class FiltersTest extends MamTest {
|
||||||
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString());
|
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Test
|
@Test
|
||||||
public void checkEndDateFilter() throws Exception {
|
public void checkEndDateFilter() throws Exception {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack extensions.
|
Smack extensions.
|
||||||
Classes and methods that implement support for the various XMPP XEPs
|
Classes and methods that implement support for the various XMPP XEPs
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.bytestreams.ibb;
|
package org.jivesoftware.smackx.bytestreams.ibb;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
@ -135,7 +135,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
||||||
* list of listeners that respond to all In-Band Bytestream requests if there are no user
|
* list of listeners that respond to all In-Band Bytestream requests if there are no user
|
||||||
* specific listeners for that request
|
* specific listeners for that request
|
||||||
*/
|
*/
|
||||||
private final List<BytestreamListener> allRequestListeners = Collections.synchronizedList(new LinkedList<BytestreamListener>());
|
private final List<BytestreamListener> allRequestListeners = Collections.synchronizedList(new ArrayList<BytestreamListener>());
|
||||||
|
|
||||||
/* listener that handles all incoming In-Band Bytestream requests */
|
/* listener that handles all incoming In-Band Bytestream requests */
|
||||||
private final InitiationListener initiationListener;
|
private final InitiationListener initiationListener;
|
||||||
|
@ -162,7 +162,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
||||||
* list containing session IDs of In-Band Bytestream open packets that should be ignored by the
|
* list containing session IDs of In-Band Bytestream open packets that should be ignored by the
|
||||||
* InitiationListener
|
* InitiationListener
|
||||||
*/
|
*/
|
||||||
private final List<String> ignoredBytestreamRequests = Collections.synchronizedList(new LinkedList<String>());
|
private final List<String> ignoredBytestreamRequests = Collections.synchronizedList(new ArrayList<String>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the InBandBytestreamManager to handle In-Band Bytestreams for a given
|
* Returns the InBandBytestreamManager to handle In-Band Bytestreams for a given
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.net.Socket;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -128,7 +127,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
||||||
* list of listeners that respond to all bytestream requests if there are not user specific
|
* list of listeners that respond to all bytestream requests if there are not user specific
|
||||||
* listeners for that request
|
* listeners for that request
|
||||||
*/
|
*/
|
||||||
private final List<BytestreamListener> allRequestListeners = Collections.synchronizedList(new LinkedList<BytestreamListener>());
|
private final List<BytestreamListener> allRequestListeners = Collections.synchronizedList(new ArrayList<BytestreamListener>());
|
||||||
|
|
||||||
/* listener that handles all incoming bytestream requests */
|
/* listener that handles all incoming bytestream requests */
|
||||||
private final InitiationListener initiationListener;
|
private final InitiationListener initiationListener;
|
||||||
|
@ -154,7 +153,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
||||||
* list containing session IDs of SOCKS5 Bytestream initialization packets that should be
|
* list containing session IDs of SOCKS5 Bytestream initialization packets that should be
|
||||||
* ignored by the InitiationListener
|
* ignored by the InitiationListener
|
||||||
*/
|
*/
|
||||||
private final List<String> ignoredBytestreamRequests = Collections.synchronizedList(new LinkedList<String>());
|
private final List<String> ignoredBytestreamRequests = Collections.synchronizedList(new ArrayList<String>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Socks5BytestreamManager to handle SOCKS5 Bytestreams for a given
|
* Returns the Socks5BytestreamManager to handle SOCKS5 Bytestreams for a given
|
||||||
|
|
|
@ -26,12 +26,12 @@ import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -107,7 +107,7 @@ public class Socks5Proxy {
|
||||||
private final Map<String, Socket> connectionMap = new ConcurrentHashMap<>();
|
private final Map<String, Socket> connectionMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/* list of digests connections should be stored */
|
/* list of digests connections should be stored */
|
||||||
private final List<String> allowedConnections = Collections.synchronizedList(new LinkedList<String>());
|
private final List<String> allowedConnections = Collections.synchronizedList(new ArrayList<String>());
|
||||||
|
|
||||||
private final Set<InetAddress> localAddresses = new LinkedHashSet<>(4);
|
private final Set<InetAddress> localAddresses = new LinkedHashSet<>(4);
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ public class Socks5Proxy {
|
||||||
*/
|
*/
|
||||||
public List<InetAddress> getLocalAddresses() {
|
public List<InetAddress> getLocalAddresses() {
|
||||||
synchronized (localAddresses) {
|
synchronized (localAddresses) {
|
||||||
return new LinkedList<>(localAddresses);
|
return new ArrayList<>(localAddresses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2009 Jonas Ådahl, 2011-2022 Florian Schmaus
|
* Copyright © 2009 Jonas Ådahl, 2011-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,12 +19,12 @@ package org.jivesoftware.smackx.caps;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -555,7 +555,7 @@ public final class EntityCapsManager extends Manager {
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
JID_TO_NODEVER_CACHE.put(connection.getUser(), new NodeVerHash(entityNode, currentCapsVersion));
|
JID_TO_NODEVER_CACHE.put(connection.getUser(), new NodeVerHash(entityNode, currentCapsVersion));
|
||||||
|
|
||||||
final List<Identity> identities = new LinkedList<>(ServiceDiscoveryManager.getInstanceFor(connection).getIdentities());
|
final List<Identity> identities = new ArrayList<>(ServiceDiscoveryManager.getInstanceFor(connection).getIdentities());
|
||||||
sdm.setNodeInformationProvider(localNodeVer, new AbstractNodeInformationProvider() {
|
sdm.setNodeInformationProvider(localNodeVer, new AbstractNodeInformationProvider() {
|
||||||
List<String> features = sdm.getFeatures();
|
List<String> features = sdm.getFeatures();
|
||||||
List<DataForm> packetExtensions = sdm.getExtendedInfo();
|
List<DataForm> packetExtensions = sdm.getExtendedInfo();
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -772,7 +771,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
||||||
return serviceDiscoInfo;
|
return serviceDiscoInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
serviceDiscoInfo = new LinkedList<>();
|
serviceDiscoInfo = new ArrayList<>();
|
||||||
// Send the disco packet to the server itself
|
// Send the disco packet to the server itself
|
||||||
DiscoverInfo info;
|
DiscoverInfo info;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.jivesoftware.smackx.disco.packet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -184,7 +183,7 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView {
|
||||||
* @return true if duplicate identities where found, otherwise false
|
* @return true if duplicate identities where found, otherwise false
|
||||||
*/
|
*/
|
||||||
public boolean containsDuplicateIdentities() {
|
public boolean containsDuplicateIdentities() {
|
||||||
List<Identity> checkedIdentities = new LinkedList<>();
|
List<Identity> checkedIdentities = new ArrayList<>(identities.size());
|
||||||
for (Identity i : identities) {
|
for (Identity i : identities) {
|
||||||
for (Identity i2 : checkedIdentities) {
|
for (Identity i2 : checkedIdentities) {
|
||||||
if (i.equals(i2))
|
if (i.equals(i2))
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.disco.packet;
|
package org.jivesoftware.smackx.disco.packet;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
@ -40,7 +40,7 @@ public class DiscoverItems extends IQ {
|
||||||
public static final String ELEMENT = QUERY_ELEMENT;
|
public static final String ELEMENT = QUERY_ELEMENT;
|
||||||
public static final String NAMESPACE = "http://jabber.org/protocol/disco#items";
|
public static final String NAMESPACE = "http://jabber.org/protocol/disco#items";
|
||||||
|
|
||||||
private final List<Item> items = new LinkedList<>();
|
private final List<Item> items = new ArrayList<>();
|
||||||
private String node;
|
private String node;
|
||||||
|
|
||||||
public DiscoverItems() {
|
public DiscoverItems() {
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
package org.jivesoftware.smackx.iqregister.provider;
|
package org.jivesoftware.smackx.iqregister.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class RegistrationProvider extends IqProvider<Registration> {
|
||||||
public Registration parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
public Registration parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
String instruction = null;
|
String instruction = null;
|
||||||
Map<String, String> fields = new HashMap<>();
|
Map<String, String> fields = new HashMap<>();
|
||||||
List<XmlElement> packetExtensions = new LinkedList<>();
|
List<XmlElement> packetExtensions = new ArrayList<>();
|
||||||
outerloop:
|
outerloop:
|
||||||
while (true) {
|
while (true) {
|
||||||
XmlPullParser.Event eventType = parser.next();
|
XmlPullParser.Event eventType = parser.next();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2021 Florian Schmaus.
|
* Copyright 2003-2007 Jive Software, 2021-2024 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,7 +24,7 @@ import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Version IQ packet, which is used by XMPP clients to discover version information
|
* A Version IQ packet, which is used by XMPP clients to discover version information
|
||||||
* about the software running at another entity's JID.<p>
|
* about the software running at another entity's JID.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class IdleElement implements ExtensionElement {
|
||||||
/**
|
/**
|
||||||
* Create a new IdleElement with the current date as date of last user interaction.
|
* Create a new IdleElement with the current date as date of last user interaction.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public IdleElement() {
|
public IdleElement() {
|
||||||
this(new Date());
|
this(new Date());
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,9 +101,7 @@ public final class MucEnterConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the presence used to join the MUC room.
|
* Set the presence used to join the MUC room.
|
||||||
* <p>
|
|
||||||
* The consumer must not modify the presence type, otherwise an {@link IllegalArgumentException} will be thrown.
|
* The consumer must not modify the presence type, otherwise an {@link IllegalArgumentException} will be thrown.
|
||||||
* <p>
|
|
||||||
*
|
*
|
||||||
* @param presenceBuilderConsumer a consumer which will be passed the presence build.
|
* @param presenceBuilderConsumer a consumer which will be passed the presence build.
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
|
|
|
@ -1842,7 +1842,7 @@ public class MultiUserChat {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the presence info for a particular user, or <code>null</code> if the user
|
* Returns the presence info for a particular user, or <code>null</code> if the user
|
||||||
* is not in the room.<p>
|
* is not in the room.
|
||||||
*
|
*
|
||||||
* @param user the room occupant to search for his presence. The format of user must
|
* @param user the room occupant to search for his presence. The format of user must
|
||||||
* be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch).
|
* be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch).
|
||||||
|
@ -1856,7 +1856,7 @@ public class MultiUserChat {
|
||||||
/**
|
/**
|
||||||
* Returns the Occupant information for a particular occupant, or <code>null</code> if the
|
* Returns the Occupant information for a particular occupant, or <code>null</code> if the
|
||||||
* user is not in the room. The Occupant object may include information such as full
|
* user is not in the room. The Occupant object may include information such as full
|
||||||
* JID of the user as well as the role and affiliation of the user in the room.<p>
|
* JID of the user as well as the role and affiliation of the user in the room.
|
||||||
*
|
*
|
||||||
* @param user the room occupant to search for his presence. The format of user must
|
* @param user the room occupant to search for his presence. The format of user must
|
||||||
* be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch).
|
* be: roomName@service/nickname (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch).
|
||||||
|
|
|
@ -108,6 +108,7 @@ public final class MultiUserChatManager extends Manager {
|
||||||
final WeakReference<XMPPConnection> weakRefConnection = new WeakReference<XMPPConnection>(connection);
|
final WeakReference<XMPPConnection> weakRefConnection = new WeakReference<XMPPConnection>(connection);
|
||||||
ServiceDiscoveryManager.getInstanceFor(connection).setNodeInformationProvider(DISCO_NODE,
|
ServiceDiscoveryManager.getInstanceFor(connection).setNodeInformationProvider(DISCO_NODE,
|
||||||
new AbstractNodeInformationProvider() {
|
new AbstractNodeInformationProvider() {
|
||||||
|
@SuppressWarnings({"JavaUtilDate", "MixedMutabilityReturnType"})
|
||||||
@Override
|
@Override
|
||||||
public List<DiscoverItems.Item> getNodeItems() {
|
public List<DiscoverItems.Item> getNodeItems() {
|
||||||
XMPPConnection connection = weakRefConnection.get();
|
XMPPConnection connection = weakRefConnection.get();
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class ItemPublishEvent<T extends Item> extends SubscriptionEvent {
|
||||||
return originalDate;
|
return originalDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getName() + " [subscriptions: " + getSubscriptions() + "], [Delayed: " +
|
return getClass().getName() + " [subscriptions: " + getSubscriptions() + "], [Delayed: " +
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PubSub extends IQ {
|
||||||
setType(type);
|
setType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
|
||||||
public <PE extends XmlElement> PE getExtension(PubSubElementType elem) {
|
public <PE extends XmlElement> PE getExtension(PubSubElementType elem) {
|
||||||
return (PE) getExtensionElement(elem.getElementName(), elem.getNamespace().getXmlns());
|
return (PE) getExtensionElement(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2021 Florian Schmaus
|
* Copyright © 2014-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.rsm;
|
package org.jivesoftware.smackx.rsm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.XmlElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
@ -29,7 +29,7 @@ import org.jivesoftware.smackx.rsm.packet.RSMSet.PageDirection;
|
||||||
public class RSMManager {
|
public class RSMManager {
|
||||||
|
|
||||||
Collection<XmlElement> page(int max) {
|
Collection<XmlElement> page(int max) {
|
||||||
List<XmlElement> packetExtensions = new LinkedList<>();
|
List<XmlElement> packetExtensions = new ArrayList<>();
|
||||||
packetExtensions.add(new RSMSet(max));
|
packetExtensions.add(new RSMSet(max));
|
||||||
return packetExtensions;
|
return packetExtensions;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class RSMManager {
|
||||||
throw new IllegalArgumentException("returnedExtensions must no be null");
|
throw new IllegalArgumentException("returnedExtensions must no be null");
|
||||||
}
|
}
|
||||||
if (additionalExtensions == null) {
|
if (additionalExtensions == null) {
|
||||||
additionalExtensions = new LinkedList<>();
|
additionalExtensions = new ArrayList<>();
|
||||||
}
|
}
|
||||||
RSMSet resultRsmSet = PacketUtil.extensionElementFrom(returnedExtensions, RSMSet.ELEMENT, RSMSet.NAMESPACE);
|
RSMSet resultRsmSet = PacketUtil.extensionElementFrom(returnedExtensions, RSMSet.ELEMENT, RSMSet.NAMESPACE);
|
||||||
if (resultRsmSet == null) {
|
if (resultRsmSet == null) {
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.jxmpp.util.XmppDateTime;
|
||||||
public class StreamInitiationProvider extends IqProvider<StreamInitiation> {
|
public class StreamInitiationProvider extends IqProvider<StreamInitiation> {
|
||||||
private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName());
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Override
|
@Override
|
||||||
public StreamInitiation parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
public StreamInitiation parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
// si
|
// si
|
||||||
|
|
|
@ -22,8 +22,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||||
|
@ -218,7 +218,7 @@ public class EntityCapsManagerTest extends SmackTestSuite {
|
||||||
di.to(JidCreate.from("juliet@capulet.lit/chamber"));
|
di.to(JidCreate.from("juliet@capulet.lit/chamber"));
|
||||||
di.ofType(IQ.Type.result);
|
di.ofType(IQ.Type.result);
|
||||||
|
|
||||||
Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>();
|
Collection<DiscoverInfo.Identity> identities = new ArrayList<DiscoverInfo.Identity>();
|
||||||
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "pc", "Psi 0.11", "en");
|
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "pc", "Psi 0.11", "en");
|
||||||
identities.add(i);
|
identities.add(i);
|
||||||
i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el");
|
i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el");
|
||||||
|
@ -241,7 +241,7 @@ public class EntityCapsManagerTest extends SmackTestSuite {
|
||||||
di.to(")juliet@capulet.lit/chamber");
|
di.to(")juliet@capulet.lit/chamber");
|
||||||
di.ofType(IQ.Type.result);
|
di.ofType(IQ.Type.result);
|
||||||
|
|
||||||
Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>();
|
Collection<DiscoverInfo.Identity> identities = new ArrayList<DiscoverInfo.Identity>();
|
||||||
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "pc", "Psi 0.11", "en");
|
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "pc", "Psi 0.11", "en");
|
||||||
identities.add(i);
|
identities.add(i);
|
||||||
i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el");
|
i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el");
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class Protocol {
|
||||||
public boolean printProtocol = false;
|
public boolean printProtocol = false;
|
||||||
|
|
||||||
// responses to requests are taken form this queue
|
// responses to requests are taken form this queue
|
||||||
|
@SuppressWarnings("JdkObsolete")
|
||||||
private final Queue<Stanza> responses = new LinkedList<>();
|
private final Queue<Stanza> responses = new LinkedList<>();
|
||||||
|
|
||||||
// list of verifications
|
// list of verifications
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack IM.
|
Smack IM.
|
||||||
Classes and methods for XMPP-IM (RFC 6121):
|
Classes and methods for XMPP-IM (RFC 6121):
|
||||||
|
@ -8,4 +13,7 @@ Roster, Chat and other functionality."""
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':smack-core')
|
api project(':smack-core')
|
||||||
testImplementation(testFixtures(project(":smack-core")))
|
testImplementation(testFixtures(project(":smack-core")))
|
||||||
|
|
||||||
|
// TODO: Migrate Junit4 tests to Junit5.
|
||||||
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2016 Florian Schmaus
|
* Copyright 2016-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -34,6 +34,7 @@ import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
public class RosterUtil {
|
public class RosterUtil {
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public static void waitUntilOtherEntityIsSubscribed(Roster roster, BareJid otherEntity, long timeoutMillis)
|
public static void waitUntilOtherEntityIsSubscribed(Roster roster, BareJid otherEntity, long timeoutMillis)
|
||||||
throws InterruptedException, TimeoutException {
|
throws InterruptedException, TimeoutException {
|
||||||
Date deadline = new Date(System.currentTimeMillis() + timeoutMillis);
|
Date deadline = new Date(System.currentTimeMillis() + timeoutMillis);
|
||||||
|
@ -147,6 +148,7 @@ public class RosterUtil {
|
||||||
ensureSubscribedTo(connectionTwo, connectionOne, timeout);
|
ensureSubscribedTo(connectionTwo, connectionOne, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public static void ensureSubscribedTo(XMPPConnection connectionOne, XMPPConnection connectionTwo, long timeout)
|
public static void ensureSubscribedTo(XMPPConnection connectionOne, XMPPConnection connectionTwo, long timeout)
|
||||||
throws NotLoggedInException, NotConnectedException, InterruptedException, TimeoutException {
|
throws NotLoggedInException, NotConnectedException, InterruptedException, TimeoutException {
|
||||||
Date deadline = new Date(System.currentTimeMillis() + timeout);
|
Date deadline = new Date(System.currentTimeMillis() + timeout);
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
apply plugin: 'application'
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.application-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack integration tests."""
|
Smack integration tests."""
|
||||||
|
|
||||||
mainClassName = 'org.igniterealtime.smack.inttest.SmackIntegrationTestFramework'
|
|
||||||
applicationDefaultJvmArgs = ["-enableassertions"]
|
application {
|
||||||
|
mainClass = 'org.igniterealtime.smack.inttest.SmackIntegrationTestFramework'
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':smack-java8-full')
|
api project(':smack-java8-full')
|
||||||
|
@ -20,8 +25,3 @@ dependencies {
|
||||||
testFixturesApi(testFixtures(project(":smack-core")))
|
testFixturesApi(testFixtures(project(":smack-core")))
|
||||||
testImplementation "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
testImplementation "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
|
||||||
// Pass all system properties down to the "application" run
|
|
||||||
systemProperties System.getProperties()
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2015-2023 Florian Schmaus
|
* Copyright 2015-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -22,11 +22,11 @@ import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -587,7 +587,7 @@ public final class Configuration {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File findPropertiesFile() {
|
private static File findPropertiesFile() {
|
||||||
List<String> possibleLocations = new LinkedList<>();
|
List<String> possibleLocations = new ArrayList<>();
|
||||||
possibleLocations.add("properties");
|
possibleLocations.add("properties");
|
||||||
String userHome = System.getProperty("user.home");
|
String userHome = System.getProperty("user.home");
|
||||||
if (userHome != null) {
|
if (userHome != null) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2015-2023 Florian Schmaus
|
* Copyright 2015-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -39,7 +39,6 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -698,9 +697,9 @@ public class SmackIntegrationTestFramework {
|
||||||
*/
|
*/
|
||||||
public final String testRunId = StringUtils.insecureRandomString(5).toLowerCase(Locale.US);
|
public final String testRunId = StringUtils.insecureRandomString(5).toLowerCase(Locale.US);
|
||||||
|
|
||||||
private final List<SuccessfulTest> successfulIntegrationTests = Collections.synchronizedList(new LinkedList<SuccessfulTest>());
|
private final List<SuccessfulTest> successfulIntegrationTests = Collections.synchronizedList(new ArrayList<SuccessfulTest>());
|
||||||
private final List<FailedTest> failedIntegrationTests = Collections.synchronizedList(new LinkedList<FailedTest>());
|
private final List<FailedTest> failedIntegrationTests = Collections.synchronizedList(new ArrayList<FailedTest>());
|
||||||
private final List<TestNotPossible> impossibleIntegrationTests = Collections.synchronizedList(new LinkedList<TestNotPossible>());
|
private final List<TestNotPossible> impossibleIntegrationTests = Collections.synchronizedList(new ArrayList<TestNotPossible>());
|
||||||
|
|
||||||
// TODO: Ideally three would only be a list of disabledTests, but since we do not process a disabled test class
|
// TODO: Ideally three would only be a list of disabledTests, but since we do not process a disabled test class
|
||||||
// any further, we can not determine the concrete disabled tests.
|
// any further, we can not determine the concrete disabled tests.
|
||||||
|
|
|
@ -66,8 +66,8 @@ public class ChatTest extends AbstractSmackIntegrationTest {
|
||||||
JivePropertiesManager.setJavaObjectEnabled(false);
|
JivePropertiesManager.setJavaObjectEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@SmackIntegrationTest
|
@SmackIntegrationTest
|
||||||
|
@SuppressWarnings({"deprecation", "JavaUtilDate"})
|
||||||
public void testProperties() throws Exception {
|
public void testProperties() throws Exception {
|
||||||
org.jivesoftware.smack.chat.Chat newChat = chatManagerOne.createChat(conTwo.getUser());
|
org.jivesoftware.smack.chat.Chat newChat = chatManagerOne.createChat(conTwo.getUser());
|
||||||
StanzaCollector collector = conTwo.createStanzaCollector(new ThreadFilter(newChat.getThreadID()));
|
StanzaCollector collector = conTwo.createStanzaCollector(new ThreadFilter(newChat.getThreadID()));
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Full Smack library for Java SE."""
|
Full Smack library for Java SE."""
|
||||||
|
|
||||||
|
@ -44,6 +48,7 @@ task convertModularXmppClientToServerConnectionStateGraphDotToPng(type: Exec) {
|
||||||
executable 'dot'
|
executable 'dot'
|
||||||
args "-Tpng", "-o", "${outputs.files.first()}", "${inputs.files.first()}"
|
args "-Tpng", "-o", "${outputs.files.first()}", "${inputs.files.first()}"
|
||||||
}
|
}
|
||||||
|
copyJavadocDocFiles.dependsOn convertModularXmppClientToServerConnectionStateGraphDotToPng
|
||||||
|
|
||||||
task cleanGenerateFiles(type: Delete) {
|
task cleanGenerateFiles(type: Delete) {
|
||||||
delete 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.dot', 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.png'
|
delete 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.dot', 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.png'
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack for Java7 (or higher).
|
Smack for Java 11 (or higher).
|
||||||
This is a pseudo-artifact that pulls all the required dependencies to
|
This is a pseudo-artifact that pulls all the required dependencies to
|
||||||
run Smack on Java 7 (or higher) JVMs. Usually you want to add additional
|
run Smack on Java 11 (or higher) JVMs. Usually you want to add additional
|
||||||
dependencies to smack-tcp, smack-extensions and smack-experimental."""
|
dependencies to smack-tcp, smack-extensions and smack-experimental."""
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2015 Florian Schmaus
|
* Copyright 2015-2024 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,8 +23,8 @@ import java.security.Principal;
|
||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -135,7 +135,7 @@ public class XmppHostnameVerifier implements HostnameVerifier {
|
||||||
private static void matchDns(String name, X509Certificate cert) throws CertificateException {
|
private static void matchDns(String name, X509Certificate cert) throws CertificateException {
|
||||||
Collection<List<?>> subjAltNames = cert.getSubjectAlternativeNames();
|
Collection<List<?>> subjAltNames = cert.getSubjectAlternativeNames();
|
||||||
if (subjAltNames != null) {
|
if (subjAltNames != null) {
|
||||||
List<String> nonMatchingDnsAltnames = new LinkedList<>();
|
List<String> nonMatchingDnsAltnames = new ArrayList<>();
|
||||||
for (List<?> san : subjAltNames) {
|
for (List<?> san : subjAltNames) {
|
||||||
if (((Integer) san.get(0)).intValue() != ALTNAME_DNS) {
|
if (((Integer) san.get(0)).intValue() != ALTNAME_DNS) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -253,7 +253,7 @@ public class XmppHostnameVerifier implements HostnameVerifier {
|
||||||
if (subjectAlternativeNames == null) {
|
if (subjectAlternativeNames == null) {
|
||||||
throw new CertificateException("No subject alternative names present");
|
throw new CertificateException("No subject alternative names present");
|
||||||
}
|
}
|
||||||
List<String> nonMatchingIpAltnames = new LinkedList<>();
|
List<String> nonMatchingIpAltnames = new ArrayList<>();
|
||||||
for (List<?> san : subjectAlternativeNames) {
|
for (List<?> san : subjectAlternativeNames) {
|
||||||
if (((Integer) san.get(0)).intValue() != ALTNAME_IP) {
|
if (((Integer) san.get(0)).intValue() != ALTNAME_IP) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack Jingle API.
|
Smack Jingle API.
|
||||||
Warning: This API is beta, outdated and currenlty unmaintained."""
|
Warning: This API is beta, outdated and currenlty unmaintained."""
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class OctTreeQuantizer implements Quantizer {
|
||||||
private int colors = 0;
|
private int colors = 0;
|
||||||
private final List<Vector<OctTreeNode>> colorList;
|
private final List<Vector<OctTreeNode>> colorList;
|
||||||
|
|
||||||
|
@SuppressWarnings("JdkObsolete")
|
||||||
public OctTreeQuantizer() {
|
public OctTreeQuantizer() {
|
||||||
setup(256);
|
setup(256);
|
||||||
colorList = new ArrayList<>(MAX_LEVEL + 1);
|
colorList = new ArrayList<>(MAX_LEVEL + 1);
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack legacy extensions.
|
Smack legacy extensions.
|
||||||
Usually XEPs in the state 'retracted', 'rejected', 'deprecated',
|
Usually XEPs in the state 'retracted', 'rejected', 'deprecated',
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class AgentRoster {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the presence info for a particular agent, or <code>null</code> if the agent
|
* Returns the presence info for a particular agent, or <code>null</code> if the agent
|
||||||
* is unavailable (offline) or if no presence information is available.<p>
|
* is unavailable (offline) or if no presence information is available.
|
||||||
*
|
*
|
||||||
* @param user a fully qualified xmpp JID. The address could be in any valid format (e.g.
|
* @param user a fully qualified xmpp JID. The address could be in any valid format (e.g.
|
||||||
* "domain/resource", "user@domain" or "user@domain/resource").
|
* "domain/resource", "user@domain" or "user@domain/resource").
|
||||||
|
|
|
@ -710,6 +710,7 @@ public class AgentSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) {
|
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) {
|
||||||
Offer offer = new Offer(this.connection, this, requestPacket.getUserID(),
|
Offer offer = new Offer(this.connection, this, requestPacket.getUserID(),
|
||||||
requestPacket.getUserJID(), this.getWorkgroupJID(),
|
requestPacket.getUserJID(), this.getWorkgroupJID(),
|
||||||
|
@ -723,6 +724,7 @@ public class AgentSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private void fireOfferRevokeEvent(OfferRevokeProvider.OfferRevokePacket orp) {
|
private void fireOfferRevokeEvent(OfferRevokeProvider.OfferRevokePacket orp) {
|
||||||
RevokedOffer revokedOffer = new RevokedOffer(orp.getUserJID(), orp.getUserID(),
|
RevokedOffer revokedOffer = new RevokedOffer(orp.getUserJID(), orp.getUserID(),
|
||||||
this.getWorkgroupJID(), orp.getSessionID(), orp.getReason(), new Date());
|
this.getWorkgroupJID(), orp.getSessionID(), orp.getReason(), new Date());
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class AgentChatHistory extends IQ {
|
||||||
|
|
||||||
private final List<AgentChatSession> agentChatSessions = new ArrayList<>();
|
private final List<AgentChatSession> agentChatSessions = new ArrayList<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public AgentChatHistory(EntityBareJid agentJID, int maxSessions, Date startDate) {
|
public AgentChatHistory(EntityBareJid agentJID, int maxSessions, Date startDate) {
|
||||||
this();
|
this();
|
||||||
this.agentJID = agentJID;
|
this.agentJID = agentJID;
|
||||||
|
@ -116,6 +117,7 @@ public class AgentChatHistory extends IQ {
|
||||||
return agentChatHistory;
|
return agentChatHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private static AgentChatSession parseChatSetting(XmlPullParser parser)
|
private static AgentChatSession parseChatSetting(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
|
|
@ -145,6 +145,7 @@ public final class QueueDetails implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public static class Provider extends ExtensionElementProvider<QueueDetails> {
|
public static class Provider extends ExtensionElementProvider<QueueDetails> {
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
@Override
|
@Override
|
||||||
public QueueDetails parse(XmlPullParser parser,
|
public QueueDetails parse(XmlPullParser parser,
|
||||||
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
|
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.workgroup.util;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Hashtable;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ public class MetaDataUtils {
|
||||||
* @throws XmlPullParserException if an error occurs while parsing the XML.
|
* @throws XmlPullParserException if an error occurs while parsing the XML.
|
||||||
* @throws IOException if an error occurs while parsing the XML.
|
* @throws IOException if an error occurs while parsing the XML.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("MixedMutabilityReturnType")
|
||||||
public static Map<String, List<String>> parseMetaData(XmlPullParser parser) throws XmlPullParserException, IOException {
|
public static Map<String, List<String>> parseMetaData(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||||
XmlPullParser.Event eventType = parser.getEventType();
|
XmlPullParser.Event eventType = parser.getEventType();
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ public class MetaDataUtils {
|
||||||
if ((eventType == XmlPullParser.Event.START_ELEMENT)
|
if ((eventType == XmlPullParser.Event.START_ELEMENT)
|
||||||
&& parser.getName().equals(MetaData.ELEMENT_NAME)
|
&& parser.getName().equals(MetaData.ELEMENT_NAME)
|
||||||
&& parser.getNamespace().equals(MetaData.NAMESPACE)) {
|
&& parser.getNamespace().equals(MetaData.NAMESPACE)) {
|
||||||
Map<String, List<String>> metaData = new Hashtable<>();
|
Map<String, List<String>> metaData = new LinkedHashMap<>();
|
||||||
|
|
||||||
eventType = parser.next();
|
eventType = parser.next();
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
apply plugin: 'application'
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.application-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description = """\
|
description = """\
|
||||||
Smack integration tests for OMEMO using libsignal."""
|
Smack integration tests for OMEMO using libsignal."""
|
||||||
|
|
||||||
mainClassName = 'org.igniterealtime.smack.inttest.smack_omemo_signal.SmackOmemoSignalIntegrationTestFramework'
|
application {
|
||||||
applicationDefaultJvmArgs = ["-enableassertions"]
|
mainClass = 'org.igniterealtime.smack.inttest.smack_omemo_signal.SmackOmemoSignalIntegrationTestFramework'
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':smack-integration-test')
|
api project(':smack-integration-test')
|
||||||
api project(':smack-omemo-signal')
|
api project(':smack-omemo-signal')
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
|
||||||
// Pass all system properties down to the "application" run
|
|
||||||
systemProperties System.getProperties()
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description="""
|
description="""
|
||||||
Smack API for XEP-0384: OMEMO Encryption using libsignal
|
Smack API for XEP-0384: OMEMO Encryption using libsignal
|
||||||
"""
|
"""
|
||||||
|
@ -8,6 +13,9 @@ dependencies {
|
||||||
api project(":smack-omemo")
|
api project(":smack-omemo")
|
||||||
implementation 'org.whispersystems:signal-protocol-java:2.8.1'
|
implementation 'org.whispersystems:signal-protocol-java:2.8.1'
|
||||||
|
|
||||||
|
// TODO: Migrate Junit4 tests to Junit5.
|
||||||
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||||
|
|
||||||
testFixturesApi(testFixtures(project(":smack-core")))
|
testFixturesApi(testFixtures(project(":smack-core")))
|
||||||
testImplementation project(path: ":smack-omemo", configuration: "testRuntime")
|
testImplementation project(path: ":smack-omemo", configuration: "testRuntime")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.igniterealtime.smack.java-common-conventions'
|
||||||
|
id 'org.igniterealtime.smack.android-conventions'
|
||||||
|
}
|
||||||
|
|
||||||
description="""
|
description="""
|
||||||
Smack API for XEP-0384: OMEMO Encryption
|
Smack API for XEP-0384: OMEMO Encryption
|
||||||
"""
|
"""
|
||||||
|
@ -7,5 +12,8 @@ dependencies {
|
||||||
api project(":smack-extensions")
|
api project(":smack-extensions")
|
||||||
api project(":smack-experimental")
|
api project(":smack-experimental")
|
||||||
|
|
||||||
|
// TODO: Migrate Junit4 tests to Junit5.
|
||||||
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||||
|
|
||||||
testFixturesApi(testFixtures(project(":smack-core")))
|
testFixturesApi(testFixtures(project(":smack-core")))
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,12 +125,14 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException {
|
public void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException {
|
||||||
File lastMessageReceived = hierarchy.getLastMessageReceivedDatePath(userDevice, contactsDevice);
|
File lastMessageReceived = hierarchy.getLastMessageReceivedDatePath(userDevice, contactsDevice);
|
||||||
writeLong(lastMessageReceived, date.getTime());
|
writeLong(lastMessageReceived, date.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException {
|
public Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException {
|
||||||
File lastMessageReceived = hierarchy.getLastMessageReceivedDatePath(userDevice, contactsDevice);
|
File lastMessageReceived = hierarchy.getLastMessageReceivedDatePath(userDevice, contactsDevice);
|
||||||
Long date = readLong(lastMessageReceived);
|
Long date = readLong(lastMessageReceived);
|
||||||
|
@ -138,12 +140,14 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException {
|
public void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, Date date) throws IOException {
|
||||||
File lastDeviceIdPublished = hierarchy.getLastDeviceIdPublicationDatePath(userDevice, contactsDevice);
|
File lastDeviceIdPublished = hierarchy.getLastDeviceIdPublicationDatePath(userDevice, contactsDevice);
|
||||||
writeLong(lastDeviceIdPublished, date.getTime());
|
writeLong(lastDeviceIdPublished, date.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException {
|
public Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice) throws IOException {
|
||||||
File lastDeviceIdPublished = hierarchy.getLastDeviceIdPublicationDatePath(userDevice, contactsDevice);
|
File lastDeviceIdPublished = hierarchy.getLastDeviceIdPublicationDatePath(userDevice, contactsDevice);
|
||||||
Long date = readLong(lastDeviceIdPublished);
|
Long date = readLong(lastDeviceIdPublished);
|
||||||
|
@ -151,12 +155,14 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, Date date) throws IOException {
|
public void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, Date date) throws IOException {
|
||||||
File lastSignedPreKeyRenewal = hierarchy.getLastSignedPreKeyRenewal(userDevice);
|
File lastSignedPreKeyRenewal = hierarchy.getLastSignedPreKeyRenewal(userDevice);
|
||||||
writeLong(lastSignedPreKeyRenewal, date.getTime());
|
writeLong(lastSignedPreKeyRenewal, date.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
public Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice) throws IOException {
|
public Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice) throws IOException {
|
||||||
File lastSignedPreKeyRenewal = hierarchy.getLastSignedPreKeyRenewal(userDevice);
|
File lastSignedPreKeyRenewal = hierarchy.getLastSignedPreKeyRenewal(userDevice);
|
||||||
Long date = readLong(lastSignedPreKeyRenewal);
|
Long date = readLong(lastSignedPreKeyRenewal);
|
||||||
|
@ -517,6 +523,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
||||||
* Delete a directory with all subdirectories.
|
* Delete a directory with all subdirectories.
|
||||||
* @param root directory to be deleted
|
* @param root directory to be deleted
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JdkObsolete")
|
||||||
public static void deleteDirectory(File root) {
|
public static void deleteDirectory(File root) {
|
||||||
File[] currList;
|
File[] currList;
|
||||||
Stack<File> stack = new Stack<>();
|
Stack<File> stack = new Stack<>();
|
||||||
|
|
|
@ -914,6 +914,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
*
|
*
|
||||||
* @throws IOException if an I/O error occurred.
|
* @throws IOException if an I/O error occurred.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private boolean shouldRotateSignedPreKey(OmemoDevice userDevice) throws IOException {
|
private boolean shouldRotateSignedPreKey(OmemoDevice userDevice) throws IOException {
|
||||||
if (!OmemoConfiguration.getRenewOldSignedPreKeys()) {
|
if (!OmemoConfiguration.getRenewOldSignedPreKeys()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -965,6 +966,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
*
|
*
|
||||||
* @throws IOException if an I/O error occurred.
|
* @throws IOException if an I/O error occurred.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
private OmemoCachedDeviceList removeStaleDevicesFromDeviceList(OmemoDevice userDevice,
|
private OmemoCachedDeviceList removeStaleDevicesFromDeviceList(OmemoDevice userDevice,
|
||||||
BareJid contact,
|
BareJid contact,
|
||||||
OmemoCachedDeviceList contactsDeviceList,
|
OmemoCachedDeviceList contactsDeviceList,
|
||||||
|
@ -1020,6 +1022,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
*
|
*
|
||||||
* @return true if the subject device is considered stale
|
* @return true if the subject device is considered stale
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("JavaUtilDate")
|
||||||
static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) {
|
static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) {
|
||||||
if (userDevice.equals(subject)) {
|
if (userDevice.equals(subject)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue