Remove unused SSHD dependency

This commit is contained in:
Abdelilah El Aissaoui 2023-06-03 02:02:00 +02:00
parent 819c2f1c95
commit 9a7cc6a988
No known key found for this signature in database
GPG key ID: 7587FC860F594869
5 changed files with 1 additions and 73 deletions

View file

@ -40,7 +40,6 @@ dependencies {
implementation(compose("org.jetbrains.compose.components:components-animatedimage"))
implementation("org.eclipse.jgit:org.eclipse.jgit:$jgit")
implementation("org.eclipse.jgit:org.eclipse.jgit.gpg.bc:$jgit")
implementation("org.apache.sshd:sshd-core:2.9.0")
implementation("com.google.dagger:dagger:2.45")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
kapt("com.google.dagger:dagger-compiler:2.45")

View file

@ -2,7 +2,6 @@ package com.jetpackduba.gitnuro
object AppConstants {
val openSourceProjects = listOf(
Project("Apache SSHD", "https://mina.apache.org/sshd-project/", apache__2_0),
Project("Google Dagger", "https://dagger.dev/", apache__2_0),
Project("Compose Multiplatform", "https://www.jetbrains.com/lp/compose-mpp/", apache__2_0),
Project("JGit", "https://www.eclipse.org/jgit/", edl),

View file

@ -1,66 +0,0 @@
package com.jetpackduba.gitnuro.credentials
import org.apache.sshd.client.channel.ChannelExec
import org.apache.sshd.client.session.ClientSession
import java.io.InputStream
import java.io.OutputStream
import java.io.PipedInputStream
import java.io.PipedOutputStream
import javax.inject.Inject
class GProcess @Inject constructor() : Process() {
private lateinit var channel: ChannelExec
private val outputStream = PipedOutputStream()
private val inputStream = PipedInputStream()
private val errorOutputStream = PipedOutputStream()
private val pipedInputStream = PipedInputStream(outputStream)
private val pipedOutputStream = PipedOutputStream(inputStream)
private val pipedErrorInputStream = PipedInputStream(errorOutputStream)
override fun getOutputStream(): OutputStream {
return pipedOutputStream
}
override fun getInputStream(): InputStream {
return pipedInputStream
}
override fun getErrorStream(): InputStream {
return pipedErrorInputStream
}
override fun waitFor(): Int {
if (isRunning())
Thread.sleep(100)
return exitValue()
}
override fun exitValue(): Int {
check(!isRunning())
return channel.exitStatus
}
override fun destroy() {
if (channel.isOpen) {
channel.close()
}
}
private fun isRunning(): Boolean {
return channel.exitStatus < 0 && channel.isOpen
}
fun setup(session: ClientSession, commandName: String) {
val channel = session.createExecChannel(commandName)
channel.out = outputStream
channel.err = errorOutputStream
channel.`in` = inputStream
channel.open().verify()
this.channel = channel
}
}

View file

@ -50,7 +50,6 @@ class GProcessLibSsh : Process() {
channel.close()
}
session.disconnect()
println("Destroy called")
}

View file

@ -3,7 +3,6 @@ package com.jetpackduba.gitnuro.credentials
import com.jetpackduba.gitnuro.ssh.libssh.LibSshOptions
import com.jetpackduba.gitnuro.ssh.libssh.LibSshSession
import kotlinx.coroutines.CancellationException
import org.apache.sshd.client.SshClient
import org.eclipse.jgit.transport.RemoteSession
import org.eclipse.jgit.transport.URIish
import javax.inject.Inject
@ -16,7 +15,6 @@ class GRemoteSession @Inject constructor(
private val processSession: Provider<LibSshSession>,
private val credentialsStateManager: CredentialsStateManager,
) : RemoteSession {
private val client = SshClient.setUpDefaultClient()
private var session: LibSshSession? = null
override fun exec(commandName: String, timeout: Int): Process {
@ -29,9 +27,8 @@ class GRemoteSession @Inject constructor(
return process
}
override fun disconnect() {
client.close()
session?.disconnect()
}
fun setup(uri: URIish) {