build.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 01:21:22 +0100
branchv_0
changeset 330 70e7eb578cfa
parent 134 85c516f944a1
permissions -rw-r--r--
Added tag relpipe-v0.18 for changeset 5bc2bb8b7946

<?xml version="1.0" encoding="UTF-8"?>
<!--
XML Web generátor – program na generování webových stránek
Copyright © 2012 František Kučera (frantovo.cz)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<project name="xhtml-web" basedir="." default="generuj">

	<loadproperties srcfile="build.uživatelské.properties"/>
	<loadproperties srcfile="build.properties"/>

	<!-- Používané adresáře – např. zde můžete vstup a výstup nasměrovat do jiného verzovaného úložiště -->
	<property name="vstup" value="vstup"/>
	<property name="výstup" value="výstup"/>
	<property name="šablona" value="šablona"/>
	<property name="seznamMaker" value="${šablona}/.makra-seznam.xsl"/>
	<property name="temp" value="temp"/>
	<property name="funkce" value="${šablona}/funkce/build/classes"/>
	<property name="čára" value="----------------------------------------------------------------"/>

	<property name="vstupníPřípona" value=".${vstup.pripona}"/>
	<property name="výstupníPřípona" value=".${vystup.pripona}"/>

	<target name="generuj" description="Vygeneruje kompletní web." depends="licence,_připrav,agregace,stránky"/>

	<target name="stránky" description="Vygeneruje samotné XHTML webové stránky." depends="statický-obsah,syntaxe,kompiluj-funkce,makra">
		<xslt basedir="${vstup}" destdir="${výstup}" includes="*${vstupníPřípona}" extension="${výstupníPřípona}" style="${šablona}/stránka.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<param name="podporaZaostalýchProhlížečů" expression="${xml.zaostaleProhlizece}"/>
			<param name="vstupníPřípona" expression="${vstupníPřípona}"/>
			<param name="výstupníPřípona" expression="${výstupníPřípona}"/>
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>
	</target>

	<target name="syntaxe" description="Vygeneruje CSS styl pro zvýrazňování syntaxe" depends="kompiluj-funkce">
		<xslt in="${vstup}/web.conf" out="${výstup}/css/syntaxe.css" style="${šablona}/syntaxe.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>
	</target>

	<target name="makra" description="Vygeneruje seznam maker podle souborů v příslušných složkách" depends="kompiluj-funkce">
		<xslt in="${vstup}/web.conf" out="${seznamMaker}" style="${šablona}/makra.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>
	</target>

	<target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml." depends="kompiluj-funkce">
		<!-- TODO: sloučit, zjednodušit, parametrizovat -->

		<!-- Atom -->
		<xslt in="${vstup}/web.conf" out="${výstup}/atom.xml" style="${šablona}/atom.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<param name="vstupníPřípona" expression="${vstupníPřípona}"/>
			<param name="výstupníPřípona" expression="${výstupníPřípona}"/>
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>

		<!-- RSS -->
		<xslt in="${výstup}/atom.xml" out="${výstup}/rss.xml" style="${šablona}/rss.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>

		<!-- Sitemap.xml -->
		<xslt in="${výstup}/atom.xml" out="${výstup}/sitemap.xml" style="${šablona}/sitemap.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>

		<!-- Seznam stránek -->
		<xslt in="${výstup}/atom.xml" out="${vstup}/.seznam.xml" style="${šablona}/seznam.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
			<classpath location="${xslt.jar}"/>
			<classpath location="${funkce}"/>
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
			</factory>
		</xslt>

	</target>

	<target name="kompiluj-funkce" description="Přeloží funkce napsané v Javě.">
		<mkdir dir="${funkce}"/>
		<javac
			srcdir="${šablona}/funkce/src"
			destdir="${funkce}"
			includeAntRuntime="no">
		</javac>
	</target>

	<target name="statický-obsah" description="Kopíruje JS, CSS, obrázky atd.">
		<copy todir="${výstup}">
			<fileset dir="${vstup}" excludes="*.xml,makra/**,*.inc,web.conf"/>
		</copy>
	</target>

	<target name="čisti" description="Smaže vygenerovaný obsah.">
		<delete includeemptydirs="true">
			<fileset dir="${výstup}" includes="**/*"/>
			<fileset dir="${funkce}" includes="**/*"/>
			<fileset file="${seznamMaker}"/>
		</delete>
	</target>

	<target name="prohlédni" description="Otevře vygenerované stránky ve www prohlížeči.">
		<exec executable="x-www-browser" os="Linux">
			<arg value="${výstup}/index${výstupníPřípona}"/>
		</exec>
	</target>

	<target name="publikuj" description="Nahraje výstup na server pomocí uživatelského skriptu.">
		<exec executable="skripty/_publikuj.sh" os="Linux"/>
	</target>
	
	<target name="_připrav" description="Spustí volitelný skript před generováním.">
		<exec executable="skripty/_připrav.sh" os="Linux"/>
	</target>

	<target name="dokumentace" description="Sestaví dokumentaci">
		<javadoc destdir="dokumentace/javadoc" linksource="true" windowtitle="XML Web generátor – javadoc">
			<fileset dir="šablona/funkce/src"/>
		</javadoc>
	</target>

	<target name="licence">
		<echo>${čára}
XML Web generátor Copyright © 2012 František Kučera (frantovo.cz)
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions; type ‚ant licence-gpl‘ for details.
${čára}</echo>
	</target>

	<target name="licence-gpl">
		<loadfile property="licence.txt" srcFile="licence/licence.txt"/>
		<loadfile property="gpl-3.0.txt" srcFile="licence/gpl-3.0.txt"/>
		<echo>${čára}</echo>
		<echo>${licence.txt}</echo>
		<echo>${čára}</echo>
		<echo>${gpl-3.0.txt}</echo>
		<echo>${čára}</echo>
	</target>

</project>