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

[KSP2] Generated resources are not added to KotlinCompilation inputs #1714

Closed
ZacSweers opened this issue Feb 4, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working P1 major features or blocking bugs
Milestone

Comments

@ZacSweers
Copy link
Contributor

ZacSweers commented Feb 4, 2024

Between K2 Beta1 and Beta3, this appears to have regressed and generated resources are no longer added as inputs to the Kotlin compilation. Sorry realizing this is actually just specific to KSP2.

Repro: slackhq/EitherNet#72

In this project, there is a test called EitherNetControllersTest that exercises a service loader code path. This service loader is generated by auto-service-ksp, and the specific impl loaded in this class is SlackEndpointValidator.

I do see the service file generated, but I do not see it marked as a source dir or visible at runtime, resulting in the current test failure on that PR.

image
@ZacSweers ZacSweers changed the title [K2] Generated resources are not added to KotlinCompilation inputs [KSP2] Generated resources are not added to KotlinCompilation inputs Feb 4, 2024
@ting-yuan ting-yuan self-assigned this Feb 8, 2024
@ting-yuan ting-yuan added bug Something isn't working P1 major features or blocking bugs labels Feb 8, 2024
@ting-yuan ting-yuan added this to the 2.0 milestone Feb 8, 2024
@ting-yuan
Copy link
Collaborator

Turns out that this is caused by a bug in KSDeclaration.packageName which incorrectly returned an empty string for classes in libraries. In this case, the entire com.slack.eithernet.test.ApiValidator is treated as class name with an empty package name and therefore the com$slack$eithernet$test$ApiValidator in the screenshot. The package name issue is already fixed in #1724.

Verified with 2.0.0-Beta4-1.0.18-SNAPSHOT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 major features or blocking bugs
Projects
None yet
Development

No branches or pull requests

2 participants