ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LIRA Olavo" <Olavo.L...@gemalto.com>
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

>build.xml).

 

>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 javacard.properties 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="javacard.properties" />

            <property name="javacard" value="${eclipse.home}/plugins/com.gemplus.tools.gif.javacard"
/>

 

            <!-- 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="com.gemplus.tools.gif.javacard.AppletParamConverter"
classpath="${javacard}/javacard.jar" />

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

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

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

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

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

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

 

            <!-- Call specific ant task -->

            <AppletParamConverter />

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

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

            <GetPropertiesAPIPath />

 

      </target>

 

      <!-- 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" />

            </delete>

      </target>

 

      <!-- 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"
source="1.3"/>

      </target>

 

      <!-- 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="." />

            </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">

                  <classpath>

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

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

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

                  </classpath>

                  <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}" />

            </java>

 

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

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

      </target>

 

      <!-- 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="com.gemplus.tools.gemxpresso.JarToCap">

                  <classpath>

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

                  </classpath>

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

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

            </java>

 

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

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

                  <classpath>

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

                  </classpath>

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

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

            </java>

      </target>

 

      <!-- All output files generation -->

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

</project>

 

Olavo Lira


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