JakeWharton/adb-event-mirror

Open to kscript?

amadib opened this issue · 5 comments

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.

Is that actually a problem in practice?

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() {

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")

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

Solid 👍
Thanks!