-
Notifications
You must be signed in to change notification settings - Fork 67
/
build.xml
126 lines (126 loc) · 5.01 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
<?xml version="1.0"?>
<project name="ykneo-openpgp" default="convert" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<description>Ant build for ykneo-openpgp 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.lib" location="test/lib"/>
<!-- Load user specified extra properties -->
<property file="${user.home}/javacard.properties"/>
<property name="JAVA_PACKAGE" value="openpgpcard"/>
<property name="JAVA_PACKAGE_DIR" value="openpgpcard/"/>
<property name="APPLET_NAME" value="OpenPGPApplet"/>
<property name="PACKAGE_AID" value="0xd2:0x76:0x00:0x01:0x24:0x01"/>
<property name="APPLET_AID" value="0xd2:0x76:0x00:0x01:0x24:0x01:0x02:0x00:0x00:0x00:0x00:0x00:0x00:0x01:0x00:0x00"/>
<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}" includeantruntime="false" source="1.5" target="1.5">
<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" debug="yes">
<classpath>
<fileset dir="${test.lib}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target depends="compile" 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.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>
<target name="coverage" description="run tests with coverage" depends="compileTest">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath>
<fileset dir="${test.lib}">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<jacoco:coverage>
<junit printSummary="no" fork="yes" failureproperty="junit.failure">
<classpath>
<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>
</jacoco:coverage>
<jacoco:report>
<executiondata>
<file file="jacoco.exec"/>
</executiondata>
<structure name="ykneo-openpgp project">
<classfiles>
<fileset dir="applet/bin"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="applet/src"/>
</sourcefiles>
</structure>
<xml destfile="jacoco.xml"/>
<html destdir="jacoco"/>
</jacoco:report>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
</project>