Skip to content

Commit

Permalink
Prefer Gradle Sync tasks over Copy tasks
Browse files Browse the repository at this point in the history
`Sync` tasks remove any files in the destination that were not actually
copied from the source.  This feels safer than `Copy`, which is happy
to retain leftover destination files.  Those leftover files might have
been copied manually or by an earlier version of the build logic, either
of which threatens reproducibility of a build.
  • Loading branch information
liblit committed Jul 6, 2024
1 parent 1f29f62 commit 7353c4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cast/js/nodejs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ val downloadNodeJS by
}

val unpackNodeJSLib by
tasks.registering(Copy::class) {
tasks.registering(Sync::class) {
from(downloadNodeJS.map { tarTree(it.dest) }) {
include("*/lib/*.js")
eachFile { path = name }
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ val unpackOcamlJava by
}

val prepareGenerateHelloHashJar by
tasks.registering(Copy::class) {
tasks.registering(Sync::class) {
from("ocaml/hello_hash.ml")
val outputDir = project.layout.buildDirectory.dir(name)
into(outputDir)
Expand Down

0 comments on commit 7353c4d

Please sign in to comment.