forked from martinpaljak/GlobalPlatformPro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
110 lines (110 loc) · 6.33 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?xml version="1.0"?>
<project name="GlobalPlatform" default="dist" basedir=".">
<description>ANT build file for GlobalPlatformPro (javacard.pro)</description>
<!-- Build dependencies -->
<target name="fetch">
<mkdir dir="lib"/>
<!-- Remember to update globalplatform.pro and .classpath as well! -->
<get src="https://repo1.maven.org/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="http://repo2.maven.org/maven2/org/slf4j/slf4j-api/1.7.13/slf4j-api-1.7.13.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="http://repo2.maven.org/maven2/org/slf4j/slf4j-simple/1.7.13/slf4j-simple-1.7.13.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="http://central.maven.org/maven2/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="http://downloads.bouncycastle.org/java/bcprov-jdk15on-154.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://github.com/martinpaljak/apdu4j/releases/download/v0.0.34/apdu4j-pcsc.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://repo1.maven.org/maven2/com/google/guava/guava/19.0/guava-19.0.jar" dest="lib" verbose="true" skipexisting="true"/>
<checksum algorithm="SHA-256" file="lib/jopt-simple-4.9.jar" property="26c5856e954b5f864db76f13b86919b59c6eecf9fd930b96baa8884626baf2f5" verifyProperty="joptOK"/>
<checksum algorithm="SHA-256" file="lib/slf4j-api-1.7.13.jar" property="20d68d0c2e4fb984ffc164852b8b68df49a2b8716076f576881bcef7649a0e35" verifyProperty="slfjapiOK"/>
<checksum algorithm="SHA-256" file="lib/slf4j-simple-1.7.13.jar" property="4709c0b535057c6a9a794da9522b1291de9c72b6d61f41b7ecf63156bc7bee35" verifyProperty="slfjsimpleOK"/>
<checksum algorithm="SHA-256" file="lib/proguard-base-5.2.1.jar" property="f163bdd73c58cbc9b789ab14f5d602b4994dbd82eacb5d54b3bd2a95de63f3bf" verifyProperty="proguardOK"/>
<checksum algorithm="SHA-256" file="lib/bcprov-jdk15on-154.jar" property="d0ae14598f9c528d2ab7bb8ed00e785a5440f692712cd362d69328aba25efb57" verifyProperty="bouncyOK"/>
<checksum algorithm="SHA-256" file="lib/apdu4j-pcsc.jar" property="c83739847a7b1e323e4d0cad94fe50858ecc9435a59ee429d55ec02934d52a30" verifyProperty="apduOK"/>
<checksum algorithm="SHA-256" file="lib/guava-19.0.jar" property="58d4cc2e05ebb012bbac568b032f75623be1cb6fb096f3c60c72a86f7f057de4" verifyProperty="guavaOK"/>
<fail message="Checksum failure">
<condition>
<or>
<isfalse value="${joptOK}"/>
<isfalse value="${slfjapiOK}"/>
<isfalse value="${slfjsimpleOK}"/>
<isfalse value="${proguardOK}"/>
<isfalse value="${bouncyOK}"/>
<isfalse value="${apduOK}"/>
<isfalse value="${guavaOK}"/>
</or>
</condition>
</fail>
</target>
<!-- Build the software -->
<path id="build.classpath">
<pathelement location="lib/jopt-simple-4.9.jar"/>
<pathelement location="lib/apdu4j-pcsc.jar"/>
<pathelement location="lib/bcprov-jdk15on-154.jar"/>
<pathelement location="lib/slf4j-api-1.7.13.jar"/>
<pathelement location="lib/guava-19.0.jar"/>
</path>
<target name="make" depends="fetch,compile"/>
<target name="compile" description="compile the source">
<mkdir dir="build"/>
<javac srcdir="src" destdir="build" includeantruntime="false" excludes="**/tests/**" debug="true" debuglevel="lines,vars,source">
<compilerarg value="-Xlint"/>
<classpath refid="build.classpath"/>
</javac>
</target>
<!-- Package it into a nice little JAR -->
<target name="dist" depends="make" description="generate the distribution">
<exec command="git describe --always --tags --long" output="build/pro/javacard/gp/version.txt"/>
<java classname="proguard.ProGuard" fork="true" failonerror="true">
<arg line="@globalplatform.pro"/>
<classpath>
<pathelement location="lib/proguard-base-5.2.1.jar"/>
</classpath>
</java>
<jar destfile="openkms-gp.jar" level="9" basedir="build"/>
<jar destfile="gp.jar" level="9">
<zipfileset src="lib/apdu4j-pcsc.jar" />
<zipfileset src="optimized-globalplatform.jar" excludes="org/bouncycastle/x509/"/>
<zipfileset src="lib/slf4j-simple-1.7.13.jar" excludes="META-INF/maven/"/>
<manifest><attribute name="Main-Class" value="pro.javacard.gp.GPTool"/></manifest>
</jar>
<delete file="optimized-globalplatform.jar"/>
</target>
<!-- Wrap the JAR into .EXE for Windows users -->
<target name="windist" depends="dist" description="package as .exe">
<property name="launch4j.dir" location="ext/launch4j"/>
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar"/>
<launch4j>
<config headerType="console" outfile="gp.exe" jar="gp.jar" errTitle="GlobalPlatformPro">
<jre minVersion="1.7.0"/>
</config>
</launch4j>
</target>
<!-- Clean the source tree -->
<target name="clean" description="clean up">
<delete dir="build"/>
<delete dir="javadoc"/>
<delete file="gp.jar"/>
</target>
<!-- Put javadocs online -->
<target name="javadoc">
<javadoc destdir="javadoc" Doctitle="GlobalPlatformPro Java" access="public" linksource="true">
<packageset dir="src">
<include name="pro/javacard/gp/"/>
<exclude name="pro/javacard/gp/tests/**"/>
</packageset>
<classpath refid="build.classpath"/>
</javadoc>
</target>
<!-- Do a full release to github -->
<target name="release" depends="clean,dist,javadoc">
<exec failonerror="true" command="test -n "$(git status -s)""/>
<input message="Publish version:" addproperty="release.version"/>
<input message="Do you want to release ${release.version}?" validargs="y,n" addproperty="do.release"/>
<condition property="do.abort">
<equals arg1="n" arg2="${do.release}"/>
</condition>
<fail if="do.abort">Not releasing ${release.version}.</fail>
<echo message="Releasing ${release.version} to Github"/>
<exec failonerror="true" command="git tag -s ${release.version} -m 'Release ${release.version}'"/>
<exec failonerror="true" command="git push --tags origin master"/>
<exec failonerror="true" command="ghp-import -n -m 'Release ${release.version}' -p javadoc"/>
</target>
</project>