Skip to content

Commit bb3eeb2

Browse files
committed
chore: Tweak shadowJar/archive configurations
1 parent c60b3c3 commit bb3eeb2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

gradle/java_no_deps.gradle

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,19 +299,25 @@ tasks.withType(JavaExec).configureEach {
299299
}
300300
}
301301

302-
if (project.plugins.hasPlugin('com.gradleup.shadow')) {
302+
// Helps for reproducible builds
303+
tasks.withType(AbstractArchiveTask).configureEach {
304+
preserveFileTimestamps = false
305+
reproducibleFileOrder = true
306+
}
307+
308+
project.pluginManager.withPlugin('com.gradleup.shadow') {
303309
// Remove the no-deps jar from the archives to prevent publication
304-
configurations.archives.with {
305-
artifacts.remove artifacts.find {
310+
configurations.named('archives') { Configuration c ->
311+
c.artifacts.remove(c.artifacts.find {
306312
if (it.hasProperty("delegate")) {
307313
it.delegate.archiveTask.is jar
308314
} else {
309315
it.archiveTask.is jar
310316
}
311317
}
312-
}
313-
artifacts {
314-
archives(shadowJar)
318+
)
319+
320+
c.artifacts.add(tasks.named("shadowJar"))
315321
}
316322
}
317323

0 commit comments

Comments
 (0)