Skip to content
Open
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions tor-android-binary/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,38 @@ tasks {
artifacts {
archives(sourcesJar)
}

// Configure all Jar tasks to use reproducible timestamps
withType<Jar> {
isReproducibleFileOrder = true
isPreserveFileTimestamps = false
// Set a fixed timestamp for reproducible builds (Unix epoch)
fileMode = 0644
dirMode = 0755
}

// Configure Javadoc generation for reproducible builds
withType<Javadoc> {
options {
// Set reproducible timestamp for Javadoc HTML headers
this as StandardJavadocDocletOptions
// Use a fixed timestamp instead of current time
windowTitle = "TorAndroid API"
docTitle = "TorAndroid API Documentation"
// Suppress timestamps in generated HTML
addBooleanOption("Xdoclint:none", true)
addStringOption("doctitle", "TorAndroid API Documentation")
addStringOption("windowtitle", "TorAndroid API")
// Set reproducible options
addBooleanOption("use", true)
addBooleanOption("splitindex", true)
encoding = "UTF-8"
charSet = "UTF-8"
// Suppress timestamp generation
addStringOption("bottom", "")
addBooleanOption("notimestamp", true)
}
}
}

afterEvaluate {
Expand Down
15 changes: 13 additions & 2 deletions tor-droid-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,19 @@ bundle()
gpg --armor --detach-sign $f
done
fi
# TODO faketime, strip-deterministic, or some other way to set ZIP timestamps
jar -cvf bundle-${artifact}-${version}.jar ${artifact}-*${version}*.*
# Use reproducible ZIP timestamps for deterministic builds
# Set all file timestamps to Unix epoch (1980-01-01 00:00:00) for reproducibility
if command -v strip-nondeterminism >/dev/null 2>&1; then
# If strip-nondeterminism is available, use it for best results
jar -cvf bundle-${artifact}-${version}.jar ${artifact}-*${version}*.*
strip-nondeterminism --type zip bundle-${artifact}-${version}.jar
else
# Fallback: Use TZ=UTC and touch to normalize timestamps before archiving
export TZ=UTC
# Set all files to a fixed timestamp (Unix epoch)
find . -name "${artifact}-*${version}*.*" -exec touch -t 198001010000.00 {} \;
jar -cvf bundle-${artifact}-${version}.jar ${artifact}-*${version}*.*
fi
}

show_options()
Expand Down