Remove unused SSHD dependency
This commit is contained in:
parent
819c2f1c95
commit
9a7cc6a988
@ -40,7 +40,6 @@ dependencies {
|
|||||||
implementation(compose("org.jetbrains.compose.components:components-animatedimage"))
|
implementation(compose("org.jetbrains.compose.components:components-animatedimage"))
|
||||||
implementation("org.eclipse.jgit:org.eclipse.jgit:$jgit")
|
implementation("org.eclipse.jgit:org.eclipse.jgit:$jgit")
|
||||||
implementation("org.eclipse.jgit:org.eclipse.jgit.gpg.bc:$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("com.google.dagger:dagger:2.45")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
|
||||||
kapt("com.google.dagger:dagger-compiler:2.45")
|
kapt("com.google.dagger:dagger-compiler:2.45")
|
||||||
|
@ -2,7 +2,6 @@ package com.jetpackduba.gitnuro
|
|||||||
|
|
||||||
object AppConstants {
|
object AppConstants {
|
||||||
val openSourceProjects = listOf(
|
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("Google Dagger", "https://dagger.dev/", apache__2_0),
|
||||||
Project("Compose Multiplatform", "https://www.jetbrains.com/lp/compose-mpp/", apache__2_0),
|
Project("Compose Multiplatform", "https://www.jetbrains.com/lp/compose-mpp/", apache__2_0),
|
||||||
Project("JGit", "https://www.eclipse.org/jgit/", edl),
|
Project("JGit", "https://www.eclipse.org/jgit/", edl),
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -50,7 +50,6 @@ class GProcessLibSsh : Process() {
|
|||||||
channel.close()
|
channel.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
session.disconnect()
|
|
||||||
println("Destroy called")
|
println("Destroy called")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package com.jetpackduba.gitnuro.credentials
|
|||||||
import com.jetpackduba.gitnuro.ssh.libssh.LibSshOptions
|
import com.jetpackduba.gitnuro.ssh.libssh.LibSshOptions
|
||||||
import com.jetpackduba.gitnuro.ssh.libssh.LibSshSession
|
import com.jetpackduba.gitnuro.ssh.libssh.LibSshSession
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import org.apache.sshd.client.SshClient
|
|
||||||
import org.eclipse.jgit.transport.RemoteSession
|
import org.eclipse.jgit.transport.RemoteSession
|
||||||
import org.eclipse.jgit.transport.URIish
|
import org.eclipse.jgit.transport.URIish
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -16,7 +15,6 @@ class GRemoteSession @Inject constructor(
|
|||||||
private val processSession: Provider<LibSshSession>,
|
private val processSession: Provider<LibSshSession>,
|
||||||
private val credentialsStateManager: CredentialsStateManager,
|
private val credentialsStateManager: CredentialsStateManager,
|
||||||
) : RemoteSession {
|
) : RemoteSession {
|
||||||
private val client = SshClient.setUpDefaultClient()
|
|
||||||
private var session: LibSshSession? = null
|
private var session: LibSshSession? = null
|
||||||
|
|
||||||
override fun exec(commandName: String, timeout: Int): Process {
|
override fun exec(commandName: String, timeout: Int): Process {
|
||||||
@ -29,9 +27,8 @@ class GRemoteSession @Inject constructor(
|
|||||||
return process
|
return process
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun disconnect() {
|
override fun disconnect() {
|
||||||
client.close()
|
session?.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setup(uri: URIish) {
|
fun setup(uri: URIish) {
|
||||||
|
Loading…
Reference in New Issue
Block a user