build.xml
author František Kučera <franta-hg@frantovo.cz>
Thu, 11 Sep 2014 20:30:46 +0200
changeset 135 ad2c76125200
parent 134 85c516f944a1
child 136 d5feb9d8ebc3
permissions -rw-r--r--
hgignore: glob/regex
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3 XML Web generátor – program na generování webových stránek
     4 Copyright © 2012 František Kučera (frantovo.cz)
     5 
     6 This program is free software: you can redistribute it and/or modify
     7 it under the terms of the GNU General Public License as published by
     8 the Free Software Foundation, either version 3 of the License, or
     9 (at your option) any later version.
    10 
    11 This program is distributed in the hope that it will be useful,
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 GNU General Public License for more details.
    15 
    16 You should have received a copy of the GNU General Public License
    17 along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18 -->
    19 <project name="xhtml-web" basedir="." default="generuj">
    20 
    21 	<loadproperties srcfile="build.uživatelské.properties"/>
    22 	<loadproperties srcfile="build.properties"/>
    23 
    24 	<!-- Používané adresáře – např. zde můžete vstup a výstup nasměrovat do jiného verzovaného úložiště -->
    25 	<property name="vstup" value="vstup"/>
    26 	<property name="výstup" value="výstup"/>
    27 	<property name="šablona" value="šablona"/>
    28 	<property name="seznamMaker" value="${šablona}/.makra-seznam.xsl"/>
    29 	<property name="temp" value="temp"/>
    30 	<property name="funkce" value="${šablona}/funkce/build/classes"/>
    31 	<property name="čára" value="----------------------------------------------------------------"/>
    32 
    33 	<property name="vstupníPřípona" value=".${vstup.pripona}"/>
    34 	<property name="výstupníPřípona" value=".${vystup.pripona}"/>
    35 
    36 	<target name="generuj" description="Vygeneruje kompletní web." depends="licence,_připrav,agregace,stránky"/>
    37 
    38 	<target name="stránky" description="Vygeneruje samotné XHTML webové stránky." depends="statický-obsah,syntaxe,kompiluj-funkce,makra">
    39 		<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">
    40 			<param name="podporaZaostalýchProhlížečů" expression="${xml.zaostaleProhlizece}"/>
    41 			<param name="vstupníPřípona" expression="${vstupníPřípona}"/>
    42 			<param name="výstupníPřípona" expression="${výstupníPřípona}"/>
    43 			<classpath location="${xslt.jar}"/>
    44 			<classpath location="${funkce}"/>
    45 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    46 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
    47 			</factory>
    48 		</xslt>
    49 	</target>
    50 
    51 	<target name="syntaxe" description="Vygeneruje CSS styl pro zvýrazňování syntaxe" depends="kompiluj-funkce">
    52 		<xslt in="${vstup}/web.conf" out="${výstup}/css/syntaxe.css" style="${šablona}/syntaxe.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    53 			<classpath location="${xslt.jar}"/>
    54 			<classpath location="${funkce}"/>
    55 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    56 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
    57 			</factory>
    58 		</xslt>
    59 	</target>
    60 
    61 	<target name="makra" description="Vygeneruje seznam maker podle souborů v příslušných složkách" depends="kompiluj-funkce">
    62 		<xslt in="${vstup}/web.conf" out="${seznamMaker}" style="${šablona}/makra.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    63 			<classpath location="${xslt.jar}"/>
    64 			<classpath location="${funkce}"/>
    65 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    66 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
    67 			</factory>
    68 		</xslt>
    69 	</target>
    70 
    71 	<target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml." depends="kompiluj-funkce">
    72 		<!-- TODO: sloučit, zjednodušit, parametrizovat -->
    73 
    74 		<!-- Atom -->
    75 		<xslt in="${vstup}/web.conf" out="${výstup}/atom.xml" style="${šablona}/atom.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    76 			<param name="vstupníPřípona" expression="${vstupníPřípona}"/>
    77 			<param name="výstupníPřípona" expression="${výstupníPřípona}"/>
    78 			<classpath location="${xslt.jar}"/>
    79 			<classpath location="${funkce}"/>
    80 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    81 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
    82 			</factory>
    83 		</xslt>
    84 
    85 		<!-- RSS -->
    86 		<xslt in="${výstup}/atom.xml" out="${výstup}/rss.xml" style="${šablona}/rss.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    87 			<classpath location="${xslt.jar}"/>
    88 			<classpath location="${funkce}"/>
    89 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    90 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
    91 			</factory>
    92 		</xslt>
    93 
    94 		<!-- Sitemap.xml -->
    95 		<xslt in="${výstup}/atom.xml" out="${výstup}/sitemap.xml" style="${šablona}/sitemap.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    96 			<classpath location="${xslt.jar}"/>
    97 			<classpath location="${funkce}"/>
    98 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    99 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
   100 			</factory>
   101 		</xslt>
   102 
   103 		<!-- Seznam stránek -->
   104 		<xslt in="${výstup}/atom.xml" out="${vstup}/.seznam.xml" style="${šablona}/seznam.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
   105 			<classpath location="${xslt.jar}"/>
   106 			<classpath location="${funkce}"/>
   107 			<factory name="net.sf.saxon.TransformerFactoryImpl">
   108 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>
   109 			</factory>
   110 		</xslt>
   111 
   112 	</target>
   113 
   114 	<target name="kompiluj-funkce" description="Přeloží funkce napsané v Javě.">
   115 		<mkdir dir="${funkce}"/>
   116 		<javac
   117 			srcdir="${šablona}/funkce/src"
   118 			destdir="${funkce}"
   119 			includeAntRuntime="no">
   120 		</javac>
   121 	</target>
   122 
   123 	<target name="statický-obsah" description="Kopíruje JS, CSS, obrázky atd.">
   124 		<copy todir="${výstup}">
   125 			<fileset dir="${vstup}" excludes="*.xml,makra/**,*.inc,web.conf"/>
   126 		</copy>
   127 	</target>
   128 
   129 	<target name="čisti" description="Smaže vygenerovaný obsah.">
   130 		<delete includeemptydirs="true">
   131 			<fileset dir="${výstup}" includes="**/*"/>
   132 			<fileset dir="${funkce}" includes="**/*"/>
   133 			<fileset file="${seznamMaker}"/>
   134 		</delete>
   135 	</target>
   136 
   137 	<target name="prohlédni" description="Otevře vygenerované stránky ve www prohlížeči.">
   138 		<exec executable="x-www-browser" os="Linux">
   139 			<arg value="${výstup}/index${výstupníPřípona}"/>
   140 		</exec>
   141 	</target>
   142 
   143 	<target name="publikuj" description="Nahraje výstup na server pomocí uživatelského skriptu.">
   144 		<exec executable="skripty/_publikuj.sh" os="Linux"/>
   145 	</target>
   146 	
   147 	<target name="_připrav" description="Spustí volitelný skript před generováním.">
   148 		<exec executable="skripty/_připrav.sh" os="Linux"/>
   149 	</target>
   150 
   151 	<target name="dokumentace" description="Sestaví dokumentaci">
   152 		<javadoc destdir="dokumentace/javadoc" linksource="true" windowtitle="XML Web generátor – javadoc">
   153 			<fileset dir="šablona/funkce/src"/>
   154 		</javadoc>
   155 	</target>
   156 
   157 	<target name="licence">
   158 		<echo>${čára}
   159 XML Web generátor Copyright © 2012 František Kučera (frantovo.cz)
   160 This program comes with ABSOLUTELY NO WARRANTY;
   161 This is free software, and you are welcome to redistribute it
   162 under certain conditions; type ‚ant licence-gpl‘ for details.
   163 ${čára}</echo>
   164 	</target>
   165 
   166 	<target name="licence-gpl">
   167 		<loadfile property="licence.txt" srcFile="licence/licence.txt"/>
   168 		<loadfile property="gpl-3.0.txt" srcFile="licence/gpl-3.0.txt"/>
   169 		<echo>${čára}</echo>
   170 		<echo>${licence.txt}</echo>
   171 		<echo>${čára}</echo>
   172 		<echo>${gpl-3.0.txt}</echo>
   173 		<echo>${čára}</echo>
   174 	</target>
   175 
   176 </project>
   177