Skip to content

Commit 03d5a1a

Browse files
committed
add build metadata to jar file to aid reproducible builds
This moves jar creation to `ant release`. To provide build security, it should be possible for anyone to run the build process and end up with the same result as Zetetic. To aid that process, this adds metadata to the release jar that specifies which versions of Java, Android SDK, and Android NDK were used to build the official release.
1 parent e3c8265 commit 03d5a1a

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ build-jni:
3232
ndk-build NDK_LIBS_OUT=$(JNI_DIR)/libs
3333

3434
build-java:
35-
ant release && \
36-
cd ${CURDIR}/bin/classes && \
37-
jar -cvf sqlcipher.jar .
35+
ant release
3836

3937
release:
4038
-rm -rf ${RELEASE_DIR}
@@ -71,7 +69,6 @@ copy-libs:
7169
${LIBRARY_ROOT}/armeabi && \
7270
cp ${JNI_DIR}/libs/armeabi/libdatabase_sqlcipher.so \
7371
${LIBRARY_ROOT}/armeabi && \
74-
cp ${CURDIR}/bin/classes/sqlcipher.jar ${LIBRARY_ROOT} && \
7572
cp ${EXTERNAL_DIR}/libs/armeabi/libstlport_shared.so \
7673
${LIBRARY_ROOT}/armeabi
7774
mkdir -p ${LIBRARY_ROOT}/x86

custom_rules.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="custom_rules">
3+
4+
<condition property="ndk.dir" value="${env.ANDROID_NDK}">
5+
<isset property="env.ANDROID_NDK" />
6+
</condition>
7+
8+
<target name="-getgitdetails" >
9+
<exec executable="git" outputproperty="git.describe">
10+
<arg value="describe"/>
11+
</exec>
12+
<exec executable="git" outputproperty="git.revision">
13+
<arg value="rev-parse"/>
14+
<arg value="HEAD"/>
15+
</exec>
16+
</target>
17+
18+
<target name="-post-build" depends="-getgitdetails">
19+
<property name="jar.dir" value="libs" />
20+
<property name="jar.name" value="${jar.dir}/sqlcipher.jar" />
21+
<property file="${sdk.dir}/tools/source.properties" />
22+
<exec executable="cat" outputproperty="ndk.release">
23+
<arg value="${ndk.dir}/RELEASE.TXT"/>
24+
</exec>
25+
<delete file="${jar.name}"/>
26+
<mkdir dir="${jar.dir}" />
27+
<jar destfile="${jar.name}"
28+
includes="net/sqlcipher/**"
29+
basedir="${out.classes.absolute.dir}">
30+
<manifest>
31+
<attribute name="Implementation-Vendor" value="Zetetic"/>
32+
<attribute name="Implementation-Title" value="SQLCipher for Android"/>
33+
<attribute name="Implementation-URL" value="https://www.zetetic.net/sqlcipher/open-source"/>
34+
<attribute name="Implementation-Version" value="${git.describe}"/>
35+
<attribute name="Git-Revision" value="${git.revision}"/>
36+
<attribute name="Android-SDK-Release" value="${Pkg.Revision}"/>
37+
<attribute name="Android-SDK-Host-OS" value="${Archive.HostOs}"/>
38+
<attribute name="Android-NDK-Release" value="${ndk.release}"/>
39+
</manifest>
40+
</jar>
41+
</target>
42+
43+
</project>

0 commit comments

Comments
 (0)