| <?xml version="1.0"?> |
| <!-- |
| 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. |
| |
| --> |
| <!DOCTYPE project [ |
| <!ENTITY license ' |
| 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. |
| '> |
| <!ENTITY common SYSTEM 'src/ant/common.xml'> |
| ]> |
| |
| <!-- |
| This file releases log4cxx using Apache Ant (http://ant.apache.org) |
| --> |
| <project name="log4cxx" default="usage"> |
| |
| &common; |
| |
| <property name="base.dir" |
| location="." |
| /> |
| <property name="src.dir" |
| location="${base.dir}/src/main/cpp" |
| /> |
| <property name="resources.dir" |
| location="${base.dir}/src/main/resources" |
| /> |
| <property name="include.dir" |
| location="${base.dir}/src/main/include" |
| /> |
| <property name="target.dir" |
| location="${base.dir}/target" |
| /> |
| <property name="lib.dir" |
| location="${target.dir}/lib" |
| /> |
| <property name="examples.dir" |
| location="${base.dir}/src/examples/cpp" |
| /> |
| <property name="tests.dir" |
| location="${base.dir}/src/test" |
| /> |
| <property name="tests.cpp.dir" |
| location="${tests.dir}/cpp" |
| /> |
| <property name="tests.resources.dir" |
| location="${tests.dir}/resources" |
| /> |
| <property name="tests.output.dir" |
| location="${tests.resources.dir}/output" |
| /> |
| <property name="m2_repo" |
| location="${user.home}/.m2/repository" |
| /> |
| <property name="log4j.version" |
| value="1.2.14" |
| /> |
| <available property="log4j.jar" |
| value="/usr/share/java/log4j-1.2.jar" |
| file="/usr/share/java/log4j-1.2.jar" |
| /> |
| <property name="log4j.jar" |
| location="${m2_repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" |
| /> |
| <property name="doxygen.exe" |
| value="doxygen" |
| /> |
| <property name="lib.name" |
| value="${project.groupId}" |
| /> |
| <property name="lib.prefix" |
| value="" |
| /> |
| |
| <propertyregex property="version.major" |
| input="${project.version}" |
| regexp="^(\d+)" |
| select="\1" |
| /> |
| <propertyregex property="version.minor" |
| input="${project.version}" |
| regexp="\.(\d+)\." |
| select="\1" |
| /> |
| <propertyregex property="version.rev" |
| input="${project.version}" |
| regexp="(\d+)(?:-.+)?$" |
| select="\1" |
| /> |
| <propertyregex property="version.hasSuffix" |
| input="${project.version}" |
| regexp="\d+-.+$" |
| select="\0" |
| /> |
| |
| <property name="site.svnRepoUrl" |
| value="https://svn.apache.org/repos/infra/websites/production/logging/content/log4cxx" |
| /> |
| <property name="site.deployDir" |
| value="target/site-deploy" |
| /> |
| <property name="site.deployDir.curVersion" |
| value="${site.deployDir}/${project.version}" |
| /> |
| <property name="site.deployDir.curVersionWoSuffix" |
| value="${site.deployDir}/${version.major}.${version.minor}.${version.rev}" |
| /> |
| |
| <target name="usage" |
| description="Describes usage of the release script"> |
| <echo> |
| Ant file for releasing log4cxx |
| |
| Common invocations: |
| |
| > ant -p |
| |
| Displays available targets |
| </echo> |
| </target> |
| |
| <target name="init" |
| depends="common-init"> |
| |
| <condition property="force-ant" |
| value="1"> |
| <equals arg1="${find}" |
| arg2="false" |
| /> |
| </condition> |
| <echo>force-ant: ${force-ant}</echo> |
| </target> |
| |
| <target name="make-header-check"> |
| <echo file="${header}.cpp" |
| append="false"> |
| #include "${header}" |
| #include "${header}" |
| </echo> |
| </target> |
| |
| <target name="header-check" |
| description="Checks headers against Effective C++ guidelines"> |
| <fail unless="is-gcc">Requires GCC compiler</fail> |
| |
| <taskdef resource="net/sf/antcontrib/antcontrib.properties" /> |
| <delete dir="${target.dir}/header-check" /> |
| <mkdir dir="${target.dir}/header-check" /> |
| <copy todir="${target.dir}/header-check" |
| overwrite="true"> |
| <fileset dir="${include.dir}" |
| includes="**/*.h"> |
| <!-- obsolete header with #error directive to eliminate its use --> |
| <exclude name="**/tchar.h" /> |
| <!-- excluded due to conflict between log4cxx/rfa.h and log4cxx/rolling/rfa.h --> |
| <exclude name="log4cxx/rollingfileappender.h" /> |
| </fileset> |
| </copy> |
| <foreach target="make-header-check" |
| param="header"> |
| <path> |
| <fileset dir="${target.dir}/header-check" |
| includes="**/*.h" |
| /> |
| </path> |
| </foreach> |
| <property name="project.type" |
| value="msvc6" |
| /> |
| <cc objdir="${target.dir}/header-check" |
| name="gcc" |
| exceptions="true" |
| subsystem="gui" |
| optimize="${optimize}" |
| multithreaded="true" |
| relentless="true" |
| debug="${debug}" |
| projectsOnly="${projectsOnly}"> |
| |
| <compilerarg value="-Weffc++" |
| /> |
| <compilerarg value="-Wall" |
| /> |
| <compilerarg value="${pic-option}" |
| if="pic-option" |
| /> |
| <fileset dir="${target.dir}/header-check" |
| includes="**/*.cpp" |
| excludes="log4cxx/private/*.cpp **/aprinitializer.h.cpp" |
| /> |
| <includepath path="${include.dir}" /> |
| <project outfile="${projects.dir}/projects/header-check" |
| type="${project.type}" |
| if="project.if" |
| /> |
| </cc> |
| </target> |
| |
| <target name="clean-output" |
| depends="init"> |
| <delete> |
| <fileset dir="${tests.dir}" |
| includes="output/*" |
| /> |
| </delete> |
| </target> |
| |
| <target name="run-socketserver" |
| depends="clean-output" |
| description="Runs SocketServer test"> |
| <property environment="env" /> |
| <mkdir dir="${tests.output.dir}" /> |
| <delete> |
| <fileset dir="${tests.output.dir}" |
| includes="*" |
| /> |
| </delete> |
| <mkdir dir="target/test-classes" /> |
| <javac srcdir="src/test/java" |
| includes="org/apache/log4j/net/ShortSocketServer.java" |
| destdir="target/test-classes" |
| classpath="${log4j.jar}" |
| /> |
| <parallel> |
| <java classname="org.apache.log4j.net.ShortSocketServer" |
| fork="yes" dir="src/test/resources" |
| classpath="target/test-classes:${log4j.jar}"> |
| <arg value="8" /> |
| <arg value="input/socketServer" /> |
| </java> |
| <sequential> |
| <sleep seconds="2" /> |
| <exec executable="${testsuite.exe}" |
| dir="${tests.resources.dir}" |
| failonerror="true"> |
| <arg value="-v" /> |
| <arg value="socketservertestcase" /> |
| |
| <env key="LD_LIBRARY_PATH" |
| value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.LD_LIBRARY_PATH}" |
| /> |
| <env key="DYLD_LIBRARY_PATH" |
| value="${log4cxx.lib.dir}:${apr.lib.dir}:${apr-util.lib.dir}:${env.DYLD_LIBRARY_PATH}" |
| /> |
| <env key="Path" |
| value="${log4cxx.lib.dir};${env.Path}" |
| /> |
| </exec> |
| </sequential> |
| </parallel> |
| </target> |
| |
| <target name="apidocs" |
| description="Build log4cxx manual"> |
| <copy file="${base.dir}/src/site/doxy/Doxyfile.in" |
| tofile="${target.dir}/Doxyfile" |
| overwrite="true" |
| /> |
| <replace file="${target.dir}/Doxyfile"> |
| <replacefilter token="@version@" |
| value="${project.version}" |
| /> |
| <replacefilter token="@base_dir@" |
| value="${base.dir}" |
| /> |
| <replacefilter token="@manual_dest@" |
| value="${target.dir}/site/apidocs" |
| /> |
| </replace> |
| |
| <!-- |
| Copying project site index data to apidocs index |
| |
| We need some Apache boilerplate and intro in the apidocs index page and the easiest |
| solution seems to be to simply copy some of the contents of the project site index. |
| --> |
| <xslt in="${target.dir}/site/index.html" |
| out="${target.dir}/mainpage.dox" |
| style="${base.dir}/src/site/doxy/mainpage.dox.xsl" |
| force="true"> |
| <xmlcatalog> |
| <dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" |
| location="${base.dir}/src/site/doxy/DTDs/xhtml1-transitional.dtd" |
| /> |
| <dtd publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN" |
| location="${base.dir}/src/site/doxy/DTDs/xhtml-lat1.ent" |
| /> |
| <dtd publicId="-//W3C//ENTITIES Symbols for XHTML//EN" |
| location="${base.dir}/src/site/doxy/DTDs/xhtml-symbol.ent" |
| /> |
| <dtd publicId="-//W3C//ENTITIES Special for XHTML//EN" |
| location="${base.dir}/src/site/doxy/DTDs/xhtml-special.ent" |
| /> |
| </xmlcatalog> |
| </xslt> |
| |
| <mkdir dir="${target.dir}/site/apidocs" /> |
| <exec executable="${doxygen.exe}" |
| dir="${target.dir}" |
| /> |
| |
| <!-- |
| Links to the main project site |
| |
| We want links to the main project site and adding them after doxygen seems to be the |
| only and easiest way. |
| --> |
| <replaceregexp match="(<div (?:id="projectname"|class="title")>)(Apache log4cxx)" |
| replace="\1<a href="http://logging.apache.org/log4cxx">\2</a>" |
| flags="img"> |
| <fileset dir="${target.dir}/site/apidocs"> |
| <include name="*.html" /> |
| </fileset> |
| </replaceregexp> |
| </target> |
| |
| <target name="site-text-file-cleanup"> |
| <fixcrlf srcDir="${base.dir}/${subDir}" |
| tab="asis" |
| tablength="4" |
| fixlast="false" |
| eof="asis" |
| eol="unix" |
| includes="**/*.css **/*.html" |
| /> |
| |
| <replaceregexp flags="mg" |
| match="(?: |\t)+$" |
| replace=""> |
| <fileset dir="${base.dir}/${subDir}" |
| includes="**/*.css, **/*.html" |
| /> |
| </replaceregexp> |
| </target> |
| |
| <target name="site" |
| depends="apidocs"> |
| <antcall target="site-text-file-cleanup"> |
| <param name="subDir" |
| value="target/site" |
| /> |
| </antcall> |
| </target> |
| |
| <target name="prepare-changes" |
| description="Prepares changes.xml from a JIRA issues list"> |
| <xslt style="src/changes/changes.xslt" |
| in="issues.xml" |
| out="src/changes/changes.xml" |
| /> |
| </target> |
| |
| <target name="checkout-site"> |
| <exec executable="svn" |
| failonerror="true"> |
| <arg value="co" /> |
| <arg value="${site.svnRepoUrl}" /> |
| <arg value="${site.deployDir}" /> |
| </exec> |
| </target> |
| |
| <target name="update-site"> |
| <exec executable="svn" |
| dir="${site.deployDir}" |
| failonerror="true"> |
| <arg value="update" /> |
| </exec> |
| </target> |
| |
| <target name="post-site" |
| depends="checkout-site, update-site" |
| /> |
| |
| <target name="svn-mime=css"> |
| <exec executable="svn"> |
| <arg value="propset" /> |
| <arg value="svn:mime-type" /> |
| <arg value="text/css" /> |
| <arg value="${src.css}" /> |
| </exec> |
| </target> |
| |
| <target name="svn-mime=html"> |
| <exec executable="svn"> |
| <arg value="propset" /> |
| <arg value="svn:mime-type" /> |
| <arg value="text/html" /> |
| <arg value="${src.html}" /> |
| </exec> |
| </target> |
| |
| <!-- |
| Was unable to get a version w/o any suffix in pom.xml/distributionManagement, guess it's a |
| limitation of the property interpolation used. All suggestions found in the net seem to only |
| work outside that section, e.g. I was able to make a shorter version available in some |
| phases calling ANT targets. Doesn't get me anything... So I'm dealing with the long vs. |
| short name here by simply renaming the folder with the long name created by maven. |
| |
| This only works for SVN clients using only one ".svn" folder per working copy! |
| |
| https://cwiki.apache.org/confluence/display/MAVENOLD/POM+Interpolation+Refactor |
| https://stackoverflow.com/a/12002359/2055163 |
| https://gist.github.com/tux2323/970877#file-pom-xml-L24 |
| --> |
| <target name="svn-shorten-dir-name" |
| if="version.hasSuffix"> |
| <delete dir="${site.deployDir.curVersionWoSuffix}" |
| /> |
| <move file="${site.deployDir.curVersion}" |
| tofile="${site.deployDir.curVersionWoSuffix}" |
| /> |
| </target> |
| |
| <target name="site-deploy"> |
| <antcall target="svn-shorten-dir-name" /> |
| <delete file="${site.deployDir}/svn-commit.tmp~" /> |
| |
| <exec executable="svn" |
| failonerror="true"> |
| <arg value="add" /> |
| <arg value="--force" /> |
| <arg value="--depth=infinity" /> |
| <arg value="${site.deployDir.curVersionWoSuffix}" /> |
| </exec> |
| |
| <taskdef name="foreach" |
| classname="net.sf.antcontrib.logic.ForEach" |
| /> |
| <foreach target="svn-mime=css" |
| param="src.css"> |
| <path> |
| <fileset dir="${site.deployDir.curVersionWoSuffix}" |
| includes="**/*.css" |
| /> |
| </path> |
| </foreach> |
| <foreach target="svn-mime=html" |
| param="src.html"> |
| <path> |
| <fileset dir="${site.deployDir.curVersionWoSuffix}" |
| includes="**/*.html" |
| /> |
| </path> |
| </foreach> |
| |
| <antcall target="site-text-file-cleanup"> |
| <param name="subDir" |
| value="${site.deployDir.curVersionWoSuffix}" |
| /> |
| </antcall> |
| |
| <!-- |
| Is allowed to fail in case of no files to delete: |
| |
| [exec] svn: E205001: Try 'svn help delete' for more information |
| [exec] svn: E205001: Not enough arguments provided |
| --> |
| <exec executable="sh" |
| failonerror="false"> |
| <arg value="-c" /> |
| <arg value="svn st "${site.deployDir.curVersionWoSuffix}" | grep ! | cut -d! -f2 | sed 's/^ *//' | sed 's/^/\"/g' | sed 's/$/\"/g' | xargs svn rm" /> |
| </exec> |
| |
| <!-- Requires that SVN_EDITOR, VISUAL or EDITOR being set to edit commit description. --> |
| <exec executable="sh" |
| failonerror="true"> |
| <arg value="-c" /> |
| <arg value="svn ci "${site.deployDir.curVersionWoSuffix}" < /dev/tty > /dev/tty 2> /dev/tty" /> |
| </exec> |
| </target> |
| |
| <target name="autogen" |
| if="is-unix"> |
| <exec executable="sh"> |
| <arg value="autogen.sh" /> |
| </exec> |
| </target> |
| </project> |
| |