libreccm-legacy/tools-ng/ecdc/scriptlib/build-ccm.xml

238 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- Already definded:
ccm.project.dir: base dir of the development project
app.server.bundles.zip name of the installation file
app.server.parent.dir name of the dir to install the server into
app.server.home.dir dir the server is installed into (i.e. CATALINA_HOME)
app.server.deploy.dir dir the server is installed into (i.e. CATALINA_BASE)
app.server.conf.dir name of the servers configuration dir
app.server.webapp.dir distribution dir for web applications -->
<project name="load">
<target name="load-bundle" depends="prepare-load">
<echo>Loading bundle ${this.bundle.folder} into ${ccm.home}</echo>
<java classname="com.arsdigita.packaging.MasterTool" fork="true">
<classpath refid="ccm.classpath" />
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="load --packagekeys-file ${this.bundle.folder}/cfg/package-key.list --parameter-file ${this.bundle.folder}/cfg/integration.properties" />
</java>
</target>
<target name="load-bundle-interactive" depends="prepare-load">
<echo>Loading bundle ${this.bundle.folder} interactively into ${ccm.home}</echo>
<java classname="com.arsdigita.packaging.MasterTool" fork="true">
<classpath refid="ccm.classpath" />
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="load --packagekeys-file ${this.bundle.folder}/cfg/package-key.list --interactive --parameter-file ${this.bundle.folder}/cfg/integration.properties" />
</java>
</target>
<target name="load-bundle-config" depends="prepare-load">
<echo>load ${applications} --init using ${this.bundle.folder}/cfg/integration.properties</echo>
<java classname="com.arsdigita.packaging.MasterTool"
classpathref="ccm.classpath" fork="true">
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="load ${applications} --config --parameter-file ${this.bundle.folder}/cfg/integration.properties" />
</java>
</target>
<target name="load-bundle-config-interactive" depends="prepare-load">
<echo>load ${applications} --init using ${this.bundle.folder}/cfg/integration.properties</echo>
<java classname="com.arsdigita.packaging.MasterTool"
classpathref="ccm.classpath" fork="true" >
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="load ${applications} --config --interactive --parameter-file ${this.bundle.folder}/cfg/integration.properties" />
</java>
</target>
<target name="load-bundle-data" depends="prepare-load">
<echo>load data only executing</echo>
<echo>load --data ${applications}</echo>
<java classname="com.arsdigita.packaging.MasterTool"
classpathref="ccm.classpath" fork="true">
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="load --data ${applications}" />
</java>
</target>
<target name="load" depends="prepare-load">
<echo>load ${applications} </echo>
<java classname="com.arsdigita.packaging.MasterTool"
classpathref="ccm.classpath" fork="true">
<sysproperty key="ccm.home" value="${ccm.home}" />
<!--
<sysproperty key="log4j.configuration"
value="file:runtime/${app.server.bundles.name}/conf/log4j.xml" />
<sysproperty key="java.protocol.handler.pkgs"
value="${java.protocol.handler.pkgs}" />
-->
<arg line="load ${applications} " />
</java>
</target>
<target name="load-init" depends="prepare-load">
<echo>load --init ${applications}</echo>
<java classname="com.arsdigita.packaging.MasterTool"
classpathref="ccm.classpath" fork="true">
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="load --data ${applications}" />
</java>
</target>
<target name="prepare-load">
<property value="${app.server.webapp.dir}/ROOT/WEB-INF/bin/bundle"
name="this.bundle.folder" />
<echo>prepare bundle ${this.bundle.folder}</echo>
<!-- bundle file applications.cfg replaced by project.xml, now part of bundle
<copy file="${this.bundle.folder}/cfg/applications.cfg"
tofile=".tmp.applications.cfg" overwrite="yes" />
<replaceregexp file=".tmp.applications.cfg" match="#.*" replace="" byline="true" />
<replaceregexp file=".tmp.applications.cfg"
match="[ \t\r\n]+" replace=" " flags="gs" />
-->
<java classname="org.apache.xalan.xslt.Process" fork="yes" failonerror="true">
<classpath refid="ccm.tools.classpath"/>
<arg value="-IN"/>
<arg value="${this.bundle.folder}/cfg/project.xml"/>
<arg value="-OUT"/>
<arg value=".tmp.applications.list"/>
<arg value="-XSL"/>
<arg value="${ccm.tools.xsl.dir}/listapps.xsl"/>
<arg value="-TEXT"/>
</java>
<delete file=".tmp.applications.list"/>
<tstamp>
<format pattern="yyyymmddhhmmss" property="timestamp" />
</tstamp>
<echo>Included: ${applications}</echo>
<!-- classpath used by command line tools load-bundle, update, ... -->
<path id="ccm.classpath">
<path refid="ccm.tools.classpath"/>
<!-- <pathelement location="runtime/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/classes"/> -->
<pathelement location="${app.server.webapp.dir}/ROOT/WEB-INF/classes"/>
<!-- <fileset dir="runtime/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/lib" includes="**/*.jar" /> -->
<fileset dir="${app.server.webapp.dir}/ROOT/WEB-INF/lib" includes="**/*.jar" />
</path>
</target>
<target name="upgrade" depends="prepare-load" description="Upgrade">
<fail message="Configure the package being upgraded using the ccm.upgrade.package property">
<condition>
<or>
<not>
<isset property="ccm.upgrade.package" />
</not>
<equals arg1="ccm-xxx" arg2="${ccm.upgrade.package}" />
</or>
</condition>
</fail>
<fail message="Configure the source version using the ccm.upgrade.from.version property">
<condition>
<or>
<not>
<isset property="ccm.upgrade.from.version" />
</not>
<equals arg1="xxx" arg2="${ccm.upgrade.from.version}" />
<not>
<matches pattern="[0-9]+\.[0-9]+\.[0-9]+" string="${ccm.upgrade.from.version}" />
</not>
</or>
</condition>
</fail>
<fail message="Configure the target version using the ccm.upgrade.to.version property">
<condition>
<or>
<not>
<isset property="ccm.upgrade.to.version" />
</not>
<equals arg1="xxx" arg2="${ccm.upgrade.to.version}" />
<not>
<matches pattern="[0-9]+\.[0-9]+\.[0-9]+" string="${ccm.upgrade.to.version}" />
</not>
</or>
</condition>
</fail>
<echo message="Upgrading ${ccm.upgrade.package} from version ${ccm.upgrade.from.version} to ${ccm.upgrade.to.version}" />
<java classname="com.arsdigita.packaging.MasterTool" fork="yes">
<classpath refid="ccm.classpath" />
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="upgrade ${ccm.upgrade.package} --from-version=${ccm.upgrade.from.version} --to-version=${ccm.upgrade.to.version}" />
</java>
</target>
<target name="new-app">
<fail message="Please specify -Dnew.app.name=&lt;name&gt; at the command line">
<condition>
<not>
<isset property="new.app.name" />
</not>
</condition>
</fail>
<echo>Creating new application ${new.app.name}</echo>
<mkdir dir="${new.app.name}" />
<copy todir="${new.app.name}" preservelastmodified="true" verbose="true">
<fileset dir="${ccm.project.dir}/tools-ng/ecdc/templates/new-app">
<exclude name="src/new.app.name.*" />
</fileset>
<filterset>
<filter token="new.app.name" value="${new.app.name}" />
</filterset>
</copy>
<copy tofile="${new.app.name}/src/${new.app.name}.config"
file="${ccm.project.dir}/tools-ng/ecdc/templates/new-app/src/new.app.name.config"
preservelastmodified="true" verbose="true">
<filterset>
<filter token="new.app.name" value="${new.app.name}" />
</filterset>
</copy>
<copy tofile="${new.app.name}/src/${new.app.name}.load"
file="${ccm.project.dir}/tools-ng/ecdc/templates/new-app/src/new.app.name.load"
preservelastmodified="true" verbose="true">
<filterset>
<filter token="new.app.name" value="${new.app.name}" />
</filterset>
</copy>
<copy tofile="${new.app.name}/src/${new.app.name}.upgrade"
file="${ccm.project.dir}/tools-ng/ecdc/templates/new-app/src/new.app.name.upgrade"
preservelastmodified="true" verbose="true">
<filterset>
<filter token="new.app.name" value="${new.app.name}" />
</filterset>
</copy>
</target>
<target name="ccm">
<echo>ccm ${ccm.parameters}</echo>
<java classname="com.arsdigita.packaging.MasterTool" fork="yes">
<classpath>
<path refid="ccm.tools.classpath" />
<pathelement location="${app.server.webapp.dir}/ROOT/WEB-INF/classes" />
<fileset dir="${app.server.webapp.dir}/ROOT/WEB-INF/lib" includes="**/*.jar" />
</classpath>
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="${ccm.parameters}" />
</java>
</target>
<target name="ccm-run">
<echo>ccm-run ${ccm.classname} ${ccm.parameters}</echo>
<java classname="${ccm.classname}" fork="yes">
<classpath>
<path refid="ccm.tools.classpath" />
<pathelement location="${app.server.webapp.dir}/ROOT/WEB-INF/classes" />
<fileset dir="${app.server.webapp.dir}/ROOT/WEB-INF/lib" includes="**/*.jar" />
</classpath>
<sysproperty key="ccm.home" value="${ccm.home}" />
<arg line="${ccm.parameters}" />
</java>
</target>
</project>