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

Kotlin rules don't work with bazel --nolegacy_external_runfiles #924

Open
srabraham opened this issue Jan 25, 2023 · 2 comments
Open

Kotlin rules don't work with bazel --nolegacy_external_runfiles #924

srabraham opened this issue Jan 25, 2023 · 2 comments
Labels

Comments

@srabraham
Copy link

There are performance benefits to using --nolegacy_external_runfiles (code here) as a Bazel build option, with some additional context here. As @alexeagle tells me, it allows for an optimization in runfiles layout.

As things are, this setting appears to be incompatible with rules_kotlin. When I try to build a kt_jvm_library with bazel build --nolegacy_external_runfiles, I get an error like the following:

Click to expand logs
$ bazel run --nolegacy_external_runfiles src/main/kotlin/experimental/users/sabraham:thing
INFO: Analyzed target //src/main/kotlin/experimental/users/sabraham:thing (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/sean/dev/central-ult/src/main/kotlin/experimental/users/sabraham/BUILD.bazel:15:14: KotlinCompile @//src/main/kotlin/experimental/users/sabraham:thing { kt: 1, java: 0, srcjars: 0 } for darwin_arm64 failed: Worker process did not return a WorkResponse:

---8<---8<--- Start of log, file at /private/var/tmp/_bazel_sean/3e0bb96a7b651dc41ed28d370dc8ba44/bazel-workers/worker-4-KotlinCompile.log ---8<---8<---
Exception in thread "main" java.lang.ExceptionInInitializerError
	at io.bazel.kotlin.builder.cmd.Build$main$1.invoke(Build.kt:33)
	at io.bazel.kotlin.builder.cmd.Build$main$1.invoke(Build.kt:29)
	at io.bazel.worker.Worker$Companion.from(Worker.kt:31)
	at io.bazel.kotlin.builder.cmd.Build.main(Build.kt:29)
Caused by: java.lang.IllegalStateException: file did not exist: /private/var/tmp/_bazel_sean/3e0bb96a7b651dc41ed28d370dc8ba44/execroot/videoamp/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_kotlin/src/main/kotlin/build.runfiles/../com_github_jetbrains_kotlin/lib/jvm-abi-gen.jar
	at io.bazel.kotlin.builder.utils.IOUtils.verified(IOUtils.kt:86)
	at io.bazel.kotlin.builder.utils.IOUtils.resolveVerified(IOUtils.kt:80)
	at io.bazel.kotlin.builder.utils.BazelRunFiles.resolveVerified(BazelRunFiles.kt:94)
	at io.bazel.kotlin.builder.toolchain.KotlinToolchain.<clinit>(KotlinToolchain.kt:57)
	... 4 more
---8<---8<--- End of log ---8<---8<---

Alex pointed me to a related fix he made in rules_jvm_external, which made those rules compatible with --nolegacy_external_runfiles. rules_kotlin would ideally work with that option too.

@srabraham
Copy link
Author

Alex DMed the following to me: "Yeah it's going to be a tiny change like s#external/#../# but the hard part is where that line is 🙂"

@drmercer-lucid
Copy link

I believe this was just fixed - see #1242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants