From 65a89799db34962f450df6a94aa5b6a1ef1be3eb Mon Sep 17 00:00:00 2001 From: d050150 Date: Thu, 20 Nov 2025 14:43:08 +0100 Subject: [PATCH 1/4] upgrade some libraries, AGP --- .github/workflows/gradle.yml | 17 ++- app/build.gradle | 11 +- app/lint-baseline.xml | 274 ++++++++++++++++++++++++++++++++++- build.gradle | 2 +- 4 files changed, 290 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f0efa80..8036369 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,7 +28,20 @@ jobs: with: java-version: '17' distribution: 'temurin' - - name: Build with Gradle + + - name: Ensure lint baseline present + run: | + if [ ! -f app/lint-baseline.xml ]; then + echo "::error file=app/lint-baseline.xml::Missing lint-baseline.xml (generate locally with ./gradlew lintDebug -Dlint.baselines.continue=true and commit)." + exit 1 + fi + + - name: Run Android Lint (fail on new issues) + uses: gradle/gradle-build-action@v2 + with: + arguments: lintRelease --warning-mode=all --stacktrace + + - name: Run Unit Tests uses: gradle/gradle-build-action@v2 with: - arguments: build --continue + arguments: test build --warning-mode=all --stacktrace -PcompilerArgs=-Xlint:deprecation \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index bfd9dc7..7516968 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "com.daemon.ssh" minSdkVersion 26 targetSdkVersion 36 - versionCode 52 - versionName "2.1.34" + versionCode 53 + versionName "2.1.35" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } @@ -54,9 +54,10 @@ android { } lint { - baseline = file('lint-baseline.xml') - abortOnError = false - checkReleaseBuilds = false + baseline = file("lint-baseline.xml") + abortOnError = true + warningsAsErrors = true + checkDependencies = true } tasks.withType(JavaCompile).configureEach { diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index cbe0de4..28c01c0 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,13 +1,275 @@ - + - + message="The Google Play store has a policy that limits usage of MANAGE_EXTERNAL_STORAGE" + errorLine1=" <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle index 6c76391..89b94da 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.13.0' + classpath 'com.android.tools.build:gradle:8.13.1' } } From 22dfedd0a04a0ec8804a708ef3883ac805af7d5a Mon Sep 17 00:00:00 2001 From: d050150 Date: Thu, 20 Nov 2025 15:51:16 +0100 Subject: [PATCH 2/4] upgrade to toml --- .gitignore | 10 +++++- app/build.gradle | 47 ++++++++++-------------- build.gradle | 18 ---------- gradle/libs.versions.toml | 75 +++++++++++++++++++++++++++++++++++++++ settings.gradle | 18 +++++++++- 5 files changed, 119 insertions(+), 49 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/.gitignore b/.gitignore index 27b7a4e..164ba0b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,12 @@ /captures .externalNativeBuild .cxx -gradle + +/gradle/.tmp/ +/gradle/android/ +/gradle/caches/ +/gradle/daemon/ +/gradle/jdks/ +/gradle/native/ +/gradle/workers/ +/gradle/wrapper/ diff --git a/app/build.gradle b/app/build.gradle index 7516968..3d3b756 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,16 +1,18 @@ -apply plugin: 'com.android.application' +plugins { + alias(libs.plugins.android.application) +} android { - compileSdk = 36 + compileSdk = libs.versions.compileSdk.get().toInteger() namespace = 'com.sshdaemon' defaultConfig { applicationId "com.daemon.ssh" - minSdkVersion 26 - targetSdkVersion 36 - versionCode 53 - versionName "2.1.35" + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetSdk.get().toInteger() + versionCode libs.versions.versionCode.get().toInteger() + versionName libs.versions.versionName.get() testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } @@ -65,31 +67,18 @@ android { } } -ext { - sshdVersion = '2.16.0' -} - dependencies { - api 'com.google.android.material:material:1.13.0' + api libs.android.material - implementation "org.apache.sshd:sshd-core:${sshdVersion}" - implementation "org.apache.sshd:sshd-sftp:${sshdVersion}" - implementation "org.apache.sshd:sshd-contrib:${sshdVersion}" - implementation "org.slf4j:slf4j-api:2.0.17" - implementation "org.slf4j:slf4j-log4j12:2.0.17" - implementation "org.bouncycastle:bcpkix-jdk15to18:1.82" - implementation "net.i2p.crypto:eddsa:0.3.0" + // SSH and crypto libraries using bundles + implementation libs.bundles.sshd + implementation libs.bundles.slf4j + implementation libs.bundles.crypto - testImplementation "org.junit.jupiter:junit-jupiter-api:5.13.4" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.13.4" - testImplementation "org.junit.jupiter:junit-jupiter-params:5.13.4" - testImplementation "org.junit.platform:junit-platform-launcher:1.13.4" + // Testing libraries using bundles + testImplementation libs.bundles.junit.testing + testRuntimeOnly libs.bundles.junit.runtime - testImplementation "org.hamcrest:hamcrest-all:1.3" - testImplementation "org.mockito:mockito-core:5.19.0" - testImplementation "org.mockito:mockito-junit-jupiter:5.2.0" - androidTestImplementation "androidx.test:core:1.7.0" - androidTestImplementation "androidx.test.ext:junit:1.3.0" - androidTestImplementation "androidx.test:runner:1.7.0" - androidTestImplementation "androidx.test.espresso:espresso-core:3.7.0" + // Android testing libraries using bundle + androidTestImplementation libs.bundles.androidx.testing } diff --git a/build.gradle b/build.gradle index 89b94da..47ca2bb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,5 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - - repositories { - mavenCentral() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:8.13.1' - } -} - -allprojects { - repositories { - mavenCentral() - google() - } -} - tasks.register('clean', Delete) { delete rootProject.layout.buildDirectory } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..dbf843f --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,75 @@ +[versions] +# Android SDK versions +compileSdk = "36" +minSdk = "26" +targetSdk = "36" + +# App version +versionCode = "53" +versionName = "2.1.35" + +# Build tools +androidGradlePlugin = "8.13.1" + +# Core dependencies +sshd = "2.16.0" +slf4j = "2.0.17" +bouncycastle = "1.82" +eddsa = "0.3.0" + +# Android libraries +material = "1.13.0" + +# Testing libraries +junit = "5.13.4" +junitPlatform = "1.13.4" +hamcrest = "1.3" +mockito = "5.19.0" +mockitoJunitJupiter = "5.2.0" +androidxTest = "1.7.0" +androidxTestJunit = "1.3.0" +androidxTestRunner = "1.7.0" +espresso = "3.7.0" + +[libraries] +# Build tools +android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } + +# Android libraries +android-material = { group = "com.google.android.material", name = "material", version.ref = "material" } + +# SSH and crypto libraries +sshd-core = { group = "org.apache.sshd", name = "sshd-core", version.ref = "sshd" } +sshd-sftp = { group = "org.apache.sshd", name = "sshd-sftp", version.ref = "sshd" } +sshd-contrib = { group = "org.apache.sshd", name = "sshd-contrib", version.ref = "sshd" } +slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } +slf4j-log4j12 = { group = "org.slf4j", name = "slf4j-log4j12", version.ref = "slf4j" } +bouncycastle-bcpkix = { group = "org.bouncycastle", name = "bcpkix-jdk15to18", version.ref = "bouncycastle" } +eddsa = { group = "net.i2p.crypto", name = "eddsa", version.ref = "eddsa" } + +# Testing libraries +junit-jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" } +junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } +junit-jupiter-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" } +junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version.ref = "junitPlatform" } +hamcrest-all = { group = "org.hamcrest", name = "hamcrest-all", version.ref = "hamcrest" } +mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } +mockito-junit-jupiter = { group = "org.mockito", name = "mockito-junit-jupiter", version.ref = "mockitoJunitJupiter" } + +# Android testing libraries +androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidxTest" } +androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxTestJunit" } +androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTestRunner" } +androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" } + +[bundles] +# Bundle related dependencies together +sshd = ["sshd-core", "sshd-sftp", "sshd-contrib"] +slf4j = ["slf4j-api", "slf4j-log4j12"] +crypto = ["bouncycastle-bcpkix", "eddsa"] +junit-testing = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest-all", "mockito-core", "mockito-junit-jupiter"] +junit-runtime = ["junit-jupiter-engine", "junit-platform-launcher"] +androidx-testing = ["androidx-test-core", "androidx-test-junit", "androidx-test-runner", "androidx-test-espresso-core"] + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } diff --git a/settings.gradle b/settings.gradle index 0db858e..9cac775 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,18 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + include ':app' -rootProject.name = "SshDaemon" \ No newline at end of file +rootProject.name = "SshDaemon" From f14914537b2704d7c8c92cc2e56f9bc1ce9b3107 Mon Sep 17 00:00:00 2001 From: d050150 Date: Thu, 20 Nov 2025 15:55:10 +0100 Subject: [PATCH 3/4] add new baseline --- app/lint-baseline.xml | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index 28c01c0..dba31dd 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,5 +1,5 @@ - + + errorLine1="junit = "5.13.4"" + errorLine2=" ~~~~~~~~"> + file="../gradle/libs.versions.toml" + line="24" + column="9"/> + errorLine1="junit = "5.13.4"" + errorLine2=" ~~~~~~~~"> + file="../gradle/libs.versions.toml" + line="24" + column="9"/> + errorLine1="junit = "5.13.4"" + errorLine2=" ~~~~~~~~"> + file="../gradle/libs.versions.toml" + line="24" + column="9"/> + errorLine1="junitPlatform = "1.13.4"" + errorLine2=" ~~~~~~~~"> + file="../gradle/libs.versions.toml" + line="25" + column="17"/> + errorLine1="mockito = "5.19.0"" + errorLine2=" ~~~~~~~~"> + file="../gradle/libs.versions.toml" + line="27" + column="11"/> + errorLine1="mockitoJunitJupiter = "5.2.0"" + errorLine2=" ~~~~~~~"> + file="../gradle/libs.versions.toml" + line="28" + column="23"/> Date: Fri, 21 Nov 2025 09:44:42 +0100 Subject: [PATCH 4/4] remove unused entries --- app/lint-baseline.xml | 228 ++++++++------------------------------ gradle/libs.versions.toml | 10 +- 2 files changed, 53 insertions(+), 185 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index dba31dd..d883da3 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,275 +1,145 @@ - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - + file="../../../.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcpkix-jdk15to18/1.82/a9ad1989d4b0bed7d8123ac2dc5baa1e5ef7eb1b/bcpkix-jdk15to18-1.82.jar" /> - - + - - + - - + - - + - - + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dbf843f..c76b16c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,19 +21,17 @@ eddsa = "0.3.0" material = "1.13.0" # Testing libraries -junit = "5.13.4" -junitPlatform = "1.13.4" +junit = "6.0.1" +junitPlatform = "6.0.1" hamcrest = "1.3" -mockito = "5.19.0" -mockitoJunitJupiter = "5.2.0" +mockito = "5.20.0" +mockitoJunitJupiter = "5.20.0" androidxTest = "1.7.0" androidxTestJunit = "1.3.0" androidxTestRunner = "1.7.0" espresso = "3.7.0" [libraries] -# Build tools -android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } # Android libraries android-material = { group = "com.google.android.material", name = "material", version.ref = "material" }