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

Merge branch '4.4'

This commit is contained in:
Florian Schmaus 2021-01-10 20:45:32 +01:00
commit c431d84154
3 changed files with 102 additions and 55 deletions

95
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,95 @@
name: Smack CI
env:
GRADLE_VERSION: 6.7.1
on: [push, pull_request]
jobs:
build:
name: Build Smack
runs-on: ubuntu-20.04
strategy:
matrix:
java: [ 1.8, 11 ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
# Caches
- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/build.gradle') }}
restore-keys: |
maven-
- name: Cache Gradle
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: gradle-caches-${{ hashFiles('**/build.gradle') }}
restore-keys:
gradle-caches
- name: Cache Gradle Binary
uses: actions/cache@v2
with:
path: |
~/gradle-bin-${GRADLE_VERSION}/
key: gradle-bin-${GRADLE_VERSION}
- name: Cache Android SDK
uses: actions/cache@v2
with:
path: |
~/.android/sdk
key: android-${{ hashFiles('build.gradle') }}
restore-keys: |
android-
# Pre-reqs
- name: Grab gradle wrapper
run: |
wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
unzip gradle-${GRADLE_VERSION}-all.zip
echo "PATH_TO_GRADLE=./gradle-${GRADLE_VERSION}/bin/gradle" >> $GITHUB_ENV
- name: Install GraphViz
run: sudo apt update && sudo apt install graphviz
- name: Install Android SDK Manager
uses: android-actions/setup-android@v2
- name: Install Android SDK
run: |
sdkmanager "platforms;android-19"
# Testing
- name: Gradle Check
run: ${PATH_TO_GRADLE} check --stacktrace
# Test local publish
- name: Gradle publish
run: ${PATH_TO_GRADLE} publishToMavenLocal --stacktrace
# Javadoc
- name: Javadoc
if: ${{ matrix.java == 11 }}
run: ${PATH_TO_GRADLE} javadocAll --stacktrace
# Test Coverage Report
- name: Jacoco Test Coverage
if: ${{ matrix.java == 1.8 }}
run: ${PATH_TO_GRADLE} jacocoRootReport coveralls
# Upload build artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: smack-java-${{ matrix.java }}
path: |
smack-*/build/libs/*.jar
!**/*-test-fixtures.jar
!**/*-tests.jar

View file

@ -1,52 +0,0 @@
language: android
dist: trusty
android:
components:
- android-19
jdk:
- openjdk8
- openjdk11
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.android/build-cache
- $HOME/.m2
before_install:
- export GRADLE_VERSION=6.2
- wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
- unzip -q gradle-${GRADLE_VERSION}-all.zip
- export PATH="$(pwd)/gradle-${GRADLE_VERSION}/bin:$PATH"
addons:
apt:
update: true
packages:
- graphviz
install: gradle assemble --stacktrace
# Run the test suite and also install the artifacts in the local maven
# archive to additionaly test if artifact creation is
# functional. Which hasn't always be the case in the past, see
# 90cbcaebc7a89f4f771f733a33ac9f389df85be2
# Also run javadocAll to ensure it works.
script:
- |
JAVAC_MAJOR_VERSION=$(javac -version | sed -E 's/javac ([[:digit:]]+).*/\1/')
GRADLE_TASKS=()
GRADLE_TASKS+=(check)
GRADLE_TASKS+=(publishToMavenLocal)
if [[ ${JAVAC_MAJOR_VERSION} -ge 11 ]]; then
GRADLE_TASKS+=(javadocAll)
fi
gradle ${GRADLE_TASKS[@]} --stacktrace
after_success:
- JAVAC_VERSION=$((javac -version) 2>&1)
# Only run jacocoRootReport in the Java 8 build
- if [[ "$JAVAC_VERSION" = javac\ 1.8.* ]]; then gradle jacocoRootReport coveralls; fi

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2019-2020 Florian Schmaus * Copyright 2019-2021 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,6 +18,7 @@ package org.jivesoftware.smack.provider;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.Element;
@ -42,9 +43,12 @@ public class AbstractProvider<E extends Element> {
} else if (elementType instanceof ParameterizedType) { } else if (elementType instanceof ParameterizedType) {
ParameterizedType parameteriezedElementType = (ParameterizedType) elementType; ParameterizedType parameteriezedElementType = (ParameterizedType) elementType;
elementClass = (Class<E>) parameteriezedElementType.getRawType(); elementClass = (Class<E>) parameteriezedElementType.getRawType();
} else if (elementType instanceof TypeVariable) {
TypeVariable<?> typeVariableElementType = (TypeVariable<?>) elementType;
elementClass = (Class<E>) typeVariableElementType.getClass();
} else { } else {
throw new AssertionError( throw new AssertionError("Element type '" + elementType + "' (" + elementType.getClass()
"Element type '" + elementType + "' is neither of type Class or ParameterizedType"); + ") is neither of type Class, ParameterizedType or TypeVariable");
} }
} }