Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin authored Nov 21, 2024
1 parent 6daca0f commit 599ece9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,12 @@ Gradle uses [multiple classloaders](https://dev.to/autonomousapps/build-compile-

Especially, `buildSrc`/`build-logic` dependencies [leak in the main classpath](https://github.com/gradle/gradle/issues/4741) and override any dependencies from other plugin without conflict resolution. There are multiple workarounds such as declaring all plugins in `buildSrc` or in the top level `build.gradle[.kts]` file but the situation is confusing to Gradle newcomers and hard to debug.

To guard against those issues, Gratatouille provides a "classloader isolation" mode where your task actions use a separate classloader.
To guard against those issues, Gratatouille provides a classloader isolation mode where your task actions use a separate classloader.

This means your plugin can depend on popular dependencies such as the Kotlin stdlib, KotlinPoet or ASM without risking conflicts with other plugins or the Gradle classpath itself.

Furthermore, this classloader is managed by Gratatouille, working around metaspace leaks such as [gradle/18313](https://github.com/gradle/gradle/issues/18313).

For classloader isolation to work, your plugin needs 2 modules:
* The **implementation** module is where the task actions are defined and the work is done. This module can add dependencies.
* The **api** module contains the glue code and Gradle API that calls the **implementation** module through reflection. This module must not add dependencies.
Expand Down

0 comments on commit 599ece9

Please sign in to comment.