Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion docs/configuration/reproducible-builds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,52 @@
By default, JAR files generated by Gradle (with or without Shadow) for a single project with the same source code may
not be identical to each other. Sometimes it's desirable to configure a project to consistently output a byte-for-byte
identical JAR on every build. Gradle supports this with the following configuration, and Shadow will correctly respect
these settings too:
these settings too.

Besides file timestamps and file order, this configuration also ensures that all files in the JAR are set to have the
same permissions, irrespective of the locally configured umask.

More information about reproducible builds can be found at [reproducible-builds.org](https://reproducible-builds.org/).

Check failure on line 11 in docs/configuration/reproducible-builds/README.md

View workflow job for this annotation

GitHub Actions / check-links

[Linkspector] reported by reviewdog 🐶 Cannot reach https://reproducible-builds.org/ Status: null Navigation timeout of 30000 ms exceeded Raw Output: message:"Cannot reach https://reproducible-builds.org/ Status: null Navigation timeout of 30000 ms exceeded" location:{path:"docs/configuration/reproducible-builds/README.md" range:{start:{line:11 column:60} end:{line:11 column:119}}} severity:ERROR source:{name:"linkspector" url:"https://github.com/UmbrellaDocs/linkspector"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


=== "Kotlin"

```kotlin
import java.nio.file.Files
import java.nio.file.attribute.PosixFilePermission

tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true

eachFile {
permissions {
val isExec =
Files.getPosixFilePermissions(file.toPath()).contains(PosixFilePermission.OWNER_EXECUTE)
unix(if (isExec) "755" else "644")
}
}
dirPermissions { unix("755") }
}
```

=== "Groovy"

```groovy
import java.nio.file.Files
import java.nio.file.attribute.PosixFilePermission

tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true

eachFile {
permissions {
def isExec =
Files.getPosixFilePermissions(file.toPath()).contains(PosixFilePermission.OWNER_EXECUTE)
unix(isExec ? '755' : '644')
}
}
dirPermissions { unix('755') }
}
```

Expand Down
Loading