Merge pull request #2507 from CatimaLoyalty/target/java21

Use Java 21
This commit is contained in:
Sylvia van Os
2025-05-15 21:48:22 +02:00
committed by GitHub
6 changed files with 15 additions and 40 deletions

View File

@@ -24,7 +24,7 @@ permissions:
security-events: none
statuses: none
env:
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
jobs:
build:
runs-on: ubuntu-latest
@@ -36,10 +36,10 @@ jobs:
- name: Fail on bad translations
run: if grep -ri "<xliff" app/src/main/res/values*/strings.xml; then echo "Invalidly escaped translations found"; exit 1; fi
- uses: gradle/actions/wrapper-validation@v4
- name: set up OpenJDK 17
- name: set up OpenJDK 21
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo apt-get install -y openjdk-21-jdk-headless
sudo update-alternatives --auto java
- name: Build
run: ./gradlew assemble${{ matrix.flavor }}Release
@@ -64,8 +64,6 @@ jobs:
api-level: 35
arch: x86_64
script: ./gradlew connected${{ matrix.flavor }}DebugAndroidTest
- name: SpotBugs
run: ./gradlew spotbugs${{ matrix.flavor }}Release
- name: Archive test results
if: always()
uses: actions/upload-artifact@v4.6.2

View File

@@ -36,10 +36,6 @@ These are the Android lint checker, run using:
# ./gradlew lintRelease
and SpotBugs, run using:
# ./gradlew spotbugsRelease
The final check is by testing the application on a live device and verifying
the basic functionality works as expected.

View File

@@ -1,17 +1,12 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.github.spotbugs.snom.SpotBugsTask
plugins {
id("com.android.application")
id("com.github.spotbugs")
id("org.jetbrains.kotlin.android")
}
spotbugs {
ignoreFailures.set(false)
setEffort("max")
excludeFilter.set(file("./config/spotbugs/exclude.xml"))
reportsDir.set(layout.buildDirectory.file("reports/spotbugs/").get().asFile)
kotlin {
jvmToolchain(21)
}
android {
@@ -104,7 +99,11 @@ android {
lintConfig = file("lint.xml")
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "21"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
}
@@ -128,9 +127,6 @@ dependencies {
implementation("com.jaredrummler:colorpicker:1.1.0")
implementation("net.lingala.zip4j:zip4j:2.11.5")
// SpotBugs
implementation("io.wcm.tooling.spotbugs:io.wcm.tooling.spotbugs.annotations:1.0.0")
// Testing
val androidXTestVersion = "1.6.1"
val junitVersion = "4.13.2"
@@ -146,18 +142,6 @@ dependencies {
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
}
tasks.withType<SpotBugsTask>().configureEach {
description = "Run spotbugs"
group = "verification"
//classes = fileTree("build/intermediates/javac/debug/compileDebugJavaWithJavac/classes")
//source = fileTree("src/main/java")
//classpath = files()
reports.maybeCreate("xml").required.set(false)
reports.maybeCreate("html").required.set(true)
}
tasks.register("copyRawResFiles", Copy::class) {
from(
layout.projectDirectory.file("../CHANGELOG.md"),

View File

@@ -576,7 +576,6 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
binding.tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public void onTabSelected(TabLayout.Tab tab) {
viewModel.setTabIndex(tab.getPosition());
showPart(tab.getText().toString());
@@ -588,7 +587,6 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
}
@Override
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public void onTabReselected(TabLayout.Tab tab) {
viewModel.setTabIndex(tab.getPosition());
showPart(tab.getText().toString());

View File

@@ -2,7 +2,6 @@
plugins {
id("com.android.application") version "8.10.0" apply false
id("com.github.spotbugs") version "5.1.4" apply false
id("org.jetbrains.kotlin.android") version "2.1.10" apply false
}

View File

@@ -11,13 +11,13 @@ if [ -z "${ANDROID_SDK_ROOT:-}" ]; then
fi
if [ -z "${JAVA_HOME:-}" ]; then
echo "JAVA_HOME is not set, setting to Java 17"
echo "JAVA_HOME is not set, setting to Java 21"
if [ -f "/etc/debian_version" ]; then
echo "Debian-based distro, Java 17 is /usr/lib/jvm/java-17-openjdk-amd64"
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
echo "Debian-based distro, Java 21 is /usr/lib/jvm/java-21-openjdk-amd64"
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
else
echo "Not Debian-based, assuming Fedora and setting Java 17 as /usr/lib/jvm/java-17-openjdk"
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
echo "Not Debian-based, assuming Fedora and setting Java 21 as /usr/lib/jvm/java-21-openjdk"
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk
fi
fi