ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LIRA Olavo" <>
Subject RE: Multiple .properties in the same ANT
Date Thu, 10 Aug 2006 19:32:53 GMT
>You will have to give more information (such as the contents of your



>Can you use a macrodef to define the target and have it take in the name

>of the properties file as an argument?  Then the macrodef can load the

>properties with a prefix based on the argument.


Hi Ben, 


      I didn't send it before because I though it was big but there it is. So what I need
is to modify it to do like a "for" iteration for as many as I have it...
 Thanks for any ideas you may have it. Let me know if you need extra information



<project name="BuildJavaCard" default="AllFiles" basedir=".">

      <description>Build a package Java Card</description>


      <target name="Initialize">


            <!-- Read properties for the package -->

            <property file="" />

            <property name="javacard" value="${eclipse.home}/plugins/"


            <!-- Set base path for sources (*.java) -->

            <property name="src" location="./src" />

            <!-- Set base path for output files (*.jar, *.ijc, *.hex, *.cap, *.hex ...)

            <property name="bin" location="./bin" />

            <property name="lib" value="./lib;${javacard}/API/sim/MSA014/MSA014.jar;${javacard}/API/JC/JCMSA014/MSA014.jar"


            <!-- Build "-applet" param for converter -->

            <taskdef name="AppletParamConverter" classname=""
classpath="${javacard}/javacard.jar" />

            <!-- Properties PackagePath and PackageOutName from PackagePath -->

            <taskdef name="GetPropertiesPackage" classname=""
classpath="${javacard}/javacard.jar" />

            <!-- Convert AID from A00000000... to 0xA0:0x00:0x00:0x00:0X... -->

            <taskdef name="ConvAID" classname=""
classpath="${javacard}/javacard.jar" />

            <!-- Chooses the correct Conversor, JC, sim and extra library to compile-->

            <taskdef name="GetPropertiesAPIPath" classname=""
classpath="${javacard}/javacard.jar" />


            <!-- Call specific ant task -->

            <AppletParamConverter />

            <GetPropertiesPackage PackageName="${PackageName}" />

            <ConvAID AIDToConvert="${PackageAID}" PropertyName="PackageAIDConv" />

            <GetPropertiesAPIPath />




      <!-- Delete all output files -->

      <target name="clean" depends="Initialize" description="clean up">

            <delete dir="${bin}/${PackagePath}/javacard/${PackageOutName}.jar" />

            <delete file="${bin}/${PackagePath}/javacard/${PackageOutName}.jca" />

            <delete file="${bin}/${PackagePath}/javacard/${PackageOutName}.exp" />

            <delete file="${bin}/${PackagePath}/javacard/${PackageOutName}.ijc" />

            <delete file="${bin}/${PackagePath}/javacard/${PackageOutName}.hex" />

            <delete file="${bin}/${PackagePath}/javacard/${PackageOutName}.cap" />

            <delete quiet="true">

                  <fileset dir="${bin}/${PackagePath}/" includes="*.class" />




      <!-- Compile java files with JDK 1.2.2-->

      <target name="ClassFile" depends="clean" description="Compile sources File ">

            <!-- Create output path for class files if it doesn't exist -->

            <mkdir dir="${bin}" />


            <javac bootclasspath="${javacard}/tools\jdk1.2.2\jre\lib\rt.jar" srcdir="${src}"
optimize="true" debug="false" verbose="├┐es" destdir="${bin}" classpath="${lib}" target="1.1"



      <!-- Use converter to generate Jar, Jca, and exp files -->

      <target name="JarFile" depends="ClassFile" description="Package conversion">

            <!-- Create output path if it doesn't exist -->

            <mkdir dir="${bin}" />


            <path id="classpath" description="Sets the classpath to Java Card API and tools">

                  <pathelement path="${ConverterJarPath}" />

                  <pathelement path="${APIClassPath}" />

                  <pathelement path="." />


            <!-- Test <echo> 1: ${javacard} </echo> 

             Test <echo> 2: ${bin} </echo> 

             Test <echo> 3: ${AppletArg} </echo>  

             Test <echo> 4: ${ConverterJarPath} </echo> 

             Test <echo> 5: ${APIClassPath} </echo>

             Test <echo> 6: ${BasePath} </echo> -->

            <!-- launch converter -->

            <java classname="com.sun.javacard.converter.Converter" fork="true">


                        <pathelement path="${ConverterJarPath}" />

                        <pathelement path="${APIClassPath}" />

                        <pathelement path="${bin}" />


                  <arg line="-classdir ${bin}" />

                  <arg line="${AppletArg}" />

                  <!--<arg line="-exportpath ${APIClassPath}"/>-->

                  <arg line="-d ${bin}" />

                  <arg line="-v" />

                  <arg line="-out CAP EXP JCA" />

                  <arg line="${PackageName}" />

                  <arg line="${PackageAIDConv}" />

                  <arg line="${Version}" />



            <!-- Rename file cap to jar -->

            <move file="${bin}/${PackagePath}/javacard/${PackageOutName}.cap" tofile="${bin}/${PackagePath}/javacard/${PackageOutName}.jar"



      <!-- Convert the JAR file to a binary CAP file -->

      <!-- Dump CAP to have its size -->

      <target name="CapFile" depends="JarFile" description="Create CAP file">

            <!-- Convert the JAR file to a binary CAP file -->

            <java classname="">


                        <pathelement location="${javacard}/tools/JarToCap" />


                  <arg line="${bin}/${PackagePath}/javacard/${PackageOutName}.jar" />

                  <arg line="${bin}/${PackagePath}/javacard/${PackageOutName}.cap" />



            <!-- Dump CAP to have its size -->

            <java classname="com.gemplus.javacard.capfile.CapFile">


                        <pathelement location="${javacard}/tools/CapDump/CapDump.jar" />


                  <arg line="-capdir ${bin}" />

                  <arg ine="./${PackagePath}/javacard/${PackageOutName}.cap" />




      <!-- All output files generation -->

      <target name="AllFiles" depends="CapFile "/>



Olavo Lira

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message