-
Notifications
You must be signed in to change notification settings - Fork 208
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
JDeps outputs for kt_jvm_library
targets include absolute paths
#941
Comments
I'm not super familiar with how listed jdeps are expected to be formatted but Bazel core also has absolute paths listed.
|
Those look like relative paths to me? I think the PR description was edited/redacted, which might be confusing now. But the original paths look something like:
Note that this seems to only happen for the kotlin stdlib jar. |
The crux of the problem is that all of the preloaded jar (e.g. stdlib, etc.) return an absolute path. I've been able to reproduce this locally. This is related to the runfile resolution as part of the worker. I've rearranged the runfile resolution (in part for the KSP work), but it still is unclear what the root path should be. My current effort is trying to relativize the paths to the runfiles... without hardcoding |
Looks like this might be fixed with Kotlin 1.8.20? I was looking into this and noticed that currently on master, if you build a After some bisection, I found that it seems fixed with this commit 3f578c2 Prior to this, I get different outputs if I use different
From commit 3f578c2 onwards, I see relative paths in the jdeps file and consistent outputs regardless of the output base.
I'm not sure which commit between 1.8.10 and 1.8.20 fixed this though (the changelog is pretty huge), but seems like this would solve the remote caching problem for these outputs. |
Able to confirm that 1.8.20+ fixes the issue. For a different reason we are still on 1.8.10 and managed to workaround this issue by relativizing the path.
For this, the absolute path can be inferred from Bazel injected env variable private fun relativize(jarPath: String): String {
val pwd = System.getenv("PWD")
return if (jarPath.startsWith(pwd)) {
jarPath.replace(pwd, "")
} else jarPath
} |
@arunkumar9t2 this seems worth upstreaming to future proof jdeps from regressions like these in the future. |
Sure will work on it 👍🏼 |
Issue Summary
Outputs for
.jdeps
files fromkt_jvm_library
targets include the absolute path tokotlin-stdlib.jar
. This means that cache entries which include these outputs are not shared with other users. The path in my case looks like:.../external/com_github_jetbrains_kotlin/lib/kotlin-stdlib.jar
Steps to Reproduce
Simply build any kotlin library target then
cat
the jdeps output file created:bazel build //path/to/kotlin/library/target:target_lib
cat dist/bin/path/to/kotlin/library/target/target_lib.jdeps
The text was updated successfully, but these errors were encountered: