JakeWharton / adb-event-mirror

Mirror the touch/key/button events of one device onto one or more other devices in real-time
Apache License 2.0
885 stars 43 forks source link

Open to kscript? #16

Closed amadib closed 12 months ago

amadib commented 4 years ago

Curious if you are open to using kscript instead of a pure kotlin script. The wrapper would allow us to resolve and specify our own repositories to resolve the clikt dependency.

JakeWharton commented 4 years ago

Is that actually a problem in practice?

amadib commented 4 years ago

With draconian network restrictions at work we cannot access public repos (https://repo1.maven.org) - we need to proxy through corporate maven or access local m2.

:: problems summary ::
:::: WARNINGS
        module not found: com.github.ajalt#clikt;2.8.0

    ==== central: tried

      https://repo1.maven.org/maven2/com/github/ajalt/clikt/2.8.0/clikt-2.8.0.pom

      -- artifact com.github.ajalt#clikt;2.8.0!clikt.jar:

      https://repo1.maven.org/maven2/com/github/ajalt/clikt/2.8.0/clikt-2.8.0.jar

:::: ERRORS
    Server access error at url https://repo1.maven.org/maven2/com/github/ajalt/clikt/2.8.0/clikt-2.8.0.pom (javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target)

    Server access error at url https://repo1.maven.org/maven2/com/github/ajalt/clikt/2.8.0/clikt-2.8.0.jar (javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target)

error: cannot access script base class 'org.jetbrains.kotlin.mainKts.MainKtsScript'. Check your module classpath for missing or conflicting dependencies (adb-event-mirror.main.kts:3:1)
error: unresolved reference: DependsOn (adb-event-mirror.main.kts:3:7)
error: unresolved reference: github (adb-event-mirror.main.kts:5:12)
error: unresolved reference: github (adb-event-mirror.main.kts:6:12)
error: unresolved reference: github (adb-event-mirror.main.kts:7:12)
error: unresolved reference: github (adb-event-mirror.main.kts:8:12)
error: unresolved reference: github (adb-event-mirror.main.kts:9:12)
error: unresolved reference: github (adb-event-mirror.main.kts:10:12)
error: unresolved reference: main (adb-event-mirror.main.kts:13:23)
error: unresolved reference: args (adb-event-mirror.main.kts:13:28)
error: unresolved reference: CliktCommand (adb-event-mirror.main.kts:15:32)
error: unresolved reference: option (adb-event-mirror.main.kts:16:23)
error: unresolved reference: option (adb-event-mirror.main.kts:17:29)
error: unresolved reference: argument (adb-event-mirror.main.kts:18:31)
error: unresolved reference: it (adb-event-mirror.main.kts:20:19)
error: 'run' overrides nothing (adb-event-mirror.main.kts:22:2)
adb-event-mirror.main.kts: error: unresolved dependency: com.github.ajalt#clikt;2.8.0: not found
adb-event-mirror.main.kts:3:1: error: cannot access script base class 'org.jetbrains.kotlin.mainKts.MainKtsScript'. Check your module classpath for missing or conflicting dependencies
@file:DependsOn("com.github.ajalt:clikt:2.8.0")
^
adb-event-mirror.main.kts:3:7: error: unresolved reference: DependsOn
@file:DependsOn("com.github.ajalt:clikt:2.8.0")
      ^
adb-event-mirror.main.kts:5:12: error: unresolved reference: github
import com.github.ajalt.clikt.core.CliktCommand
           ^
adb-event-mirror.main.kts:6:12: error: unresolved reference: github
import com.github.ajalt.clikt.parameters.arguments.argument
           ^
adb-event-mirror.main.kts:7:12: error: unresolved reference: github
import com.github.ajalt.clikt.parameters.arguments.multiple
           ^
adb-event-mirror.main.kts:8:12: error: unresolved reference: github
import com.github.ajalt.clikt.parameters.arguments.transformAll
           ^
adb-event-mirror.main.kts:9:12: error: unresolved reference: github
import com.github.ajalt.clikt.parameters.options.flag
           ^
adb-event-mirror.main.kts:10:12: error: unresolved reference: github
import com.github.ajalt.clikt.parameters.options.option
           ^
adb-event-mirror.main.kts:13:23: error: unresolved reference: main
AdbEventMirrorCommand.main(args)
                      ^
adb-event-mirror.main.kts:13:28: error: unresolved reference: args
AdbEventMirrorCommand.main(args)
                           ^
adb-event-mirror.main.kts:15:32: error: unresolved reference: CliktCommand
object AdbEventMirrorCommand : CliktCommand(name = "adb-event-mirror") {
                               ^
adb-event-mirror.main.kts:16:23: error: unresolved reference: option
    private val debug by option("--debug", help = "Enable debug logging").flag()
                      ^
adb-event-mirror.main.kts:17:29: error: unresolved reference: option
    private val showTouches by option("--show-touches").flag("--hide-touches", default = true)
                            ^
adb-event-mirror.main.kts:18:31: error: unresolved reference: argument
    private val mirrorSerials by argument(name = "MIRROR_SERIAL")
                              ^
adb-event-mirror.main.kts:20:19: error: unresolved reference: it
        .transformAll { it.toSet() }
                  ^
adb-event-mirror.main.kts:22:2: error: 'run' overrides nothing
    override fun run() {
jrodbx commented 4 years ago

The following snippet allows me to access my company's internal repository:

#!/usr/bin/env -S kotlinc -script --

@file:Repository("https://maven.global.square/artifactory/square-public")
JakeWharton commented 4 years ago

I could switch it to a regular binary. I don't really want to use kscript.

amadib commented 4 years ago

Solid 👍 Thanks!