ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arind...@NIIT.COM
Subject RE: How do i do this?
Date Thu, 08 Nov 2001 12:13:09 GMT
Before I answer the question a bit of background of SQLJ.

SQLJ allows you to SQL statements in Java files as normal SQL statements as
against sending the SQL statements as a string parameter to JDBC calls. This
keeps the Code clean. The SQLJ Pre-Compiler processes the .sqlj files and
generates a .java file with appropriate JDBC calls and a .ser file which
contains information about the SQL statements, input parameters and output
parameters. 

The .java file gets saved in the same directory as that of .sqlj files,
while the .ser files gets saved in a directory passed to the SQLJ
precompiler command. In my case the build directory, which contains all the
class files.

Here is how I execute the SQL command with ANT:
	<target description="Pre-Compile SQLJ Files" name="sqlj">
		<apply executable="sqlj" dest="${dir.build}"
skipemptyfilesets="true" parallel="true" type="file" failonerror="false"
taskname="sqlj">
			<!-- Set the Environment Classpath -->
			<env key="classpath"
path="${oracle.home}/jdbc/lib/classes12.zip:${stellar.classpath}"/>
			<!-- SQLJ Arguments -->
			<arg value="-d=${dir.build}"/>
			<arg value="-compile=no"/>
			<arg value="-checkfilename=yes"/>
			<arg value="-status=yes"/>
			<arg
value="-user=${oracle.sqlj.user}/${oracle.sqlj.password}"/>
			<arg
value="-url=jdbc:oracle:oci8:@${oracle.server}"/>
			<arg value="-compiler-executable=jikes"/>
			<arg
value="-warn=all,noverbose,noprecision,noportable"/>
			<!-- SQLJ Files -->
			<fileset dir="${dir.src}">
				<patternset>
					<include name="**/*.sqlj"/>
				</patternset>
			</fileset>
			<!-- Mapping to OutputFiles -->
			<mapper type="glob" from="*.sqlj"
to="*_SJProfile0.ser"/>
		</apply>
	</target>

After the above target executes on a file in my source directory
${dir.src}/com/niit/objs/ABC.sqj, the following files are generated:
1. ${dir.src}/com/niit/objs/ABC.java
2. ${dir.build}/com/niit/objs/ABC_SJProfile0.ser

After this target execute, I compile all the .java files in my source
directory. After the java compilation ${dir.src}/com/niit/objs/ABC.java is a
redundant file in my source directory. I want to remove this file as I don't
want any developer to accidently edit this file.

I hope I was able to represent my problem.

Regards
Arindam


-----Original Message-----
From: 	Alan Pearlman Spencer [mailto:Alan.PearlmanSpencer@Mobileaware.com] 
Sent:	Thursday, November 08, 2001 3:17 PM
To:	Ant Users List
Subject:	RE: How do i do this?

Is this so you can recreate them?
Maybe you should use <apply> to have the compiler (sqlj?) run
on the changed files only?

<apply executable="sqlj?" dest="src/JAVA" parallel="false">
  <arg value="-c"/>
  <arg value="-o"/>
  <targetfile/>
  <srcfile/>
  <fileset dir="src/SQL" includes="*.sqlj"/>
  <mapper type="glob" from="*.sqlj" to="*.java"/>
</apply>



-----Original Message-----
From: ArindamR@NIIT.COM [mailto:ArindamR@NIIT.COM]
Sent: 08 November 2001 05:28
To: ant-user@jakarta.apache.org
Subject: How do i do this?


Hi,

I want to achieve the following functionality:

Remove all *.java files for which there is a corresponding .sqlj file.
For
e.g. if I have a.sqlj and b.sqlj in my source file directory, delete the
corresponding a.java and b.java. Although I can achieve this
functionality
using <script> task, is there any other way of doing this?

Regards,

Arindam.

--
To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message