blob: 06463e664c97108978426f7596f29d78d926af2d [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (c) 2008, 2023 SAP AG and IBM Corporation.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
SAP AG - initial API and implementation
IBM Corporation/Andrew Johnson - automatic dita.dir
-->
<project name="eclipsehelp" default="all2">
<!-- dita.dir should point to the toolkit's root directory -->
<property environment="env"/>
<condition property="dita.dir" value="${env.DITA_DIR}">
<isset property="env.DITA_DIR"/>
</condition>
<property name="dita.dir" value="TODO_DITA_HOME"/>
<!-- can be overridden from command line -->
<property name="justnew" value="true"/>
<condition property="old.path" value="${env.Path}" else="${env.PATH}">
<isset property="env.Path"/>
</condition>
<target name="all" depends="eclipsehelp,eclipseapidoc"/>
<target name="all2" depends="eclipsehelp2,eclipseapidoc2"/>
<!-- Build for DITA < 3.0 -->
<target name="eclipsehelp">
<ant antfile="${dita.dir}${file.separator}build.xml">
<property name="args.csspath" value="styles"/>
<property name="args.input" location="${basedir}/toc.ditamap"/>
<property name="clean.temp" value="yes"/>
<property name="dita.dir" value="${dita.dir}"/>
<property name="dita.eclipse.plugin" value="no" />
<property name="dita.extname" value=".dita"/>
<property name="dita.temp.dir" location="${basedir}/temp"/>
<property name="output.dir" value="${basedir}" />
<property name="transtype" value="eclipsehelp"/>
<property name="args.eclipse.provider" value="Eclipse Memory Analyzer"/>
<property name="args.eclipse.version" value="1.12"/>
</ant>
<delete dir="temp"/>
<delete file="index.xml" />
<delete file="dita.list"/>
<delete file="dita.xml.properties"/>
</target>
<!-- Build for DITA >= 3.0 -->
<target name="eclipsehelp2" depends="eclipsehelpdita3,copyjustnew,copyall"/>
<target name="eclipsehelpdita3">
<condition property="dita.command" value="dita.bat" else="dita">
<os family="windows" />
</condition>
<exec executable="${dita.dir}${file.separator}bin${file.separator}${dita.command}">
<env key="PATH" path="${dita.dir}/bin:${old.path}"/>
<arg value="--input=${basedir}/toc.ditamap"/>
<arg value="--format=eclipsehelp"/>
<arg value="--propertyfile=DitaBuild.properties"/>
<arg value="--temp=${basedir}/temp"/>
<arg value="--output=${basedir}/out"/>
<arg value="--verbose"/>
</exec>
<!-- Fix the line ending to LF to match how extracted from Git -->
<fixcrlf eol="lf" srcDir="${basedir}/out" includes="**/*.html"/>
<!-- Fix commonltr.css -->
<concat append="true" destfile="${basedir}/out/styles/commonltr.css">
<fileset file="common.css" />
</concat>
<!-- Fix toc.xml -->
<loadfile property="content" srcFile="toccopyright.txt"/>
<replace file="${basedir}/out/toc.xml" token="&lt;toc" value="${content}"/>
<fixcrlf eol="lf" fixlast="false" srcDir="${basedir}/out" includes="toc.xml"/>
<delete dir="temp"/>
<delete file="index.xml" />
<delete file="dita.list"/>
<delete file="dita.xml.properties"/>
</target>
<target name="copyjustnew" if="${justnew}">
<!-- Make a copy of the new html files -->
<copy todir="${basedir}/outnew">
<fileset dir="${basedir}/out" >
<include name="**/*.html"/>
</fileset>
</copy>
<!-- Make a copy of the old html files -->
<copy todir="${basedir}/outorig">
<fileset dir="${basedir}" >
<include name="**/*.html"/>
<exclude name="doc/**"/>
<exclude name="out/**"/>
<exclude name="outnew/**"/>
<exclude name="outorig/**"/>
</fileset>
</copy>
<!-- Remove IDs from the copies of the old and new html -->
<replaceregexp match='="d([a-f0-9]{5})([a-f0-9]{2,4} ?"[ >])' replace='="d?????\2' flags="g">
<fileset dir="${basedir}">
<include name="outorig/**/*.html"/>
<include name="outnew/**/*.html"/>
</fileset>
</replaceregexp>
<!-- Make a copy of the old html files -->
<!-- Just for testing to see the effect of replacement before deletion
<copy todir="${basedir}/outnew2">
<fileset dir="${basedir}/outnew"/>
</copy>
-->
<!-- Delete the marker new html files without IDs if they are the same as the old -->
<delete>
<fileset dir="${basedir}/outnew" includes="**/*.html">
<not>
<different targetdir="${basedir}/outorig"
ignoreFileTimes="true"/>
</not>
</fileset>
</delete>
<!-- copy the generated files across unless a marker file has been deleted
indicating it is unchanged -->
<copy todir="${basedir}">
<fileset dir="${basedir}/out">
<include name="**/*.html"/>
<present present="both" targetdir="outnew"/>
</fileset>
<fileset dir="${basedir}/out">
<exclude name="**/*.html"/>
</fileset>
</copy>
<!-- tidy up -->
<delete dir="out"/>
<delete dir="outnew"/>
<delete dir="outorig"/>
</target>
<target name="copyall" unless="${justnew}">
<copy todir="${basedir}">
<fileset dir="${basedir}/out">
<include name="**/*"/>
</fileset>
</copy>
<!-- tidy up -->
<delete dir="out"/>
</target>
<!-- Build for DITA < 3.0 -->
<target name="eclipseapidoc">
<ant antfile="${dita.dir}${file.separator}build.xml">
<property name="args.csspath" value="styles"/>
<property name="args.input" location="${basedir}/apidoc.ditamap"/>
<property name="clean.temp" value="yes"/>
<property name="dita.dir" value="${dita.dir}"/>
<property name="dita.eclipse.plugin" value="no" />
<property name="dita.extname" value=".dita"/>
<property name="dita.temp.dir" location="${basedir}/temp"/>
<property name="output.dir" value="${basedir}" />
<property name="transtype" value="eclipsehelp"/>
<property name="args.eclipse.provider" value="Eclipse Memory Analyzer"/>
<property name="args.eclipse.version" value="1.12"/>
</ant>
<delete dir="temp"/>
<delete file="index.xml" />
<delete file="dita.list"/>
<delete file="dita.xml.properties"/>
</target>
<!-- Build for DITA >= 3.0 -->
<target name="eclipseapidoc2">
<condition property="dita.command" value="dita.bat" else="dita">
<os family="windows" />
</condition>
<exec executable="${dita.dir}${file.separator}bin${file.separator}${dita.command}">
<env key="PATH" path="${dita.dir}/bin:${old.path}"/>
<arg value="--input=${basedir}/apidoc.ditamap"/>
<arg value="--format=eclipsehelp"/>
<arg value="--propertyfile=DitaBuild.properties"/>
<arg value="--temp=${basedir}/temp"/>
<arg value="--output=${basedir}/."/>
</exec>
<delete dir="temp"/>
<delete file="index.xml" />
<delete file="dita.list"/>
<delete file="dita.xml.properties"/>
</target>
</project>