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 support for experimental treatInternalAsPrivate and removePrivateClasses in abi.jar #1245

Open
rbeazleyspot opened this issue Dec 16, 2024 · 2 comments

Comments

@rbeazleyspot
Copy link
Contributor

rbeazleyspot commented Dec 16, 2024

This is in relation to https://youtrack.jetbrains.com/issue/KT-65690 and https://youtrack.jetbrains.com/issue/KT-64590

Current ABI jar generation includes not only public classes but internal and in some instances private which I belives can lead to unnecessary build invalidations.

As far as I can tell we would need to include optional configuration of the jvm-abi plugin in or around here

You might expect something along these lines in that file

plugin(plugins.jvmAbiGen) {
  flag("outputDir", directories.abiClasses)
  if(task.info.publicOnlyAbiJar) {
    flag("treatInternalAsPrivate", "true")
    flag("removePrivateClasses", "true")
   }
}

I think it would make sense to bundle both these plugin options behind one experimental flag on the rule.

Your thoughts on this?

Im currently exploring how this might look in the codebase but progress is slow (however I do have a failing test for the core part of this)

@rbeazleyspot
Copy link
Contributor Author

rbeazleyspot commented Dec 16, 2024

If I get this to work im thinking of extending the CompilationTaskInfo proto with

    bool public_only_abi_jar = 12;

and adding this attribute to kt_toolchain

        "experimental_use_public_only_abi_jars": attr.bool(
            doc = """Compile using public only abi jars.
            This applies the following two compiler plugin options.
            plugin:org.jetbrains.kotlin.jvm.abi:treatInternalAsPrivate=true
            plugin:org.jetbrains.kotlin.jvm.abi:removePrivateClasses=true
            Can be disabled for an individual target using the tag.
            `kt_abi_plugin_incompatible`""",
            default = False,
        ),

plus all the other bits, however I think these are the ones worth early discussion

@rbeazleyspot
Copy link
Contributor Author

Ive opened a draft pr for your consideration

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

No branches or pull requests

1 participant