Skip to content

Commit

Permalink
libssh2 demo in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
danbrough committed Aug 7, 2023
1 parent afa71a3 commit 97db50a
Show file tree
Hide file tree
Showing 12 changed files with 643 additions and 525 deletions.
3 changes: 1 addition & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ plugins {
}



version = "0.0.1-beta01"
version = "0.0.1-beta02"

kotlin {

Expand Down
2 changes: 1 addition & 1 deletion demos/libssh2/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./tmp
tmp/
20 changes: 10 additions & 10 deletions demos/libssh2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ plugins {
alias(libs.plugins.kotlinXtras)
}

repositories {

repositories{
maven("/usr/local/kotlinxtras/build/xtras/maven")
maven("https://s01.oss.sonatype.org/content/groups/staging")
mavenCentral()
Expand All @@ -35,21 +36,20 @@ enableLibSSH2(openSSL) {
kotlin {

linuxX64()
@Suppress("DEPRECATION")
linuxArm32Hfp()
linuxArm64()

if (HostManager.hostIsMac) {
macosX64()
macosArm64()
}

androidNativeX86()
//androidNativeX86()

val commonMain by sourceSets.getting {
dependencies {
implementation(libs.klog)
implementation(libs.org.danbrough.kotlinxtras.common)
implementation(libs.io.ktor.ktorutils)
}
}

Expand All @@ -64,20 +64,20 @@ kotlin {
}

binaries {
executable("curlDemo") {
entryPoint = "demo1.main"
runTask?.environment("CA_CERT_FILE", file("cacert.pem"))
executable("ssh2Demo") {
entryPoint = "demo.ssh2.main"
findProperty("args")?.also {
runTask?.args(it.toString())
runTask?.args(it.toString().split(','))
}
}

executable("sshDemo") {
entryPoint = "demo2.main"
executable("hexDemo") {
entryPoint = "demo.hex.main"
findProperty("args")?.also {
runTask?.args(it.toString())
}
}

}
}
}
Expand Down
86 changes: 2 additions & 84 deletions demos/libssh2/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,102 +2,20 @@

[plugins]

org-jetbrains-kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version = "kotlin" }
## ⬆ = "1.2.70" }
## ⬆ = "1.2.71" }
## ⬆ = "1.3.0-rc-190" }
## ⬆ = "1.3.0-rc-198" }
## ⬆ = "1.3.0" }
## ⬆ = "1.3.10" }
## ⬆ = "1.3.11" }
## ⬆ = "1.3.20" }
## ⬆ = "1.3.21" }
## ⬆ = "1.3.30" }
## ⬆ = "1.3.31" }
## ⬆ = "1.3.40" }
## ⬆ = "1.3.41" }
## ⬆ = "1.3.50" }
## ⬆ = "1.3.60" }
## ⬆ = "1.3.61" }
## ⬆ = "1.3.70" }
## ⬆ = "1.3.71" }
## ⬆ = "1.3.72" }
## ⬆ = "1.4.0-rc" }
## ⬆ = "1.4.0" }
## ⬆ = "1.4.10" }
## ⬆ = "1.4.20-M1" }
## ⬆ = "1.4.20-M2" }
## ⬆ = "1.4.20-RC" }
## ⬆ = "1.4.20" }
## ⬆ = "1.4.21" }
## ⬆ = "1.4.21-2" }
## ⬆ = "1.4.30-M1" }
## ⬆ = "1.4.30-RC" }
## ⬆ = "1.4.30" }
## ⬆ = "1.4.31" }
## ⬆ = "1.4.32" }
## ⬆ = "1.5.0-M1" }
## ⬆ = "1.5.0-M2" }
## ⬆ = "1.5.0-RC" }
## ⬆ = "1.5.0" }
## ⬆ = "1.5.10" }
## ⬆ = "1.5.20-M1" }
## ⬆ = "1.5.20-RC" }
## ⬆ = "1.5.20" }
## ⬆ = "1.5.21" }
## ⬆ = "1.5.30-M1" }
## ⬆ = "1.5.30-RC" }
## ⬆ = "1.5.30" }
## ⬆ = "1.5.31" }
## ⬆ = "1.5.32" }
## ⬆ = "1.6.0-M1" }
## ⬆ = "1.6.0-RC" }
## ⬆ = "1.6.0-RC2" }
## ⬆ = "1.6.0" }
## ⬆ = "1.6.10-RC" }
## ⬆ = "1.6.10" }
## ⬆ = "1.6.20-M1" }
## ⬆ = "1.6.20-RC" }
## ⬆ = "1.6.20-RC2" }
## ⬆ = "1.6.20" }
## ⬆ = "1.6.21" }
## ⬆ = "1.7.0-Beta" }
## ⬆ = "1.7.0-RC" }
## ⬆ = "1.7.0-RC2" }
## ⬆ = "1.7.0" }
## ⬆ = "1.7.10" }
## ⬆ = "1.7.20-Beta" }
## ⬆ = "1.7.20-RC" }
## ⬆ = "1.7.20" }
## ⬆ = "1.7.21" }
## ⬆ = "1.7.22" }
## ⬆ = "1.8.0-Beta" }
## ⬆ = "1.8.0-RC" }
## ⬆ = "1.8.0-RC2" }
## ⬆ = "1.8.0" }
## ⬆ = "1.8.10" }
## ⬆ = "1.8.20-Beta" }
## ⬆ = "1.8.20-RC" }
## ⬆ = "1.8.20-RC2" }
## ⬆ = "1.8.20" }
## ⬆ = "1.8.21" }
## ⬆ = "1.8.22" }
## ⬆ = "1.9.0-Beta" }
## ⬆ = "1.9.0-RC" }
## ⬆ = "1.9.0" }

kotlinXtras = { id = "org.danbrough.kotlinxtras.core", version.ref = "kotlinXtras" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

[versions]

kotlin = "1.9.0"
kotlinXtras = "0.0.3-beta17"
ktor ="2.3.3"

[libraries]

klog = "org.danbrough:klog:0.0.2-beta03"

org-danbrough-kotlinxtras-common = "org.danbrough.kotlinxtras:common:0.0.1-beta01"
io-ktor-ktorutils = {group = "io.ktor",name = "ktor-utils",version.ref = "ktor"}

kotlin-scripting-compiler-embeddable = { group = "org.jetbrains.kotlin", name = "kotlin-scripting-compiler-embeddable", version.ref = "kotlin" }
5 changes: 5 additions & 0 deletions demos/libssh2/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@file:Suppress("UnstableApiUsage")

pluginManagement {

repositories {
maven("/usr/local/kotlinxtras/build/xtras/maven")


maven("https://s01.oss.sonatype.org/content/groups/staging")
mavenCentral()

Expand All @@ -13,6 +17,7 @@ pluginManagement {

}


plugins {
id("de.fayard.refreshVersions") version "0.51.0"
}
Expand Down
29 changes: 29 additions & 0 deletions demos/libssh2/src/linuxX64Main/kotlin/demo/hex/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package demo.hex

import demo.log
import io.ktor.util.decodeBase64String
import io.ktor.util.encodeBase64
import io.ktor.util.hex


fun main(args: Array<String>) {
log.info("hexDemo..")
hex(byteArrayOf(0, 1, 2, 3, 4, 5, 6, 7, 255.toByte())).also { hexString ->
log.debug("HEX: $hexString")
hex(hexString).also { bytes ->
log.debug("bytes: ${bytes.joinToString { it.toUByte().toString() }}")
}
}


val msg = "cabbaqes and kings!"

msg.encodeBase64().also {b64->
log.debug("$msg = $b64")
b64.decodeBase64String().also {
log.debug("decoded: $it")
}

}

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package demo2
package demo

import klog.KLogWriters
import klog.KMessageFormatters
import klog.Level
import klog.colored

private val log = klog.klog("demo2") {
val log = klog.klog("demo") {
writer = KLogWriters.stdOut
messageFormatter = KMessageFormatters.verbose.colored
level = Level.TRACE
}

fun main(args: Array<String>) {
log.info("demo2()")

}
Loading

0 comments on commit 97db50a

Please sign in to comment.