Skip to content

Commit

Permalink
Use ant-javacard for building the applet.
Browse files Browse the repository at this point in the history
This works on all platforms and all JavaCard SDK versions
and is more pleasing to eye.
  • Loading branch information
martinpaljak committed May 2, 2015
1 parent a83ea64 commit 7fcbf0c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 91 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ doc
*.swp
*.orig
*.un~
*.cap
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "ext/ant"]
path = ext/ant
url = https://github.com/martinpaljak/ant-javacard.git
branch = master
107 changes: 16 additions & 91 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,94 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<project name="JavaCard PKI isoApplet" default="dist" basedir=".">
<description>Builds the project. </description>

<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="classes" location="classes"/>
<property name="dist" location="dist"/>

<!-- For accessing JC_HOME -->
<property environment="env"/>

<!-- JavaCard-specific directories -->
<path id="classpath" description="Sets the classpath to JavaCard API and tools">
<pathelement path="${env.JC_HOME}"/>
<pathelement path="${env.JC_HOME}/lib/api.jar"/>
<pathelement path="${env.JC_HOME}/lib/installer.jar"/>
<pathelement path="${env.JC_HOME}/lib/javacardframework.jar"/>
<pathelement path="${env.JC_HOME}/lib/converter.jar"/>
<pathelement path="${env.JC_HOME}/lib/offcardverifier.jar"/>
<pathelement path="${env.JC_HOME}/lib/scriptgen.jar"/>
<pathelement path="${env.JC_HOME}/lib/apdutool.jar"/>
<pathelement path="${env.JC_HOME}/lib/apduio.jar"/>
<pathelement path="."/>
<pathelement path="${classes}"/>
<pathelement path="${basedir}"/>
</path>

<!-- Definitions for tasks for javacard tools -->
<taskdef name="apdutool"
classname="com.sun.javacard.ant.tasks.APDUToolTask"/>
<taskdef name="capgen"
classname="com.sun.javacard.ant.tasks.CapgenTask"/>
<taskdef name="maskgen"
classname="com.sun.javacard.ant.tasks.MaskgenTask"/>
<taskdef name="deploycap"
classname="com.sun.javacard.ant.tasks.DeployCapTask"/>
<taskdef name="exp2text"
classname="com.sun.javacard.ant.tasks.Exp2TextTask"/>
<taskdef name="convert"
classname="com.sun.javacard.ant.tasks.ConverterTask"/>
<taskdef name="verifyexport"
classname="com.sun.javacard.ant.tasks.VerifyExpTask"/>
<taskdef name="verifycap"
classname="com.sun.javacard.ant.tasks.VerifyCapTask"/>
<taskdef name="verifyrevision"
classname="com.sun.javacard.ant.tasks.VerifyRevTask"/>
<taskdef name="scriptgen"
classname="com.sun.javacard.ant.tasks.ScriptgenTask"/>
<typedef name="appletnameaid"
classname="com.sun.javacard.ant.types.AppletNameAID"/>
<typedef name="jcainputfile"
classname="com.sun.javacard.ant.types.JCAInputFile"/>
<typedef name="exportfiles"
classname="org.apache.tools.ant.types.FileSet" />

<target name="init">
<!-- Timestamp -->
<tstamp/>
<!-- Create the classes directory structure used by compile -->
<mkdir dir="${classes}"/>
<!-- Copy JavaCard Export files -->
<copy todir="${classes}">
<fileset dir="${env.JC_HOME}/api_export_files" includes="**/*.exp"/>
</copy>
</target>

<target name="compile" depends="init" description="compile the source" >
<!-- Compile the java code from ${src} into ${classes} -->
<javac debug="no" optimize="yes" srcdir="${src}" destdir="${classes}">
<classpath refid="classpath"/>
<compilerarg line="-target 1.5 -source 1.5 -Xlint:all -Xlint:-serial"/>
</javac>
</target>

<target name="dist" depends="compile" description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Create package-->
<convert
dir="${classes}"
Configfile="${src}/net/pwendland/javacard/pki/isoapplet/IsoApplet.opt">
<classpath refid="classpath"/>
</convert>
</target>

<target name="clean" description="clean up" >
<!-- Delete the ${classes} and ${dist} directory trees -->
<delete dir="${dist}"/>
<delete dir="${classes}"/>
</target>

<description>Builds the project. </description>
<target name="dist" description="generate the distribution">
<tstamp/>
<ant dir="ext/ant"/>
<!-- Create the distribution directory -->
<taskdef name="javacard" classname="pro.javacard.ant.JavaCard" classpath="ext/ant/ant-javacard.jar"/>
<javacard>
<cap aid="f2:76:a2:88:bc:fb:a6:9d:34:f3:10" output="IsoApplet.cap" sources="src" version="1.0">
<applet class="net.pwendland.javacard.pki.isoapplet.IsoApplet" aid="f2:76:a2:88:bc:fb:a6:9d:34:f3:10:01"/>
</cap>
</javacard>
</target>
<target name="clean" description="clean up">
<!-- Delete the built applet -->
<delete dir="IsoApplet.cap"/>
</target>
</project>
1 change: 1 addition & 0 deletions ext/ant
Submodule ant added at d34bd0

0 comments on commit 7fcbf0c

Please sign in to comment.