blob: 2bf6793082a2b6314d6ea28f18cb056a2af7a06a [file] [log] [blame]
<!--
-
- 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="QpidBrokerCoreGenerateSources" default="generate-logmessages">
<!-- Additions to perform LogMessage generation. To enable for a given
module using the Ant build, add the following to the build.xml:
<import file="${project.root}/broker-core/build-generate-sources.xml"/>
<target name="precompile" depends="generate-logmessages"/> -->
<dirname property="QpidBrokerCoreGenerateSources.basedir" file="${ant.file.QpidBrokerCoreGenerateSources}"/>
<property name="generated-logmessages-dir" location="${module.src}" />
<property name="velocity.classes" value="${build.scratch}/broker-core/velocity"/>
<property name="velocity.timestamp" location="${generated-logmessages-dir}/velocity.timestamp" />
<property name="velocity.src.dir" value="${QpidBrokerCoreGenerateSources.basedir}/src/velocity/java"/>
<property name="velocity.template.dir" value="${QpidBrokerCoreGenerateSources.basedir}/src/velocity/templates/org/apache/qpid/server/logging/messages"/>
<path id="source.generation.classpathref">
<pathelement path="${project.root}/${velocity.jar}" />
<pathelement path="${project.root}/${velocity-dep.jar}" />
</path>
<condition property="generate.logmessage.sources" value="true">
<istrue value="${generate}"/>
</condition>
<target name="compile-logmessages-generator" >
<mkdir dir="${velocity.classes}" />
<!-- Compile LogMessages Velocity Generator -->
<javac source="${java.source}" target="${java.target}"
destdir="${velocity.classes}" debug="on" includeantruntime="false"
srcdir="${velocity.src.dir}" >
<classpath>
<path refid="source.generation.classpathref"/>
</classpath>
</javac>
</target>
<target name="check-logmessages-generation-required">
<uptodate property="logmessages-generation-not-required" targetfile="${velocity.timestamp}">
<srcfiles dir="${module.src}" includes="**/*_logmessages.properties" />
<srcfiles dir="${velocity.src.dir}" includes="**/*.java **/*.vm" />
</uptodate>
</target>
<target name="generate-logmessages" depends="compile-logmessages-generator" if="generate.logmessage.sources">
<mkdir dir="${generated-logmessages-dir}"/>
<path id="logmessages.path">
<fileset dir="${module.src}">
<include name="**/*_logmessages.properties"/>
</fileset>
</path>
<pathconvert property="logmessages"
refid="logmessages.path"
pathsep="' '"/>
<echo message="logmessages is ${logmessages}"/>
<java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" failonerror="true">
<arg line="'${logmessages}'"/>
<arg value="-j"/>
<arg value="-o"/>
<arg value="${generated-logmessages-dir}"/>
<arg value="-t"/>
<arg value="${velocity.template.dir}"/>
<arg value="-s"/>
<arg value="${module.src}"/>
<classpath>
<pathelement path="${module.src}"/>
<pathelement path="${velocity.classes}" />
<path refid="source.generation.classpathref"/>
</classpath>
</java>
<touch file="${velocity.timestamp}" />
</target>
</project>