Skip to content

Commit 6cfe6a2

Browse files
committed
Cleanups
1 parent abb3b50 commit 6cfe6a2

14 files changed

+46
-50
lines changed

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ApplicationTest : BasePluginTest() {
118118
dependencies {
119119
implementation 'shadow:a:1.0'
120120
}
121-
$runShadow {
121+
${this@Companion.runShadowBlock} {
122122
args 'foo'
123123
$runShadowBlock
124124
}

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/BasePluginTest.kt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ abstract class BasePluginTest {
204204
dependencies {
205205
implementation project(':client')
206206
}
207-
$shadowJar {
207+
$shadowJarBlock {
208208
$serverShadowBlock
209209
}
210210
""".trimIndent() + System.lineSeparator(),
@@ -277,7 +277,7 @@ abstract class BasePluginTest {
277277
dependencies {
278278
api project(':api')
279279
}
280-
$shadowJar {
280+
$shadowJarBlock {
281281
minimize()
282282
}
283283
""".trimIndent() + System.lineSeparator(),
@@ -307,19 +307,15 @@ abstract class BasePluginTest {
307307
Path(gradleUserHome, "testkit")
308308
}
309309

310-
val testJar: Path = requireNotNull(this::class.java.classLoader.getResource("junit-3.8.2.jar")).toURI().toPath()
310+
val testJar: Path =
311+
requireNotNull(this::class.java.classLoader.getResource("junit-3.8.2.jar")).toURI().toPath()
311312
val artifactJar: Path =
312313
requireNotNull(this::class.java.classLoader.getResource("test-artifact-1.0-SNAPSHOT.jar")).toURI().toPath()
313314
val projectJar: Path =
314315
requireNotNull(this::class.java.classLoader.getResource("test-project-1.0-SNAPSHOT.jar")).toURI().toPath()
315316

316-
val shadowJar: String = """
317-
tasks.named('$SHADOW_JAR_TASK_NAME', ${ShadowJar::class.java.name})
318-
""".trimIndent()
319-
320-
val runShadow = """
321-
tasks.named('$SHADOW_RUN_TASK_NAME', ${JavaJarExec::class.java.name})
322-
""".trimIndent()
317+
val shadowJarBlock: String = "tasks.named('$SHADOW_JAR_TASK_NAME', ${ShadowJar::class.java.name})"
318+
val runShadowBlock = "tasks.named('$SHADOW_RUN_TASK_NAME', ${JavaJarExec::class.java.name})"
323319

324320
val commonArguments = listOf(
325321
"--warning-mode=fail",
@@ -338,7 +334,7 @@ abstract class BasePluginTest {
338334
transformerBlock: String = "",
339335
): String {
340336
return """
341-
$shadowJar {
337+
${this.shadowJarBlock} {
342338
$shadowJarBlock
343339
transform(${T::class.java.name}) {
344340
$transformerBlock

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/FilteringTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class FilteringTest : BasePluginTest() {
4747
fun excludeFiles() {
4848
projectScriptPath.appendText(
4949
"""
50-
$shadowJar {
50+
$shadowJarBlock {
5151
exclude 'a2.properties'
5252
}
5353
""".trimIndent(),
@@ -82,7 +82,7 @@ class FilteringTest : BasePluginTest() {
8282
dependencies {
8383
implementation 'shadow:d:1.0'
8484
}
85-
$shadowJar {
85+
$shadowJarBlock {
8686
dependencies {
8787
exclude(dependency('shadow:d:.*'))
8888
}
@@ -157,7 +157,7 @@ class FilteringTest : BasePluginTest() {
157157
dependencies {
158158
implementation 'shadow:d:1.0'
159159
}
160-
$shadowJar {
160+
$shadowJarBlock {
161161
dependencies {
162162
include(dependency('shadow:d:1.0'))
163163
}
@@ -237,7 +237,7 @@ class FilteringTest : BasePluginTest() {
237237
fun verifyExcludePrecedenceOverInclude() {
238238
projectScriptPath.appendText(
239239
"""
240-
$shadowJar {
240+
$shadowJarBlock {
241241
include '*.jar'
242242
include '*.properties'
243243
exclude 'a2.properties'
@@ -274,7 +274,7 @@ class FilteringTest : BasePluginTest() {
274274
dependencies {
275275
implementation 'shadow:d:1.0'
276276
}
277-
$shadowJar {
277+
$shadowJarBlock {
278278
dependencies {
279279
exclude(dependency('shadow:d:1.0'))
280280
}

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class PublishingTest : BasePluginTest() {
247247
dependencies {
248248
$dependenciesBlock
249249
}
250-
$shadowJar {
250+
$shadowJarBlock {
251251
$shadowBlock
252252
}
253253
publishing {

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RelocationTest : BasePluginTest() {
2424
dependencies {
2525
implementation 'junit:junit:3.8.2'
2626
}
27-
$shadowJar {
27+
$shadowJarBlock {
2828
enableRelocation = true
2929
}
3030
""".trimIndent(),
@@ -64,7 +64,7 @@ class RelocationTest : BasePluginTest() {
6464
dependencies {
6565
implementation 'junit:junit:3.8.2'
6666
}
67-
$shadowJar {
67+
$shadowJarBlock {
6868
relocate 'junit.textui', 'a'
6969
relocate 'junit.framework', 'b'
7070
manifest {
@@ -123,7 +123,7 @@ class RelocationTest : BasePluginTest() {
123123
dependencies {
124124
implementation 'junit:junit:3.8.2'
125125
}
126-
$shadowJar {
126+
$shadowJarBlock {
127127
relocate('junit.textui', 'a') {
128128
exclude 'junit.textui.TestRunner'
129129
}
@@ -176,7 +176,7 @@ class RelocationTest : BasePluginTest() {
176176
dependencies {
177177
implementation 'junit:junit:3.8.2'
178178
}
179-
$shadowJar {
179+
$shadowJarBlock {
180180
relocate 'junit.framework', 'shadow.junit'
181181
}
182182
""".trimIndent(),
@@ -252,7 +252,7 @@ class RelocationTest : BasePluginTest() {
252252
dependencies {
253253
implementation project(':core')
254254
}
255-
$shadowJar {
255+
$shadowJarBlock {
256256
relocate 'core', 'app.core'
257257
relocate 'junit.framework', 'app.junit.framework'
258258
}
@@ -315,7 +315,7 @@ class RelocationTest : BasePluginTest() {
315315
dependencies {
316316
implementation 'shadow:dep:1.0'
317317
}
318-
$shadowJar {
318+
$shadowJarBlock {
319319
relocate 'foo', 'bar'
320320
}
321321
""".trimIndent(),
@@ -350,7 +350,7 @@ class RelocationTest : BasePluginTest() {
350350
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '2.5.0'
351351
implementation group: 'org.apache.zookeeper', name: 'zookeeper', version: '3.4.6'
352352
}
353-
$shadowJar {
353+
$shadowJarBlock {
354354
zip64 = true
355355
relocate 'com.google.protobuf', 'shaded.com.google.protobuf'
356356
relocate 'io.netty', 'shaded.io.netty'

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPluginTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ShadowPluginTest : BasePluginTest() {
8585
fun shadowCopy() {
8686
projectScriptPath.appendText(
8787
"""
88-
$shadowJar {
88+
$shadowJarBlock {
8989
${fromJar(artifactJar, projectJar)}
9090
}
9191
""".trimIndent(),
@@ -110,7 +110,7 @@ class ShadowPluginTest : BasePluginTest() {
110110
dependencies {
111111
implementation 'junit:junit:3.8.2'
112112
}
113-
$shadowJar {
113+
$shadowJarBlock {
114114
archiveBaseName = 'shadow'
115115
archiveClassifier = ''
116116
archiveVersion = ''
@@ -622,7 +622,7 @@ class ShadowPluginTest : BasePluginTest() {
622622
dependencies {
623623
shadow 'junit:junit:3.8.2'
624624
}
625-
$shadowJar {
625+
$shadowJarBlock {
626626
zip64 = true
627627
entryCompression = org.gradle.api.tasks.bundling.ZipEntryCompression.STORED
628628
}
@@ -686,10 +686,10 @@ class ShadowPluginTest : BasePluginTest() {
686686
output.dir(generatedResourcesDir, builtBy: generateResources)
687687
}
688688
}
689-
$shadowJar {
689+
$shadowJarBlock {
690690
zip64 = true
691691
}
692-
$runShadow {
692+
$runShadowBlock {
693693
args 'foo'
694694
}
695695
""".trimIndent(),
@@ -712,7 +712,7 @@ class ShadowPluginTest : BasePluginTest() {
712712
application {
713713
mainClass = 'myapp.Main'
714714
}
715-
$runShadow {
715+
$runShadowBlock {
716716
args 'foo'
717717
}
718718
""".trimIndent(),
@@ -816,7 +816,7 @@ class ShadowPluginTest : BasePluginTest() {
816816
dependencies {
817817
implementation 'junit:junit:3.8.2'
818818
}
819-
$shadowJar {
819+
$shadowJarBlock {
820820
configurations = [project.configurations.compileClasspath]
821821
}
822822
""".trimIndent(),
@@ -834,7 +834,7 @@ class ShadowPluginTest : BasePluginTest() {
834834
writeClientAndServerModules()
835835
path("client/build.gradle").appendText(
836836
"""
837-
$shadowJar {
837+
$shadowJarBlock {
838838
relocate 'junit.framework', 'client.junit.framework'
839839
}
840840
""".trimIndent(),

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/caching/MinimizationCachingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MinimizationCachingTest : BaseCachingTest() {
3333

3434
path("server/build.gradle").appendText(
3535
"""
36-
$shadowJar {
36+
$shadowJarBlock {
3737
minimize {
3838
exclude(dependency('junit:junit:.*'))
3939
}

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/caching/RelocationCachingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RelocationCachingTest : BaseCachingTest() {
3131

3232
projectScriptPath.appendText(
3333
"""
34-
$shadowJar {
34+
$shadowJarBlock {
3535
relocate 'junit.framework', 'foo.junit.framework'
3636
}
3737
""".trimIndent(),

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/caching/ShadowJarCachingTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ShadowJarCachingTest : BaseCachingTest() {
1818
fun shadowJarIsCachedCorrectlyWhenCopying() {
1919
projectScriptPath.appendText(
2020
"""
21-
$shadowJar {
21+
$shadowJarBlock {
2222
${fromJar(artifactJar, projectJar)}
2323
}
2424
""".trimIndent(),
@@ -38,7 +38,7 @@ class ShadowJarCachingTest : BaseCachingTest() {
3838
fun shadowJarIsCachedCorrectlyWhenOutputFileIsChanged() {
3939
projectScriptPath.appendText(
4040
"""
41-
$shadowJar {
41+
$shadowJarBlock {
4242
${fromJar(artifactJar, projectJar)}
4343
}
4444
""".trimIndent() + System.lineSeparator(),
@@ -48,7 +48,7 @@ class ShadowJarCachingTest : BaseCachingTest() {
4848

4949
projectScriptPath.appendText(
5050
"""
51-
$shadowJar {
51+
$shadowJarBlock {
5252
archiveBaseName = "foo"
5353
}
5454
""".trimIndent(),
@@ -65,7 +65,7 @@ class ShadowJarCachingTest : BaseCachingTest() {
6565
dependencies {
6666
implementation 'junit:junit:3.8.2'
6767
}
68-
$shadowJar {
68+
$shadowJarBlock {
6969
exclude 'junit/*'
7070
}
7171
""".trimIndent(),
@@ -98,7 +98,7 @@ class ShadowJarCachingTest : BaseCachingTest() {
9898
projectScriptPath.writeText(
9999
"""
100100
$replaced
101-
$shadowJar {
101+
$shadowJarBlock {
102102
include 'server/*'
103103
exclude '*/Util.*'
104104
}
@@ -149,7 +149,7 @@ class ShadowJarCachingTest : BaseCachingTest() {
149149

150150
projectScriptPath.appendText(
151151
"""
152-
$shadowJar {
152+
$shadowJarBlock {
153153
dependencies {
154154
exclude(dependency('junit:junit'))
155155
}

src/funcTest/kotlin/com/github/jengelman/gradle/plugins/shadow/caching/TransformCachingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TransformCachingTest : BaseCachingTest() {
1818
writeMainClass()
1919
projectScriptPath.appendText(
2020
"""
21-
$shadowJar {
21+
$shadowJarBlock {
2222
// Use NoOpTransformer to mock a custom transformer here.
2323
transform(${NoOpTransformer::class.java.name}.INSTANCE)
2424
}

0 commit comments

Comments
 (0)