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

Add toggle for ijar in java_import #14967

Closed
wants to merge 1 commit into from

Commits on Mar 5, 2022

  1. Add toggle for ijar in java_import

    Problem: java_import has been unusably broken for years for JARs with Kotlin interfaces, since ijar strips out important information. This has caused multiple dependent projects (includng official Bazel ones) to abandon java_import in favor of rolling their own versions, which themselves contain issues that are getting fixed in java_import. Fragmentation is bad, and fragmentation of bugs and fixes is worse.
    For more, see
    https://github.com/bazelbuild/rules_jvm_external/blob/master/private/rules/jvm_import.bzl
    bazelbuild#4549
    bazelbuild#14966
    bazel-contrib/rules_jvm_external#672
    
    Temporary solution: Until such time as ijar is fixed for Kotlin, this adds a toggle that enables/disables ijar on java_import. This should unblock use of java_import for libraries that might contain Kotlin, so implementations can reunify.
    
    It also restores java_import to a state where it works correctly by default. Per the user manual, ijars are a build performance optimization to allow caching of actions that use JARs whose implementations change frequenly [1]. Imported (externally compiled) JARs shouldn't be changing very often, meaning that the build performance cost of disabling ijars for these prebuilt JARs should be relatively low. Therefore, the ijar toggle is off by default, so the build is correct by default. But ijar is still made available though the toggle, just in case someone is importing a Java-interface-only JAR that they change all the time.
    
    [1] https://docs.bazel.build/versions/main/user-manual.html#flag--use_ijars
    cpsauer committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    14d9dec View commit details
    Browse the repository at this point in the history