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 strict associate deps #1260

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Bencodes
Copy link
Collaborator

@Bencodes Bencodes commented Jan 12, 2025

Enables support for strict Kotlin associate dependencies.

When --@rules_kotlin//kotlin/settings:experimental_strict_associate_dependencies=True is enabled, rules_kotlin will collect ONLY the direct java_output.compile_jar for each given associate dependency, ensuring that only the Kotlin internals for the targets explicitly listed out as associates will be exposed.

This behavior differs from what's currently in rules_kotlin where it collects the entire transitive compile jars classpath for each associate dependency, which technically leaks the Kotlin internals of the entire classpath for each associate dependency.

#1021

@restingbull
Copy link
Collaborator

We should add a readme section for this.

@@ -39,7 +56,7 @@ def _get_associates(ctx, associates):
jars = []
module_names = []
for a in associates:
jars.append(depset(transitive = [a[JavaInfo].compile_jars, a[_KtJvmInfo].module_jars]))
jars.append(_collect_associates(ctx = ctx, toolchains = toolchains, associate = a))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear if the a[_KtJvmInfo].module_jars still needs to be included here. We don't hit this case in our codebase and I don't have enough historical context around why we need this here.

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

Successfully merging this pull request may close these issues.

2 participants