2021-01-12 09:06:24 +01:00
|
|
|
name: CI
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build Smack
|
|
|
|
|
Bump to Gradle 8.10.2, require Java 11
Bump Gradle from 6.8.3 to 8.10.2 and increase the minimum required
Java version from 8 to 11 (SMACK-953).
The switch from Java 8 to 11 caused some Bytecode portability issues
regarding NIO Buffers. Java changed with version 9 the return type of
some subclasses of Buffer to return the specific Buffer type instead
of the Buffer superclass [JDK-4774077]. For example, ByteBuffer.filp()
previously returned Buffer, while it does return ByteBuffer now.
This sensible change was not reflected by the Android API [1], which
means that AnimalSniffer rightfully started to complain that there is
no method "ByteBuffer ByteBuffer.flip()" in Android, there is only
"Buffer ByteBuffer.flip()", and those are incompatible methods on
Java's Bytecode layer.
As workaround, this changes
return charBuffer.flip().toString();
to
((java.nio.Buffer) charBuffer).flip();
return charBuffer.toString();
to restore the Bytecode portability between Android and Java.
Errorprone also got new checks, of which JavaUtilDate and JdkObsolete
are wroth mentioning.
JavaUtilData basically strongly recommends to use Java's newer time
API over java.util.Date. But since Smack was Java 8 until now,
j.u.Date is widely used.
Similar JdkObsolete mentions obsolete JDK APIs, like data structures
like Vector and Stack. But mostly LinkedList, which should usually be
replaced by ArrayList. And this is what this commit largely does.
JDK-4774077: https://bugs.openjdk.org/browse/JDK-4774077
1: https://issuetracker.google.com/issues/369219141
2024-09-25 11:43:47 +02:00
|
|
|
runs-on: ubuntu-24.04
|
2020-10-28 18:31:32 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-02-14 19:42:27 +01:00
|
|
|
java:
|
Bump to Gradle 8.10.2, require Java 11
Bump Gradle from 6.8.3 to 8.10.2 and increase the minimum required
Java version from 8 to 11 (SMACK-953).
The switch from Java 8 to 11 caused some Bytecode portability issues
regarding NIO Buffers. Java changed with version 9 the return type of
some subclasses of Buffer to return the specific Buffer type instead
of the Buffer superclass [JDK-4774077]. For example, ByteBuffer.filp()
previously returned Buffer, while it does return ByteBuffer now.
This sensible change was not reflected by the Android API [1], which
means that AnimalSniffer rightfully started to complain that there is
no method "ByteBuffer ByteBuffer.flip()" in Android, there is only
"Buffer ByteBuffer.flip()", and those are incompatible methods on
Java's Bytecode layer.
As workaround, this changes
return charBuffer.flip().toString();
to
((java.nio.Buffer) charBuffer).flip();
return charBuffer.toString();
to restore the Bytecode portability between Android and Java.
Errorprone also got new checks, of which JavaUtilDate and JdkObsolete
are wroth mentioning.
JavaUtilData basically strongly recommends to use Java's newer time
API over java.util.Date. But since Smack was Java 8 until now,
j.u.Date is widely used.
Similar JdkObsolete mentions obsolete JDK APIs, like data structures
like Vector and Stack. But mostly LinkedList, which should usually be
replaced by ArrayList. And this is what this commit largely does.
JDK-4774077: https://bugs.openjdk.org/browse/JDK-4774077
1: https://issuetracker.google.com/issues/369219141
2024-09-25 11:43:47 +02:00
|
|
|
- 17
|
2024-09-25 15:15:04 +02:00
|
|
|
- 21
|
2021-05-22 13:18:13 +02:00
|
|
|
env:
|
2024-09-25 15:15:04 +02:00
|
|
|
PRIMARY_JAVA_VERSION: 21
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-03-10 09:16:52 +01:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2020-10-28 18:31:32 +01:00
|
|
|
- name: Set up JDK ${{ matrix.java }}
|
2023-03-10 09:16:52 +01:00
|
|
|
uses: actions/setup-java@v3
|
2020-10-28 18:31:32 +01:00
|
|
|
with:
|
|
|
|
java-version: ${{ matrix.java }}
|
2023-03-10 09:16:52 +01:00
|
|
|
distribution: temurin
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
# 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 Android SDK
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.android/sdk
|
|
|
|
key: android-${{ hashFiles('build.gradle') }}
|
|
|
|
restore-keys: |
|
|
|
|
android-
|
|
|
|
|
|
|
|
# Pre-reqs
|
|
|
|
- name: Install GraphViz
|
|
|
|
run: sudo apt update && sudo apt install graphviz
|
|
|
|
- name: Install Android SDK Manager
|
2024-09-16 08:59:04 +02:00
|
|
|
uses: android-actions/setup-android@v3
|
2020-10-28 18:31:32 +01:00
|
|
|
- name: Install Android SDK
|
|
|
|
run: |
|
2024-10-15 12:45:18 +02:00
|
|
|
sdkmanager "platforms;android-26"
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
# Testing
|
|
|
|
- name: Gradle Check
|
2022-06-06 15:53:53 +02:00
|
|
|
run: ./gradlew check --stacktrace
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
# Test local publish
|
|
|
|
- name: Gradle publish
|
2022-06-06 15:53:53 +02:00
|
|
|
run: ./gradlew publishToMavenLocal --stacktrace
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
# Javadoc
|
|
|
|
- name: Javadoc
|
2021-05-22 13:18:13 +02:00
|
|
|
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
|
2022-06-06 15:53:53 +02:00
|
|
|
run: ./gradlew javadocAll --stacktrace
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
# Test Coverage Report
|
2024-09-26 19:39:50 +02:00
|
|
|
- name: Aggregated Jacoco Test Coverage Report
|
|
|
|
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
|
Bump to Gradle 8.10.2, require Java 11
Bump Gradle from 6.8.3 to 8.10.2 and increase the minimum required
Java version from 8 to 11 (SMACK-953).
The switch from Java 8 to 11 caused some Bytecode portability issues
regarding NIO Buffers. Java changed with version 9 the return type of
some subclasses of Buffer to return the specific Buffer type instead
of the Buffer superclass [JDK-4774077]. For example, ByteBuffer.filp()
previously returned Buffer, while it does return ByteBuffer now.
This sensible change was not reflected by the Android API [1], which
means that AnimalSniffer rightfully started to complain that there is
no method "ByteBuffer ByteBuffer.flip()" in Android, there is only
"Buffer ByteBuffer.flip()", and those are incompatible methods on
Java's Bytecode layer.
As workaround, this changes
return charBuffer.flip().toString();
to
((java.nio.Buffer) charBuffer).flip();
return charBuffer.toString();
to restore the Bytecode portability between Android and Java.
Errorprone also got new checks, of which JavaUtilDate and JdkObsolete
are wroth mentioning.
JavaUtilData basically strongly recommends to use Java's newer time
API over java.util.Date. But since Smack was Java 8 until now,
j.u.Date is widely used.
Similar JdkObsolete mentions obsolete JDK APIs, like data structures
like Vector and Stack. But mostly LinkedList, which should usually be
replaced by ArrayList. And this is what this commit largely does.
JDK-4774077: https://bugs.openjdk.org/browse/JDK-4774077
1: https://issuetracker.google.com/issues/369219141
2024-09-25 11:43:47 +02:00
|
|
|
run: |
|
2024-09-25 15:28:55 +02:00
|
|
|
./gradlew smack-java11-full:testCodeCoverageReport
|
2024-09-26 19:39:50 +02:00
|
|
|
|
|
|
|
# Coveralls
|
|
|
|
- name: Report coverage stats to Coveralls
|
|
|
|
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
|
|
|
|
uses: coverallsapp/github-action@v2
|
|
|
|
with:
|
|
|
|
format: jacoco
|
|
|
|
file: smack-java11-full/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
|
2020-10-28 18:31:32 +01:00
|
|
|
|
|
|
|
# Upload build artifacts
|
|
|
|
- name: Upload build artifacts
|
2024-09-12 11:53:56 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
2020-10-28 18:31:32 +01:00
|
|
|
with:
|
|
|
|
name: smack-java-${{ matrix.java }}
|
|
|
|
path: |
|
|
|
|
smack-*/build/libs/*.jar
|
|
|
|
!**/*-test-fixtures.jar
|
|
|
|
!**/*-tests.jar
|