blob: c090b0bec754f422cc02a8e765699aebb4de1b80 [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 name="OFBiz Main Build" default="build" basedir=".">
<property name="site.dir" value="../site"/>
<property name="memory.initial.param" value="-Xms128M"/>
<property name="memory.max.param" value="-Xmx512M"/>
<available file="applications/build.xml" property="applications.present"/>
<available file="specialpurpose/build.xml" property="specialpurpose.present"/>
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<target name="ofbiz-init">
<property environment="env"/>
</target>
<!-- ================================================================== -->
<!-- Removes all created files and directories -->
<!-- ================================================================== -->
<target name="refresh">
<antcall target="clean-all"/>
<antcall target="build"/>
</target>
<target name="clean-all">
<antcall target="clean-data"/>
<antcall target="clean-logs"/>
<antcall target="clean-output"/>
<antcall target="clean-xtra"/>
<antcall target="clean-catalina"/>
<antcall target="clean-cache"/>
<antcall target="clean"/>
</target>
<target name="clean-data">
<subant target="clean-data">
<filelist dir="." files="framework/build.xml"/>
</subant>
<delete file="runtime/data.zip"/>
<delete file="runtime/test-list-build.xml"/>
</target>
<target name="clean-logs">
<subant target="clean-logs">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean-output">
<subant target="clean-output">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean-xtra">
<delete verbose="on">
<fileset dir="." includes="**/.nbattrs,**/*~,**/.#*,**/.DS_Store,**/*.rej,**/*.orig"/>
</delete>
</target>
<target name="clean-catalina">
<subant target="clean-catalina">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean-cache"
description="Clean the UtilCache file if errors found with old objects in the cache (Java runtime error something like 'local class incompatible')">
<property file="framework/base/config/cache.properties"/>
<echo message="NOTICE: deleting ${cache.file.store}.db"/>
<delete file="${cache.file.store}.db" verbose="true"/>
</target>
<target name="tests">
<subant target="tests">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean">
<subant target="clean">
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<include name="**/build.xml"/>
</fileset>
</subant>
<subant target="clean" failonerror="${specialpurpose.present}" description="Use failonerror=false in case the specialpurpose directory is not there">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant target="clean" failonerror="${applications.present}" description="Use failonerror=false in case the applications directory is not there">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant target="clean">
<filelist dir="." files="framework/build.xml"/>
</subant>
<delete file="ofbiz.jar"/>
<echo message="[clean] ========== Done Cleaning =========="/>
</target>
<target name="svninfo">
<echo message="Creating svninfo..."/>
<exec executable="svn" dir="." output="runtime/svninfo_tmp.xml">
<arg value="info"/>
<arg value="--xml"/>
</exec>
<xmlproperty file="runtime/svninfo_tmp.xml"/>
<echo message="Rev:${info.entry.commit(revision)}"/>
<basename property="releasePath" file="${info.entry.url}"/>
<echo message=" - Release-revision : ${releasePath}-${info.entry.commit(revision)}" file="runtime/svninfo.ftl"/>
<delete file="runtime/svninfo_tmp.xml"/>
<echo message="Done!"/>
</target>
<target name="clean-svninfo">
<echo message="Resetting svninfo..."/>
<echo message=" " file="runtime/svninfo.ftl"/>
<echo message="Done!"/>
</target>
<!-- ================================================================== -->
<!-- Build Components -->
<!-- ================================================================== -->
<target name="build">
<echo message="[build] ========== Start Building (Compile) =========="/>
<subant inheritall="false">
<filelist dir="." files="framework/build.xml"/>
</subant>
<subant inheritall="false" failonerror="${applications.present}">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant inheritall="false" failonerror="${specialpurpose.present}">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant inheritall="false">
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<exclude name="disabled/**"/>
<include name="**/build.xml"/>
</fileset>
</subant>
<antcall target="clean-svninfo"></antcall>
<echo message="[build] ========== Done Building (Compile) =========="/>
</target>
<!-- ================================================================== -->
<!-- Build JavaDocs -->
<!-- ================================================================== -->
<target name="docs">
<echo message="[docs] ========== Start Building (JavaDoc) =========="/>
<subant target="docs">
<filelist dir="." files="framework/build.xml"/>
</subant>
<subant target="docs" failonerror="${applications.present}">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant target="docs" failonerror="${specialpurpose.present}">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant target="docs">
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<include name="**/build.xml"/>
</fileset>
</subant>
<echo message="[docs] ========== Done Building (JavaDocs) =========="/>
</target>
<target name="docs-all" depends="build"
description="Build all javadoc into one tree for easier viewing by the community">
<echo message="[docs-all] ========== Start Building (JavaDoc) =========="/>
<mkdir dir="${site.dir}/javadocs"/>
<javadoc packagenames="org.ofbiz.*"
destdir="${site.dir}/javadocs"
maxmemory="256M"
windowtitle="Open for Business - API"
useexternalfile="yes">
<fileset dir="${basedir}" defaultexcludes="yes">
<include name="**/*.java"/>
<exclude name="**/ControlApplet.java"/>
<exclude name="**/ShipmentScaleApplet.java"/>
<exclude name="**/test/"/>
</fileset>
</javadoc>
<echo message="[docs-all] ========== Done Building (JavaDocs) =========="/>
</target>
<!-- ================================================================== -->
<!-- Contrib Targets -->
<!-- ================================================================== -->
<target name="copy-contrib">
<copy todir="${basedir}" overwrite="true" verbose="true">
<fileset dir="${basedir}/contrib" excludes="contrib/**,**/*.class"/>
</copy>
</target>
<target name="build-contrib" depends="copy-contrib,refresh"/>
<!-- ================================================================== -->
<!-- WebSite Targets -->
<!-- ================================================================== -->
<target name="build-website">
<antcall target="copy-dtds"/>
<antcall target="docs"/>
<antcall target="copy-apis"/>
</target>
<target name="copy-apis">
<mkdir dir="${site.dir}/api"/>
<mkdir dir="${site.dir}/api/framework"/>
<mkdir dir="${site.dir}/api/applications"/>
<mkdir dir="${site.dir}/api/specialpurpose"/>
<copy todir="${site.dir}/api/framework">
<fileset dir="${basedir}/framework" includes="**/build/javadocs/**"/>
</copy>
<copy todir="${site.dir}/api/applications">
<fileset dir="${basedir}/applications" includes="**/build/javadocs/**"/>
</copy>
<copy todir="${site.dir}/api/specialpurpose">
<fileset dir="${basedir}/specialpurpose" includes="**/build/javadocs/**"/>
</copy>
</target>
<target name="copy-dtds">
<mkdir dir="${site.dir}/dtds"/>
<copy todir="${site.dir}/dtds" flatten="true" overwrite="true">
<fileset dir="${basedir}" includes="**/*.dtd"/>
<fileset dir="${basedir}" defaultexcludes="yes"> <!-- all but oagis and external in general -->
<include name="**/*.xsd"/>
<exclude name="**/002*.xsd"/>
<exclude name="**/068*.xsd"/>
<exclude name="**/161*.xsd"/>
<exclude name="**/196*.xsd"/>
<exclude name="**/197*.xsd"/>
</fileset>
</copy>
</target>
<!-- ================================================================== -->
<!-- Script Targets -->
<!-- ================================================================== -->
<target name="scriptfix">
<fixcrlf srcdir="${basedir}" eol="lf" eof="remove" includes="**/*.sh"/>
<fixcrlf srcdir="${basedir}" eol="crlf" includes="**/*.bat"/>
</target>
<!-- ================================================================== -->
<!-- Start OFBiz -->
<!-- ================================================================== -->
<target name="run" description="This will start OFBiz">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
</java>
</target>
<target name="run-pos" description="Start the POS (Point of sale) system">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="pos"/>
</java>
</target>
<target name="run-install" depends="build"
description="This loads all configured data; meant for generic OFBiz development, testing, demonstration, etc purposes">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="install"/>
</java>
</target>
<target name="run-install-seed" depends="build"
description="This loads ONLY the seed data (not seed-initial, demo, ext* or anything else); meant for use after an update of the code to reload the seed data as it is generally maintained along with the code and needs to be in sync for operation">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed"/>
</java>
</target>
<target name="run-install-extseed" depends="build"
description="This loads seed, seed-initial and ext data; meant for manual/generic testing, development, or going into production with a derived system based on stock OFBiz where the ext data basically replaces the demo data">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed,seed-initial,ext"/>
</java>
</target>
<target name="run-install-exttest" depends="build"
description="This loads seed, seed-initial, ext and ext-test data; meant for automated testing with a derived system based on stock OFBiz">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed,seed-initial,ext,ext-test"/>
</java>
</target>
<target name="run-install-readers" depends="build"
description="This loads data using the command line argument 'data-readers' that takes a comma separated list of readers (seed, seed-initial, demo, ext, ext-test, ext-demo)">
<java jar="ofbiz.jar" fork="true" >
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="install"/>
<arg value="readers=${data-readers}"/>
</java>
</target>
<target name="run-install-file" depends="build"
description="This loads data using the command line argument 'file' to load data from a given file">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="install"/>
<arg value="delegator=default"/>
<arg value="file=${data-file}"/>
</java>
</target>
<target name="load-admin-user-login"
description="Creates a user login with admin privileges and a temporary password equal to 'ofbiz'; after a succesful login the user will be prompted for a new password. Example command for the userLogin 'admin': ./ant load-admin-user-login -DuserLoginId=admin">
<fail message="userLoginId parameter is required. To add the parameter to the command for user admin: -DuserLoginId=admin">
<condition>
<not><isset property="userLoginId"/></not>
</condition>
</fail>
<copy file="${basedir}/framework/resources/templates/AdminUserLoginData.xml" tofile="runtime/tmp/tmpUserLogin.xml">
<filterset>
<filter token="userLoginId" value="${userLoginId}"/>
</filterset>
</copy>
<antcall target="run-install-file">
<param name="data-file" value="runtime/tmp/tmpUserLogin.xml"/>
</antcall>
<delete file="runtime/tmp/tmpUserLogin.xml"/>
</target>
<target name="create-admin-user-login"
description="Prompts for a user name, then creates a user login with admin privileges and a temporary password equal to 'ofbiz'; after a succesful login the user will be prompted for a new password.">
<input addproperty="userLoginId" message="Enter user name (log in with the temporary password 'ofbiz'):"/>
<antcall target="load-admin-user-login"/>
</target>
<target name="run-debug" depends="build" description="Starts OFBiz in debugging mode">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091"/>
</java>
</target>
<target name="run-tests" depends="build" description="Run OFBiz default tests">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="test"/>
</java>
</target>
<target name="_save-runtime-data">
<delete file="runtime/data.zip"/>
<zip zipfile="runtime/data.zip" compress="no">
<fileset dir="runtime/data"/>
</zip>
</target>
<target name="_restore-runtime-data">
<delete dir="runtime/data"/>
<mkdir dir="runtime/data"/>
<unzip src="runtime/data.zip" dest="runtime/data"/>
</target>
<target name="_check-separated-tests-already-setup">
<available file="runtime/test-list-build.xml" property="_separated-tests-already-setup"/>
</target>
<target name="_setup-separated-test-run" depends="_check-separated-tests-already-setup" unless="_separated-tests-already-setup">
<subant target="clean-data">
<filelist dir="." files="framework/build.xml"/>
</subant>
<antcall target="run-install"/>
<antcall target="_save-runtime-data"/>
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="testlist"/>
<arg file="runtime/test-list-build.xml"/>
<arg value="-ant"/>
</java>
</target>
<target name="run-single-test" description="Run a single test">
<antcall target="_restore-runtime-data"/>
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="test"/>
<arg value="-component=${test.component}"/>
<arg value="-case=${test.case}"/>
</java>
<delete dir="runtime/logs/test-results/${test.component}-${test.case}"/>
<mkdir dir="runtime/logs/test-results/${test.component}-${test.case}"/>
<move todir="runtime/logs/test-results/${test.component}-${test.case}">
<fileset dir="runtime/logs/test-results" includes="*.xml"/>
</move>
</target>
<target name="run-single-test-suite" description="Run a single test suite">
<antcall target="_restore-runtime-data"/>
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<arg value="test"/>
<arg value="-component=${test.component}"/>
<arg value="-suitename=${test.suiteName}"/>
</java>
</target>
<target name="run-test-list" depends="_setup-separated-test-run" description="Run all configured tests, stopping/starting ofbiz between each test">
<delete dir="runtime/logs/test-results"/>
<ant antfile="runtime/test-list-build.xml" target="all-tests"/>
</target>
<target name="create-component"
description="Creates the layout of an OFBiz component in the hot-deploy folder.">
<input addproperty="component-name" message="Component name: "/>
<input addproperty="component-resource-name" message="Component resource name: "/>
<input addproperty="webapp-name" message="Webapp name: "/>
<input addproperty="base-permission" message="Base permission: "/>
<echo>The following hot-deploy component will be created:
Name: ${component-name}
Resource Name: ${component-resource-name}
Webapp Name: ${webapp-name}
Base permission: ${base-permission}
Folder: ${basedir}/hot-deploy/${component-name}
</echo>
<input addproperty="confirm-component-creation" message="Confirm: " defaultvalue="N" validargs="Y,N,y,n"/>
<fail message="Component creation cancelled by the user.">
<condition>
<equals arg1="${confirm-component-creation}" arg2="N" casesensitive="false"/>
</condition>
</fail>
<filterset id="replacePlaceholders">
<filter token="component-name" value="${component-name}"/>
<filter token="component-resource-name" value="${component-resource-name}"/>
<filter token="base-permission" value="${base-permission}"/>
<filter token="webapp-name" value="${webapp-name}"/>
</filterset>
<mkdir dir="${basedir}/hot-deploy/${component-name}"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/config"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/data"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/dtd"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/entitydef"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/lib"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/patches"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/script"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/servicedef"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/src"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/testdef"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/error"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF/actions"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/widget/"/>
<copy file="${basedir}/framework/resources/templates/ofbiz-component.xml" tofile="${basedir}/hot-deploy/${component-name}/ofbiz-component.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/build.xml" tofile="${basedir}/hot-deploy/${component-name}/build.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/TypeData.xml" tofile="${basedir}/hot-deploy/${component-name}/data/${component-resource-name}TypeData.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/SecurityData.xml" tofile="${basedir}/hot-deploy/${component-name}/data/${component-resource-name}SecurityData.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/DemoData.xml" tofile="${basedir}/hot-deploy/${component-name}/data/${component-resource-name}DemoData.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/entitymodel.xml" tofile="${basedir}/hot-deploy/${component-name}/entitydef/entitymodel.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/services.xml" tofile="${basedir}/hot-deploy/${component-name}/servicedef/services.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/UiLabels.xml" tofile="${basedir}/hot-deploy/${component-name}/config/${component-resource-name}UiLabels.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/index.jsp" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/index.jsp">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/error.jsp" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/error/error.jsp">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/controller.xml" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF/controller.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/web.xml" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF/web.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/CommonScreens.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/CommonScreens.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Screens.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/${component-resource-name}Screens.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Menus.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/${component-resource-name}Menus.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Forms.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/${component-resource-name}Forms.xml">
<filterset refid="replacePlaceholders"/>
</copy>
<echo>Component successfully created in folder ${basedir}/hot-deploy/${component-name}.
Restart OFBiz and then visit the URL: http://localhost:8080/${webapp-name}
</echo>
</target>
</project>