blob: fa462758a48858f7235021e07668f9a693e40fbf [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project>
<property name="db.scripts.dir" value="${basedir}/target" />
<property name="descriptor.dir" value="${basedir}/src/main/descriptors"/>
<property name="scripts.dir" value="${basedir}/src/main/scripts"/>
<path id="classpath">
<pathelement path="${maven.runtime.classpath}"/>
</path>
<target name="create-schema">
<taskdef name="mappingtool" classname="org.apache.openjpa.jdbc.ant.MappingToolTask" classpathref="classpath"/>
<mkdir dir="target"/>
<mkdir dir="${db.scripts.dir}" />
<!-- Derby -->
<create-ddl db="derby"/>
<!-- MySQL -->
<create-ddl db="mysql"/>
<!-- Oracle -->
<create-ddl db="oracle"/>
<!-- Postgres -->
<!--
<create-ddl db="postgres"/>
-->
</target>
<target name="zip-derby-db">
<zip destfile="${basedir}/target/ode-dao-jpa-ojpa-derby-${ode.version}.zip" basedir="${basedir}/target/derby" />
</target>
<!--
============================================
Macro defs, no need to change anything below
============================================
-->
<macrodef name="create-ddl">
<attribute name="db"/>
<sequential>
<echo></echo>
<echo>=====================</echo>
<echo>Create DDL @{db}</echo>
<mappingtool schemaAction="build" sqlFile="${db.scripts.dir}/partial.@{db}.sql" readSchema="false">
<config propertiesFile="${descriptor.dir}/persistence.@{db}.xml"/>
<classpath>
<path refid="classpath"/>
</classpath>
</mappingtool>
<concat destfile="${db.scripts.dir}/@{db}.sql">
<fileset file="${scripts.dir}/common.sql"/>
<fileset file="${scripts.dir}/license-header.sql"/>
<fileset file="${scripts.dir}/simplesched-@{db}.sql"/>
<fileset file="${db.scripts.dir}/partial.@{db}.sql"/>
</concat>
<echo>Done.</echo>
<echo>=====================</echo>
</sequential>
</macrodef>
</project>