core-jgi/db/ddlutils/fyracle/build.xml

124 lines
4.6 KiB
XML

<project name="export-data" default="create" basedir=".">
<property file="build.properties" />
<path id="lib.path">
<fileset dir="../lib">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="../lib">
<include name="**/*.jar" />
</fileset>
</classpath>
</taskdef>
<target name="create" depends="init,create-database,load-init,create-schema,load-data,load-functions,load-others">
</target>
<target name="init">
<echo message="============================================================" />
<echo message=" Fyracle database transfer tool for Compiere ERP" />
<echo message=" Jotel sp.j. http://www.jotel.com.pl/compiere-port" />
<echo message=" Open Business Solutions" />
<echo message=" This util license is GNU GPL License" />
<echo message=" Adempiere Licese is GNU GPL License" />
<echo message="============================================================" />
<echo message="" file="log/plsql.log" append="false" />
<echo append="false" file="log/build.log" message="#Build log:${line.separator}${line.separator}" />
</target>
<target name="create-database">
<!-- make backup just in case -->
<move file="${fyracle.database}" tofile="backup/adempiere.fdb" failonerror="false" />
<copy file="template.fdb" tofile="${fyracle.database}" />
</target>
<target name="load-init">
<echo file="log/plsql.log" append="true" message="${line.separator}#Load init.sql:${line.separator}${line.separator}" />
<antcall target="load">
<param name="file.name" value="${basedir}/init.sql" />
</antcall>
<antcall target="load">
<param name="file.name" value="../oracle/functions-decl.sql" />
</antcall>
</target>
<target name="create-schema">
<echo message="----- Creating tables -----" />
<ant antfile="build-ddl.xml" target="writeSchemaSqlToFile" />
<antcall target="load">
<param name="file.name" value="${basedir}/adempiere-schema.sql" />
</antcall>
</target>
<target name="load-functions">
<echo file="log/plsql.log" append="true" message="${line.separator}#Create Procedures:${line.separator}${line.separator}" />
<foreach param="file.name" target="load">
<path>
<fileset dir="../oracle/procedures">
<include name="**" />
</fileset>
</path>
</foreach>
</target>
<target name="load-data">
<echo message="----- Loading Adempiere Seed data -----" />
<ant antfile="build-ddl.xml" target="writeDataToDb" />
</target>
<target name="load-others">
<echo message="----- Loading other database object -----" />
<echo file="log/plsql.log" append="true" message="${line.separator}#Create Views [1st Pass]:${line.separator}${line.separator}" />
<foreach param="file.name" target="load">
<path>
<fileset dir="../views">
<include name="**" />
</fileset>
</path>
</foreach>
<echo file="log/plsql.log" append="true" message="${line.separator}#Create Views [2nd Pass]:${line.separator}${line.separator}" />
<foreach param="file.name" target="load">
<path>
<fileset dir="../views">
<include name="**" />
</fileset>
</path>
</foreach>
<echo file="log/plsql.log" append="true" message="${line.separator}#Create Functions:${line.separator}${line.separator}" />
<foreach param="file.name" target="load">
<path>
<fileset dir="../oracle/functions">
<include name="**" />
</fileset>
</path>
</foreach>
<echo file="log/plsql.log" append="true" message="${line.separator}#Create Sequences:${line.separator}${line.separator}" />
<foreach param="file.name" target="load">
<path>
<fileset dir="../sequences">
<include name="**" />
</fileset>
</path>
</foreach>
<ant antfile="build-ddl.xml" target="writeFkSqlToFile" />
<echo file="log/plsql.log" append="true" message="${line.separator}#Create Foreign Keys:${line.separator}${line.separator}" />
<antcall target="load">
<param name="file.name" value="${basedir}/adempiere-fk.sql" />
</antcall>
</target>
<target name="load">
<echo message="Loading file ${file.name}" />
<exec dir="${fyracle.home}\bin" executable="${fyracle.home}/bin/plsql" resultproperty="plsql.result" output="log/plsql.log" append="true">
<arg value="${fyracle.database}" />
<arg value="${file.name}" />
</exec>
<echo message="File ${file.name} status ${plsql.result}" />
<echo append="true" file="log/build.log">File ${file.name} status ${plsql.result}</echo>
<echo append="true" file="log/build.log" message="${line.separator}" />
</target>
</project>