Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@
/captures
.externalNativeBuild
.cxx
gradle

/gradle/.tmp/
/gradle/android/
/gradle/caches/
/gradle/daemon/
/gradle/jdks/
/gradle/native/
/gradle/workers/
/gradle/wrapper/
54 changes: 22 additions & 32 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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 52
versionName "2.1.34"
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
}
Expand Down Expand Up @@ -54,41 +56,29 @@ 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 {
options.compilerArgs << "-Xlint:deprecation"
}
}

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
}
146 changes: 139 additions & 7 deletions app/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues name="AGP (8.1.4)" by="lint 8.1.4" client="gradle" dependencies="false" format="6"
type="baseline" variant="all" version="8.1.4">
<issues format="6" by="lint 8.13.1" type="baseline" client="gradle" dependencies="true"
name="AGP (8.13.1)" variant="all" version="8.13.1">

<issue
<issue id="ScopedStorage"
message="The Google Play store has a policy that limits usage of MANAGE_EXTERNAL_STORAGE"
errorLine1=" &lt;uses-permission android:name=&quot;android.permission.MANAGE_EXTERNAL_STORAGE&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
id="ScopedStorage"
message="The Google Play store has a policy that limits usage of MANAGE_EXTERNAL_STORAGE">
<location column="36" file="src/main/AndroidManifest.xml" line="5" />
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/AndroidManifest.xml" line="5" column="36" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" write(String.format(&quot;\u001b[%d;%dH&quot;, row, col));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="118"
column="15" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" write(String.format(&quot;\u001b[%dA&quot;, lines));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="122"
column="15" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" write(String.format(&quot;\u001b[%dB&quot;, lines));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="126"
column="15" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" write(String.format(&quot;\u001b[%dC&quot;, columns));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="130"
column="15" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" write(String.format(&quot;\u001b[%dD&quot;, columns));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="134"
column="15" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" if (bytes &lt; 1024 * 1024) return String.format(&quot;%.1f KB&quot;, bytes / 1024.0);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="202"
column="41" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" if (bytes &lt; 1024 * 1024 * 1024) return String.format(&quot;%.1f MB&quot;, bytes / (1024.0 * 1024.0));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="203"
column="48" />
</issue>

<issue id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" return String.format(&quot;%.1f GB&quot;, bytes / (1024.0 * 1024.0 * 1024.0));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/TerminalEmulator.java" line="204"
column="16" />
</issue>

<issue id="SdCardPath"
message="Do not hardcode &quot;/sdcard/&quot;; use `Environment.getExternalStorageDirectory().getPath()` instead"
errorLine1=" processEnv.put(&quot;EXTERNAL_STORAGE&quot;, &quot;/sdcard&quot;);"
errorLine2=" ~~~~~~~~~">
<location file="src/main/java/com/sshdaemon/sshd/AbstractNativeCommand.java" line="106"
column="44" />
</issue>

<issue id="UnusedAttribute"
message="Attribute `shell` is only used in API level 29 and higher (current min is 26)"
errorLine1=" android:shell=&quot;true&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/AndroidManifest.xml" line="20" column="13" />
</issue>

<issue id="AndroidGradlePluginVersion"
message="A newer version of Gradle than 8.14 is available: 8.14.3"
errorLine1="distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="../gradle/wrapper/gradle-wrapper.properties" line="2" column="17" />
</issue>

<issue id="MissingTranslation"
message="&quot;server_status&quot; is not translated in &quot;ru&quot; (Russian), &quot;pt&quot; (Portuguese), &quot;uk&quot; (Ukrainian)"
errorLine1=" &lt;string name=&quot;server_status&quot;>Server Status&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/res/values/strings.xml" line="32" column="13" />
</issue>

<issue id="TrustAllX509TrustManager"
message="`checkServerTrusted` is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers">
<location
file="../../../.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcpkix-jdk15to18/1.82/a9ad1989d4b0bed7d8123ac2dc5baa1e5ef7eb1b/bcpkix-jdk15to18-1.82.jar" />
</issue>

<issue id="Overdraw"
message="Possible overdraw: Root element paints background `@color/colorPrimary` with a theme that also paints a background (inferred theme is `@style/Theme.SshDaemon`)"
errorLine1=" android:background=&quot;@color/colorPrimary&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/res/layout/main_activity.xml" line="9" column="5" />
</issue>

<issue id="UnusedResources"
message="The resource `R.style.Widget_CardContent` appears to be unused"
errorLine1=" &lt;style name=&quot;Widget.CardContent&quot; parent=&quot;android:Widget&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/res/values/styles.xml" line="9" column="12" />
</issue>

<issue id="UnusedResources"
message="The resource `R.style.SpinnerDropdownItem` appears to be unused"
errorLine1=" &lt;style name=&quot;SpinnerDropdownItem&quot; parent=&quot;android:Widget.TextView.SpinnerItem&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/res/values/styles.xml" line="20" column="12" />
</issue>

<issue id="UnusedResources" message="The resource `R.style.Theme_App` appears to be unused"
errorLine1=" &lt;style name=&quot;Theme.App&quot; parent=&quot;Theme.MaterialComponents.DayNight.DarkActionBar&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~">
<location file="src/main/res/values/themes.xml" line="5" column="12" />
</issue>

<issue id="UnusedResources"
message="The resource `R.style.Widget_CardView` appears to be unused"
errorLine1=" &lt;style name=&quot;Widget.CardView&quot; parent=&quot;Widget.MaterialComponents.CardView&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location file="src/main/res/values/themes.xml" line="25" column="12" />
</issue>

</issues>
18 changes: 0 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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.0'
}
}

allprojects {
repositories {
mavenCentral()
google()
}
}

tasks.register('clean', Delete) {
delete rootProject.layout.buildDirectory
}
73 changes: 73 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[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 = "6.0.1"
junitPlatform = "6.0.1"
hamcrest = "1.3"
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]

# 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" }
18 changes: 17 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -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"
rootProject.name = "SshDaemon"
Loading