Micheal,

Here it is:

...
    <!-- Properties for sqlj. (Disable online checking by default) -->
    <property name="sqlj.url"        value=""/>
    <property name="sqlj.user"       value=""/>
    <property name="sqlj.password"   value=""/>
    <property name="sqlj.executable" value="${library.directory}\sqlj.exe"/>
...
    <target name="sqlj_files_uptodate">
    <!-- check if SQLJ files are already uptodate. workaround for bug
         regarding 'skipemptyfilesets' of apply task -->
        <uptodate property="sqlj.files.uptodate"  >
            <srcfiles dir= "${source.directory}" includes="**/*.sqlj"/>
            <mapper type="glob" from="*.sqlj"
                                to="${generated.source.directory}/*.java"/>
        </uptodate>
    </target>

    <target name="sqlj" depends="init,sqlj_files_uptodate"
            unless="sqlj.files.uptodate"
            description="Pre-Compile SQLJ Files">
    <!-- Translate the SQLJ files from source.directory to
         generated.source.directory. Therefore generated.source.directory
must
         be included at the javac task.
    -->
        <mkdir dir="${generated.source.directory}"/>
        <mkdir dir="${build.directory}"/>

        <!-- Print a message whether online checking is enabled. -->
        <property name="sqlj.user.set" value="FALSE"/>
        <condition property="sqlj.user.set" value="TRUE">
            <not><equals arg1="${sqlj.user}" arg2=""/></not>
        </condition>
        <echo message="Compiling SQLJ files with online checking:
${sqlj.user.set}."/>

        <property name="sqlj.compile.classpath" refid="compile.classpath"/>

        <apply executable="${sqlj.executable}" taskname="sqlj"
dest="${generated.source.directory}"
               skipemptyfilesets="true" parallel="true" type="file"
               failonerror="true">
            <!-- Set the Environment Classpath -->
            <env key="classpath" path="${sqlj.compile.classpath}"/>
            <!-- SQLJ Arguments -->
            <arg value="-d=${build.directory}"/>              <!-- direcory
for .ser -->
            <arg value="-dir=${generated.source.directory}"/> <!-- direcory
for .java files -->
            <arg value="-compile=no"/>
            <arg value="-checkfilename=yes"/>
            <arg value="-status=true"/>
            <arg value="-user=${sqlj.user}/${sqlj.password}"/>
            <arg value="-url=${sqlj.url}"/>
            <arg value="-linemap=true"/>
            <arg value="-warn=all,noverbose,noprecision,portable,nonulls"/>
            <arg value="-explain=yes"/>
            <!-- SQLJ Files -->
            <fileset dir="${source.directory}">
                <patternset>
                        <include name="**/*.sqlj"/>
                </patternset>
            </fileset>
            <!-- Mapping to OutputFiles -->
            <mapper type="glob" from="*.sqlj" to="*.java"/>
        </apply>
        <!-- Simulate SQLJ from JDeveloper which creates *.generated.java
-->
        <copy todir="${source.directory}">
            <fileset dir="${generated.source.directory}"/>
            <mapper type="glob" from="*.java" to="*.generated.java"/>
        </copy>
    </target>

For any version of ANT after 1.4.1 you can drop the target
"sqlj_files_uptodate".
It is a workaround for a bug in the apply task which calls the executable
with an
empty fileset even if skipemptyfilesets is true.

HTH, Robert


> -----Urspr�ngliche Nachricht-----
> Von: Koegel, Michael [mailto:[EMAIL PROTECTED]]
> Gesendet am: Mittwoch, 06. M�rz 2002 16:08
> An: Ant Users List
> Betreff: AW: SQLJC
> 
> Robert,
> 
> thanks for the example. I would appreciate to see the whole target.
> I'm gonna use DB2 and they are calling their translator sqljc.
> 
> Kind Regards,
>  Michael
> 
> -----Urspr�ngliche Nachricht-----
> Von: HANDSCHMANN Robert [mailto:[EMAIL PROTECTED]]
> Gesendet am: Mittwoch, 6. M�rz 2002 15:22
> An: 'Ant Users List'
> Betreff: AW: SQLJC
> 
> Michael,
> 
> I don't know exactly what the 'c' stands for at the sqljc. I 
> assume the
> compiler
> for SQLJ files.
> Here is my call to the SQLJ precompiler:
> 
>         <apply executable="${sqlj.executable}" taskname="sqlj"
> dest="${generated.source.directory}"
>                skipemptyfilesets="true" parallel="true" type="file"
>                failonerror="true">
>             <!-- Set the Environment Classpath -->
>             <env key="classpath" path="${sqlj.compile.classpath}"/>
>             <!-- SQLJ Arguments -->
>             <arg value="-d=${build.directory}"/>              
> <!-- direcory
> for .ser -->
>             <arg value="-dir=${generated.source.directory}"/> 
> <!-- direcory
> for .java files -->
>             <arg value="-compile=no"/>
>             <arg value="-checkfilename=yes"/>
>             <arg value="-status=true"/>
>             <arg value="-user=${sqlj.user}/${sqlj.password}"/>
>             <arg value="-url=${sqlj.url}"/>
>             <arg value="-linemap=true"/>
>             <arg 
> value="-warn=all,noverbose,noprecision,portable,nonulls"/>
>             <arg value="-explain=yes"/>
>             <!-- SQLJ Files -->
>             <fileset dir="${source.directory}">
>                 <patternset>
>                         <include name="**/*.sqlj"/>
>                 </patternset>
>             </fileset>
>             <!-- Mapping to OutputFiles -->
>             <mapper type="glob" from="*.sqlj" to="*.java"/>
>         </apply>
> 
> I use the Oracle SQLJ translator. 
> Let me know if you want the complete target definition. I've 
> set up some
> kind of simulation of the JDeveloper 9i builtin translation 
> process to allow
> compiling via JDeveloper, alternatively.
> 
> WBR, Robert
> 
> > -----Urspr�ngliche Nachricht-----
> > Von: Koegel, Michael [mailto:[EMAIL PROTECTED]]
> > Gesendet am: Mittwoch, 06. M�rz 2002 14:28
> > An: ANT User Mailinglist (E-Mail)
> > Betreff: SQLJC
> > 
> > Hi ANT-Users,
> > 
> > is anybody doing sqljc compilation during their build and can 
> > give me an
> > example.
> > Is there a custom tag to do this?
> > 
> > Regards,
> >  Michael K�gel
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to