forked from Yubico/ykneo-oath
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
86 lines (86 loc) · 3.6 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
<?xml version="1.0"?>
<project name="ykneo-oath" default="convert" basedir=".">
<description>Ant build for ykneo-oath applet</description>
<property name="src" location="applet/src"/>
<property name="build" location="applet/bin"/>
<property name="test.src" location="test/test"/>
<property name="test.build" location="test/bin"/>
<property name="test.resources" location="test/resources"/>
<property name="test.lib" location="test/lib"/>
<!-- Load user specified extra properties -->
<property file="${user.home}/javacard.properties"/>
<property name="JAVA_PACKAGE" value="pkgYkneoOath"/>
<property name="JAVA_PACKAGE_DIR" value="pkgYkneoOath"/>
<property name="APPLET_NAME" value="YkneoOath"/>
<property name="PACKAGE_AID" value="0xa0:0x00:0x00:0x05:0x27:0x21:0x01"/>
<property name="APPLET_AID" value="0xa0:0x00:0x00:0x05:0x27:0x21:0x01:0x01"/>
<property name="VERSION" value="0.1"/>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${test.build}/output"/>
</target>
<target name="compile" depends="init" description="compile the source" unless="test.build.mock">
<javac srcdir="${src}" destdir="${build}" source="1.2" target="1.1" includeantruntime="false">
<classpath>
<pathelement path="${JAVACARD_HOME}/lib/api.jar"/>
</classpath>
</javac>
</target>
<target name="compileMock" depends="init" description="compile with mocked javacard" if="test.build.mock">
<javac srcdir="${src}" destdir="${build}" source="1.2" target="1.1" includeantruntime="false">
<classpath>
<fileset dir="${test.lib}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target depends="test" name="convert" description="convert to .cap" unless="test.build.mock">
<java classname="com.sun.javacard.converter.Converter" fork="true" failonerror="true">
<arg line="-classdir ${build}"/>
<arg line="-verbose"/>
<arg line="-exportpath ${JAVACARD_HOME}/api_export_files"/>
<arg line="-out CAP JCA EXP"/>
<arg line="-applet ${APPLET_AID} ${APPLET_NAME}"/>
<arg line="${JAVA_PACKAGE} ${PACKAGE_AID} ${VERSION}"/>
<classpath>
<pathelement location="${JAVACARD_HOME}/lib/converter.jar"/>
<pathelement location="${JAVACARD_HOME}/lib/offcardverifier.jar"/>
</classpath>
</java>
</target>
<target name="clean" description="clean up">
<delete dir="${build}"/>
<delete dir="${test.build}"/>
</target>
<target name="compileTest" depends="compile,compileMock">
<javac srcdir="${test.src}" destdir="${test.build}" includeantruntime="false">
<classpath>
<pathelement path="${build}"/>
<pathelement location="/usr/share/java/junit4.jar"/>
<fileset dir="${test.lib}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="test" description="run tests" depends="compileTest">
<junit printSummary="no" fork="yes" failureproperty="junit.failure">
<classpath>
<pathelement location="${test.resources}"/>
<pathelement location="${test.build}"/>
<pathelement path="${build}"/>
<pathelement location="/usr/share/java/junit4.jar"/>
<fileset dir="${test.lib}">
<include name="*.jar"/>
</fileset>
</classpath>
<formatter type="plain" usefile="false" />
<formatter type="plain" />
<batchtest todir="${test.build}/output">
<fileset dir="${test.src}" includes="**/*.java" />
</batchtest>
</junit>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
</project>