blob: a885b78a749e188990be092c7a7a7b2beef5371a [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- ==================================================================== -->
<!-- Apache Derby build file -->
<!-- ==================================================================== -->
<project default="drda" basedir="../..">
<!-- ==================================================================== -->
<!-- Set properties -->
<!-- ==================================================================== -->
<property name="properties.dir" value="tools/ant/properties"/>
<!-- User settings -->
<property file="${user.home}/ant.properties"/>
<!-- Significant dirs -->
<property file="${properties.dir}/dirs.properties"/>
<!-- Compiler settings -->
<property file="${properties.dir}/defaultcompiler.properties"/>
<property file="${properties.dir}/${build.compiler}.properties"/>
<!-- Parser properties -->
<property file="${properties.dir}/parser.properties"/>
<!-- Compile-time classpath properties files -->
<property file="${properties.dir}/extrapath.properties"/>
<property file="${properties.dir}/compilepath.properties"/>
<!-- Release and Version info -->
<property file="${properties.dir}/release.properties"/>
<!-- ============ Begin Targets ============== -->
<target name="drda" >
<ant dir="${derby.drda.dir}/impl/drda"/>
<ant dir="${derby.drda.dir}/drda"/>
<ant dir="${derby.drda.dir}/loc/drda"/>
<antcall target="odbcMeta"/>
</target>
<!-- Generate ODBC-compliant metadata statements from JDBC metadata -->
<!-- Doing so involves three steps: -->
<!-- 1. Get a fresh copy of the metadata.properties file (from the source -->
<!-- dir, since that one hasn't been modified by the ODBC generation -->
<!-- code), to be safe. -->
<!-- 2. Run the ODBC metadata generator program, which reads the metadata -->
<!-- file from step 1 and creates an output file that has all of the -->
<!-- queries from metadata.properties PLUS any ODBC versions of those -->
<!-- queries that are required for ODBC compliance. The name of this -->
<!-- output file is "odbc_metadata.properties". -->
<!-- 3. Move odbc_metadata.properties to clobber the metadata.properties -->
<!-- file that is in the BUILD directory (not the one in the source -->
<!-- dir). -->
<target name="odbcMeta" depends="odbcprops,verifyodbcgen,noODBC,chkodbcgen" unless="odbcgen.done">
<delete file="${metadata.out.dir}/metadata.properties"/>
<copy file="${derby.metadata.src.dir}/metadata.properties" tofile="${metadata.out.dir}/metadata.properties"/>
<java classname="org.apache.derbyBuild.ODBCMetadataGenerator"
classpath="${out.dir}"
dir="${metadata.out.dir}"
fork="yes"
failonerror="true">
</java>
<move file="${metadata.out.dir}/odbc_metadata.properties" tofile="${metadata.out.dir}/metadata.properties"/>
<touch file="${odbc.donefile}"/>
</target>
<target name="odbcprops">
<property name="odbc.donefile" value="${metadata.out.dir}/odbcmeta.done"/>
</target>
<target name="chkodbcgen">
<uptodate property="odbcgen.done"
targetfile="${odbc.donefile}" >
<srcfiles dir="${metadata.out.dir}" includes="metadata.properties" />
<srcfiles dir="${out.dir}/org/apache/derbyBuild" includes="ODBCMetadataGenerator.class,odbcgen_fragments.properties" />
</uptodate>
</target>
<target name="verifyodbcgen">
<available classname="org.apache.derbyBuild.ODBCMetadataGenerator"
property="odbcgen.available">
<classpath>
<pathelement path="${out.dir}"/>
</classpath>
</available>
</target>
<target name="noODBC" unless="odbcgen.available">
<echo level="error" message=""/>
<echo level="error" message="***** ODBC Metadata not available *****"/>
<echo level="error" message=" ***** Run &quot;all&quot; target first *****"/>
<echo level="error" message=""/>
<fail message=" Exiting ant build..."/>
</target>
<!-- ============= End Targets ============== -->
<!-- ============= End Project ============== -->
</project>