Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Windows Kotlin installed via Scoop #445

Open
tats-u opened this issue Apr 4, 2023 · 3 comments · May be fixed by #486
Open

Support Windows Kotlin installed via Scoop #445

tats-u opened this issue Apr 4, 2023 · 3 comments · May be fixed by #486
Labels
dependency resolution Related to the project dependency/standard library resolver

Comments

@tats-u
Copy link

tats-u commented Apr 4, 2023

Kotlin installed via scoop install kotlin in Windows has a directory structure not assumed by this language server.

PS> (gcm kotlin).path
C:\Users\tatsu\scoop\shims\kotlin.cmd
PS> ls (split-path -parent (Split-Path -Parent ((gcm kotlin).path)))

    Directory: C:\Users\tatsu\scoop

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          2023/04/01    23:37                apps
d----          2019/11/10    17:44                buckets
d----          2023/04/01    23:37                cache
d----          2023/01/30    23:38                persist
d----          2023/04/01    23:37                shims
PS> ls "$(split-path -parent (Split-Path -Parent ((gcm kotlin).path)))\apps\kotlin\current\lib\"

    Directory: C:\Users\tatsu\scoop\apps\kotlin\current\lib

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-----          1980/02/01     0:00          23724 allopen-compiler-plugin.jar
-----          1980/02/01     0:00         492419 android-extensions-compiler.jar
-----          1980/02/01     0:00           9593 android-extensions-runtime.jar
-----          1980/02/01     0:00          17536 annotations-13.0.jar
-----          1980/02/01     0:00          52265 assignment-compiler-plugin.jar
-----          1980/02/01     0:00          11126 js.engines.jar
-----          1980/02/01     0:00        1177854 jvm-abi-gen.jar
-----          1980/02/01     0:00          26347 kotlin-annotation-processing-cli.jar
-----          1980/02/01     0:00           1377 kotlin-annotation-processing-runtime.jar
-----          1980/02/01     0:00         481458 kotlin-annotation-processing.jar
-----          1980/02/01     0:00           3130 kotlin-annotations-jvm-sources.jar
-----          1980/02/01     0:00           2676 kotlin-annotations-jvm.jar
-----          1980/02/01     0:00          25356 kotlin-ant.jar
-----          1980/02/01     0:00       55137299 kotlin-compiler.jar
-----          1980/02/01     0:00         675469 kotlin-daemon-client.jar
-----          1980/02/01     0:00         733096 kotlin-daemon.jar
-----          1980/02/01     0:00         274006 kotlin-imports-dumper-compiler-plugin.jar
-----          1980/02/01     0:00        6572469 kotlin-main-kts.jar
-----          1980/02/01     0:00          52271 kotlin-preloader.jar
-----          1980/02/01     0:00         713762 kotlin-reflect-sources.jar
-----          1980/02/01     0:00        3155363 kotlin-reflect.jar
-----          1980/02/01     0:00          30873 kotlin-runner.jar
-----          1980/02/01     0:00           9916 kotlin-script-runtime-sources.jar
-----          1980/02/01     0:00          42824 kotlin-script-runtime.jar
-----          1980/02/01     0:00         226059 kotlin-scripting-common.jar
-----          1980/02/01     0:00         317456 kotlin-scripting-compiler-impl.jar
-----          1980/02/01     0:00         376451 kotlin-scripting-compiler.jar
-----          1980/02/01     0:00           7602 kotlin-scripting-js.jar
-----          1980/02/01     0:00         200054 kotlin-scripting-jvm.jar
-----          1980/02/01     0:00            580 kotlin-stdlib-jdk7-sources.jar
-----          1980/02/01     0:00            959 kotlin-stdlib-jdk7.jar
-----          1980/02/01     0:00            556 kotlin-stdlib-jdk8-sources.jar
-----          1980/02/01     0:00            965 kotlin-stdlib-jdk8.jar
-----          1980/02/01     0:00         523365 kotlin-stdlib-js-sources.jar
-----          1980/02/01     0:00        4331907 kotlin-stdlib-js.jar
-----          1980/02/01     0:00         567552 kotlin-stdlib-sources.jar
-----          1980/02/01     0:00        1636556 kotlin-stdlib.jar
-----          1980/02/01     0:00           8040 kotlin-test-js-sources.jar
-----          1980/02/01     0:00         107546 kotlin-test-js.jar
-----          1980/02/01     0:00           1784 kotlin-test-junit-sources.jar
-----          1980/02/01     0:00           5146 kotlin-test-junit.jar
-----          1980/02/01     0:00           1792 kotlin-test-junit5-sources.jar
-----          1980/02/01     0:00           5121 kotlin-test-junit5.jar
-----          1980/02/01     0:00           2272 kotlin-test-sources.jar
-----          1980/02/01     0:00           1775 kotlin-test-testng-sources.jar
-----          1980/02/01     0:00           5144 kotlin-test-testng.jar
-----          1980/02/01     0:00         133094 kotlin-test.jar
-----          1980/02/01     0:00        1482528 kotlinx-coroutines-core-jvm.jar
-----          1980/02/01     0:00         918106 kotlinx-serialization-compiler-plugin.jar
-----          1980/02/01     0:00         319772 lombok-compiler-plugin.jar
-----          1980/02/01     0:00           1472 mutability-annotations-compat.jar
-----          1980/02/01     0:00          62067 noarg-compiler-plugin.jar
-----          1980/02/01     0:00         357668 parcelize-compiler.jar
-----          1980/02/01     0:00           6996 parcelize-runtime.jar
-----          1980/02/01     0:00          18513 sam-with-receiver-compiler-plugin.jar
-----          1980/02/01     0:00         572985 trove4j.jar
PS> cat (gcm kotlin).path
@rem C:\Users\tatsu\scoop\apps\kotlin\current\bin\kotlin.bat
@"C:\Users\tatsu\scoop\apps\kotlin\current\bin\kotlin.bat"  %*

private fun findKotlinCliCompilerLibrary(name: String): Path? =
findCommandOnPath("kotlinc")
?.toRealPath()
?.parent // bin
?.parent // libexec or "top-level" dir
?.let {
// either in libexec or a top-level directory (that may contain libexec, or just a lib-directory directly)
val possibleLibDir = it.resolve("lib")
if (Files.exists(possibleLibDir)) {
possibleLibDir
} else {
it.resolve("libexec").resolve("lib")
}
}
?.takeIf { Files.exists(it) }
?.let(Files::list)
?.filter { it.fileName.toString() == "$name.jar" }
?.findFirst()
?.orElse(null)

It's only Scoop that includes the latest and standalone Kotlin in package managers for Windows.

@fwcd
Copy link
Owner

fwcd commented Apr 14, 2023

Hm, I think the issue is that scoop creates shim scripts instead of symlinking directly to the compiler, which makes it hard for us to find the compiler (without hardcoding scoop-related paths).

@fwcd fwcd added the dependency resolution Related to the project dependency/standard library resolver label Apr 14, 2023
@tats-u
Copy link
Author

tats-u commented Apr 15, 2023

Right. BackupClassPathResolver.kt must be modified.

@fwcd
Copy link
Owner

fwcd commented Apr 15, 2023

I think you'd want to modify findAlternativeLibraryLocation

@tats-u tats-u linked a pull request Aug 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency resolution Related to the project dependency/standard library resolver
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants