You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `java-gradle-plugin` automatically adds `api(gradleApi())` to your dependencies, exposing `gradleApi()` in your runtime classpath by default.
75
+
## Using Gr8 for Gradle plugins
93
76
94
-
`gradleApi()` must not be embedded in your shadowed plugin as those classes are provided by the Gradle instance running your plugin.
77
+
Using Gr8 to shadow dependencies in Gradle plugin is a typical use case but requires extra care because:
95
78
96
-
What's more, contains `gradleApi()` newer symbols that might not be available in older versions of Gradle your plugin needs to support.
79
+
* The `java-gradle-plugin` automatically adds `api(gradleApi())` to your dependencies but `gradleApi()` shouldn't be shadowed.
80
+
*`gradleApi()` is a [multi-release jar](https://docs.oracle.com/javase/10/docs/specs/jar/jar.html#multi-release-jar-files) file that [R8 doesn't support](https://issuetracker.google.com/u/1/issues/380805015).
81
+
* Since the plugins are published, the shadowed dependencies must not be exposed in the .pom/.module files.
97
82
98
-
To workaround this, you can use the [Nokee relocated artifacts](https://docs.nokee.dev/manual/gradle-plugin-development-plugin.html) and `removeGradleApiFromApi()`:
83
+
To work around this, you can use, `removeGradleApiFromApi()`, `registerTransform()` and custom configurations:
99
84
100
85
```kotlin
101
-
dependencies {
102
-
compileOnly("dev.gradleplugins:gradle-api:7.6")
103
-
}
104
-
val compileOnlyDependenciesForGr8:Configuration= configurations.create("compileOnlyDependenciesForGr8") {
86
+
val shadowedDependencies = configurations.create("shadowedDependencies")
87
+
88
+
val compileOnlyDependencies:Configuration= configurations.create("compileOnlyDependencies") {
At the time of writing [R8 doesn't support multi-release jars](https://issuetracker.google.com/u/1/issues/380805015) and you might bump into this issue:
122
-
123
-
```
124
-
Caused by: com.android.tools.r8.errors.CompilationError: Class content provided for type descriptor
0 commit comments