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

Library has Kotlin runtime bundled into it #1440

Closed
Simon3 opened this issue Jan 25, 2023 · 8 comments
Closed

Library has Kotlin runtime bundled into it #1440

Simon3 opened this issue Jan 25, 2023 · 8 comments
Assignees

Comments

@Simon3
Copy link

Simon3 commented Jan 25, 2023

Getting this warning(->error) since I bumped to their latest version, some Google libs using auto-value-1.10.1, e.g. com.google.cloud:google-cloud-build (not the only one impacted).

> Task :compileKotlin
w: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath
e: warnings found and -Werror specified
w: /root/.gradle/caches/modules-2/files-2.1/com.google.auto.value/auto-value/1.10.1/e0184c26c3a20257c6fb46eaea16fdd3d7b6d357/auto-value-1.10.1.jar: Library has Kotlin runtime bundled into it

Bumping Kotlin to its latest version fixes the issue.

@eamonnmcmanus eamonnmcmanus self-assigned this Jan 25, 2023
@eamonnmcmanus
Copy link
Member

I think we could probably make this a <scope>provided</scope> dependency, so it's used when building AutoValue but not included in the bundled dependencies.

@tbroyer
Copy link
Contributor

tbroyer commented Jan 26, 2023

Isn't auto-value supposed to only be on the processor classpath, and auto-value-annotations on the compile classpath?

(that said, the Kotlin runtime probably should be a normal dependency rather than shaded? or maybe it's just an issue with shading where it leaves some Kotlin-specific metadata files that should be removed or somehow shaded as well?)

@eamonnmcmanus
Copy link
Member

I already felt a bit bad about bundling the Kotlin runtime. If you're using @AutoBuilder with Kotlin data classes then you presumably already have it, and if you're not using Kotlin at all then it's slightly weird for it to be there. I think with a small bit of reflection we can make things work when it is provided.

@katre
Copy link
Contributor

katre commented May 20, 2024

Are there still any plans to address this? I recently (bazelbuild/bazel@7025bb8) updated Bazel to use autovalue 1.10.4, and was surprised that we now have a copy of the kotlin stdlib in our dependency tree.

katre referenced this issue in bazelbuild/bazel May 20, 2024
Work towards starlark options parser cleanup: #22365.

PiperOrigin-RevId: 633649782
Change-Id: I73180180142b5b23e91f1ee8c845ea606cfdc85e
@eamonnmcmanus
Copy link
Member

Let me see if I can cook something up.

@katre
Copy link
Contributor

katre commented May 20, 2024

Thanks!

copybara-service bot pushed a commit that referenced this issue May 21, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can find either version.

Fixes #1440.

RELNOTES=AutoValue (including AutoBuilder) no longer bundles the Kotlin runtime. This may require adding an explicit dependency, though usually if the Kotlin runtime is needed it is because you are either compiling Kotlin or compiling Java code that depends on Kotlin code. Either way you should have a transitive dependency on the Kotlin runtime.
PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 21, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can find either version.

Fixes #1440.

RELNOTES=AutoValue (including AutoBuilder) no longer bundles the Kotlin runtime. This may require adding an explicit dependency, though usually if the Kotlin runtime is needed it is because you are either compiling Kotlin or compiling Java code that depends on Kotlin code. Either way you should have a transitive dependency on the Kotlin runtime.
PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 21, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can find either version.

Fixes #1440.

RELNOTES=AutoValue (including AutoBuilder) no longer bundles the Kotlin runtime. This may require adding an explicit dependency, though usually if the Kotlin runtime is needed it is because you are either compiling Kotlin or compiling Java code that depends on Kotlin code. Either way you should have a transitive dependency on the Kotlin runtime.
PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 21, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can find either version.

Fixes #1440.

PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 22, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can function with either version.

Fixes #1440.

PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 22, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can function with either version.

Fixes #1440.

PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 22, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can function with either version.

Fixes #1440.

PiperOrigin-RevId: 635615798
copybara-service bot pushed a commit that referenced this issue May 28, 2024
AutoBuilder clients that don't use Kotlin shouldn't have to have the Kotlin runtime on their classpath, even if it is only the annotation-processing classpath. Additionally, the metadata API was recently moved from `kotlinx.*` to `kotlin.*`, and using reflection means we can function with either version.

Fixes #1440.

PiperOrigin-RevId: 635615798
@katre
Copy link
Contributor

katre commented May 31, 2024

Thanks for addressing this! How often is auto-value released?

@eamonnmcmanus
Copy link
Member

Thanks for addressing this! How often is auto-value released?

The newly-released 1.11.0 includes this change.

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

Successfully merging a pull request may close this issue.

5 participants