Skip to content

Commit 8800d9c

Browse files
authored
Hopefully fix the README instructions for compileOnly configurations (#36)
* Hopefully fix the README instructions for `compileOnly` configurations See #35 * Update README.md
1 parent fdf0e11 commit 8800d9c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ compileOnlyDependencies.extendsFrom(configurations.getByName("compileOnly"))
9999

100100
dependencies {
101101
add(shadowedDependencies.name, "com.squareup.okhttp3:okhttp:4.9.0")
102-
add(compileOnlyDependencies.name, gradleApi())
102+
add("compileOnly", gradleApi())
103103
// More dependencies here
104104
}
105105

@@ -109,6 +109,9 @@ if (shadow) {
109109
val shadowedJar = create("default") {
110110
addProgramJarsFrom(shadowedDependencies)
111111
addProgramJarsFrom(tasks.getByName("jar"))
112+
// classpath jars are only used by R8 for analysis but are not included in the
113+
// final shadowed jar.
114+
addClassPathJarsFrom(compileOnlyDependencies)
112115

113116
proguardFile("rules.pro")
114117
registerFilterTransform(listOf(".*/impldep/META-INF/versions/.*"))
@@ -125,12 +128,11 @@ if (shadow) {
125128

126129
// Allow to compile the module without exposing the shadowedDependencies downstream
127130
configurations.getByName("compileOnly").extendsFrom(shadowedDependencies)
128-
configurations.getByName("compileOnly").extendsFrom(compileOnlyDependencies)
129131
configurations.getByName("testImplementation").extendsFrom(shadowedDependencies)
130132
}
131133
}
132134
} else {
133-
configurations.named("implementation").extendsFrom(shadowedDependencies)
135+
configurations.getByName("implementation").extendsFrom(shadowedDependencies)
134136
}
135137
```
136138

0 commit comments

Comments
 (0)