-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
165 lines (149 loc) · 7.32 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="help" name="hss-a3">
<property name="applet.package" value="applet"/>
<property name="applet.name" value="SafeLibraryApplet"/>
<property name="package.aid" value="0x10:0x20:0x30:0x40:0x50:0x02"/>
<property name="applet.aid" value="0x10:0x20:0x30:0x40:0x50:0x03"/>
<property name="script.name" value="SafeLibrarySc.scr"/>
<property name="host.name" value="SafeLibraryHost"/>
<property name="applet.sourcedir" value="."/>
<property name="applet.scriptdir" value="."/>
<property name="applet.builddir" value="classes"/>
<property name="host.sourcedir" value="./host"/>
<property name="host.builddir" value="./host"/>
<property name="applet.deploydir" value="EEPROM"/>
<property name="deploy.name" value="EEFile"/>
<property name="exportmap" value="exportmap"/>
<property name="jdk.home" value="C:\Program Files\Java\jdk1.8.0_45"/>
<property name="javacardkit.home" value="C:/Program Files/JavaLibs/javacard/java_card_kit-2_2_2"/>
<property name="javacardkit.exports" value="${javacardkit.home}/api_export_files"/>
<property name="javacardkit.bin" value="${javacardkit.home}/bin"/>
<property name="javacardkit.lib" value="${javacardkit.home}/lib"/>
<property name="javacardkit.ant" value="${javacardkit.home}/ant-tasks/lib"/>
<taskdef name="apdutool" classname="com.sun.javacard.ant.tasks.APDUToolTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="capgen" classname="com.sun.javacard.ant.tasks.CapgenTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="maskgen" classname="com.sun.javacard.ant.tasks.MaskgenTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="deploycap" classname="com.sun.javacard.ant.tasks.DeployCapTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="exp2text" classname="com.sun.javacard.ant.tasks.Exp2TextTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="convert" classname="com.sun.javacard.ant.tasks.ConverterTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="verifyexport" classname="com.sun.javacard.ant.tasks.VerifyExpTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="verifycap" classname="com.sun.javacard.ant.tasks.VerifyCapTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="verifyrevision" classname="com.sun.javacard.ant.tasks.VerifyRevTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<taskdef name="scriptgen" classname="com.sun.javacard.ant.tasks.ScriptgenTask"
classpath="${javacardkit.ant}/jctasks.jar"/>
<typedef name="appletnameaid" classname="com.sun.javacard.ant.types.AppletNameAID"
classpath="${javacardkit.ant}/jctasks.jar"/>
<typedef name="jcainputfile" classname="com.sun.javacard.ant.types.JCAInputFile"
classpath="${javacardkit.ant}/jctasks.jar"/>
<typedef name="exportfiles" classname="org.apache.tools.ant.types.FileSet"
classpath="${javacardkit.ant}/jctasks.jar"/>
<path id="classpath">
<pathelement path="${javacardkit.lib}/api.jar"/>
<pathelement path="${javacardkit.lib}/converter.jar"/>
<pathelement path="${javacardkit.lib}/offcardverifier.jar"/>
<pathelement path="${javacardkit.lib}/jcrmiclientframework.jar"/>
<pathelement path="${javacardkit.lib}/scriptgen.jar"/>
<pathelement path="${javacardkit.lib}/apdutool.jar"/>
<pathelement path="${javacardkit.lib}/apduio.jar"/>
<pathelement path="${basedir}"/>
<pathelement path="${basedir}/host"/>
<pathelement path="lib/miglayout-3.7.3.1.jar" />
<pathelement path="lib/sqlite-jdbc-3.15.1.jar" />
</path>
<path id="exportpath">
<pathelement path="${javacardkit.exports}"/>
<pathelement path="${applet.builddir}"/>
</path>
<target name="build-applet">
<mkdir dir="${applet.builddir}"/>
<javac debug="yes" optimize="no" source="1.5" target="1.5"
srcdir="${applet.sourcedir}/${applet.package}"
destdir="${applet.builddir}"
includeantruntime="false">
<classpath refid="classpath"/>
</javac>
</target>
<target name="convert-applet" depends="build-applet">
<convert CAP="true" packagename="${applet.package}"
packageaid="${package.aid}" majorminorversion="1.0"
classdir="${applet.builddir}" outputdirectory="${applet.builddir}">
<AppletNameAID appletname="${applet.package}/${applet.name}"
aid="${applet.aid}"/>
<exportpath refid="exportpath"/>
<classpath refid="classpath"/>
</convert>
</target>
<target name="verify-applet" depends="convert-applet">
<verifycap
CapFile="${applet.builddir}/${applet.package}/javacard/${applet.package}.cap">
<exportfiles dir="${javacardkit.exports}">
<include name="**/io.exp"/>
<include name="**/lang.exp"/>
<include name="**/rmi.exp"/>
<include name="**/framework.exp"/>
<include name="**/service.exp"/>
<include name="**/security.exp"/>
<include name="**/crypto.exp"/>
</exportfiles>
<classpath refid="classpath"/>
</verifycap>
</target>
<target name="deploy-applet" depends="convert-applet">
<mkdir dir="${applet.deploydir}"/>
<deploycap outEEFile="${applet.deploydir}/${deploy.name}"
CrefExe="${javacardkit.home}/bin/cref.exe"
CapFile="${applet.builddir}/${applet.package}/javacard/${applet.package}.cap">
<classpath refid="classpath"/>
</deploycap>
</target>
<target name="run-script">
<apdutool scriptFile="${applet.scriptdir}/${script.name}"
inEEFile="${applet.deploydir}/${deploy.name}"
outEEFile="${applet.deploydir}/${deploy.name}"
CheckDownloadFailure="false"
CrefExe="${javacardkit.home}/bin/cref.exe">
<classpath refid="classpath"/>
</apdutool>
</target>
<target name="start-cad">
<exec dir="${basedir}" executable="${javacardkit.bin}/cref.exe">
<arg line="-i ${applet.deploydir}/${deploy.name}"/>
<arg line="-o ${applet.deploydir}/${deploy.name}"/>
</exec>
</target>
<target name="build-host">
<javac debug="yes" optimize="no" includeantruntime="false"
srcdir="${host.sourcedir}"
destdir="${host.builddir}">
<classpath refid="classpath" />
</javac>
</target>
<target name="run-host">
<java dir="${host.builddir}" className="${host.name}" fork="true">
<classpath refid="classpath"/>
</java>
</target>
<target name="clean">
<delete dir="${applet.builddir}"/>
<delete dir="${applet.deploydir}"/>
</target>
<target name="help">
<echo message="build-applet: Builds the Java Card applet"/>
<echo message="verify-applet: Optionally converts and verifies the applet"/>
<echo message="deploy-applet: Converts and deploys the applet"/>
<echo message="run-script: Runs the applet with a script file after deployed"/>
<echo message="start-cad: Starts CAD simulator after applet deployed"/>
<echo message="build-host: Builds the host application"/>
<echo message="run-host: Runs the host application once built and CAD started"/>
<echo message="clean: Removes all class files"/>
</target>
</project>