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

Use symbol-processing-aa-embeddable in Gradle #2006

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

ting-yuan
Copy link
Collaborator

isolatedClassloader only isolates KSP from Gradle classpath. Bundled classes in the KSP jar can still be seen by processors and pollute their classpath. Replacing symbol-processing-aa with
symbol-processing-aa-embeddable solves both issues.

Note that classloaders are still required for:

  1. loading KSP2 when needed, so that KSP1 don't download the fat jar.
  2. processors need to be re-loaded everytime, in case of improper uses of static variables and/or memory leak.

if (kspClassLoaderCache[key] == null) {
kspClassLoaderCache[key] = URLClassLoader(
kspClasspath.files.map { it.toURI().toURL() }.toTypedArray(),
this.javaClass.classLoader
Copy link
Contributor

Choose a reason for hiding this comment

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

This means we are no longer isolating from Gradle's classpath is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it should be better to leave it isolated from Gradle's. The PR is updated.

isolatedClassloader only isolates KSP from Gradle classpath. Bundled
classes in the KSP jar can still be seen by processors and pollute their
classpath. Replacing symbol-processing-aa with
symbol-processing-aa-embeddable solves both issues.

Note that classloaders are still required for:
1. loading KSP2 when needed, so that KSP1 doesn't download the fat jar.
2. processors need to be re-loaded everytime, in case of improper uses
   of static variables and/or memory leak.
3. isolating processors from Gradle's classpath.
@ting-yuan ting-yuan merged commit 2b74d4d into google:main Jul 19, 2024
3 checks passed
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.

None yet

2 participants