build.xml
author František Kučera <franta-hg@frantovo.cz>
Sun, 08 Jan 2012 16:52:30 +0100
changeset 76 c7746d95283d
parent 64 c069af21c4be
child 78 7e478bfa5694
permissions -rw-r--r--
Rozdělení knihovny funkcí podle maker, ve kterých se funkce používají. #8
     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 	<!-- Používané adresáře – např. zde můžete vstup a výstup nasměrovat do jiného verzovaného úložiště -->
    22 	<property name="vstup" value="vstup"/>
    23 	<property name="výstup" value="výstup"/>
    24 	<property name="šablona" value="šablona"/>
    25 	<property name="seznamMaker" value="${šablona}/.makra-seznam.xsl"/>
    26 	<property name="temp" value="temp"/>
    27 	<property name="funkce" value="${šablona}/funkce/build/classes"/>
    28 	<property name="čára" value="----------------------------------------------------------------"/>
    29 	
    30 	<property name="vstupníPřípona" value=".xml"/>
    31 	<property name="výstupníPřípona" value=".xhtml"/>
    32 	
    33 	<target	name="generuj" description="Vygeneruje kompletní web." depends="licence,agregace,stránky">
    34 	</target>
    35 	
    36 	<target name="stránky" description="Vygeneruje samotné XHTML webové stránky." depends="statický-obsah,syntaxe,kompiluj-funkce,makra">		
    37 		<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">
    38 			<param name="konfigurák" expression="../${vstup}/"/>		
    39 			<param name="podporaZaostalýchProhlížečů" expression="false"/>
    40 			<param name="vstupníPřípona" expression="${vstupníPřípona}"/>
    41 			<param name="výstupníPřípona" expression="${výstupníPřípona}"/>
    42 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    43 			<classpath location="${funkce}"/>
    44 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    45 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    46 			</factory>
    47 		</xslt>
    48 	</target>
    49 	
    50 	<target name="syntaxe" description="Vygeneruje CSS styl pro zvýrazňování syntaxe" depends="kompiluj-funkce">
    51 		<xslt in="${vstup}/web.conf" out="${výstup}/css/syntaxe.css" style="${šablona}/syntaxe.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    52 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    53 			<classpath location="${funkce}"/>
    54 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    55 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    56 			</factory>
    57 		</xslt>
    58 	</target>
    59 	
    60 	<target name="makra" description="Vygeneruje seznam maker podle souborů v příslušných složkách" depends="kompiluj-funkce">
    61 		<xslt in="${vstup}/web.conf" out="${seznamMaker}" style="${šablona}/makra.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    62 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    63 			<classpath location="${funkce}"/>
    64 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    65 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    66 			</factory>
    67 		</xslt>
    68 	</target>
    69 	
    70 	<target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml." depends="kompiluj-funkce">
    71 		<!-- TODO: sloučit, zjednodušit, parametrizovat -->
    72 	
    73 		<!-- Atom -->
    74 		<xslt in="${vstup}/web.conf" out="${výstup}/atom.xml" style="${šablona}/atom.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
    75 			<param name="vstupníPřípona" expression="${vstupníPřípona}"/>
    76 			<param name="výstupníPřípona" expression="${výstupníPřípona}"/>
    77 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    78 			<classpath location="${funkce}"/>
    79 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    80 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    81 			</factory>
    82 		</xslt>
    83 		
    84 		<!-- RSS --> 
    85 		<xslt in="${výstup}/atom.xml" out="${výstup}/rss.xml" style="${šablona}/rss.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">			
    86 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    87 			<classpath location="${funkce}"/>
    88 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    89 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    90 			</factory>
    91 		</xslt>
    92 		
    93 		<!-- Sitemap.xml -->
    94 		<xslt in="${výstup}/atom.xml" out="${výstup}/sitemap.xml" style="${šablona}/sitemap.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">			
    95 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    96 			<classpath location="${funkce}"/>
    97 			<factory name="net.sf.saxon.TransformerFactoryImpl">
    98 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    99 			</factory>
   100 		</xslt>
   101 		
   102 		<!-- Seznam stránek --> 
   103 		<xslt in="${výstup}/atom.xml" out="${vstup}/.seznam.xml" style="${šablona}/seznam.xsl"  processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">			
   104 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
   105 			<classpath location="${funkce}"/>
   106 			<factory name="net.sf.saxon.TransformerFactoryImpl">
   107 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
   108 			</factory>
   109 		</xslt>
   110 		
   111 	</target>
   112 	
   113 	<target name="kompiluj-funkce" description="Přeloží funkce napsané v Javě.">		
   114 		<mkdir dir="${funkce}"/>
   115 		<javac
   116 			srcdir="${šablona}/funkce/src"
   117 			destdir="${funkce}"			
   118 			includeAntRuntime="no">
   119 		</javac>
   120 	</target>
   121 	
   122 	<target name="statický-obsah" description="Kopíruje JS, CSS, obrázky atd.">
   123 		<copy todir="${výstup}">
   124 			<fileset dir="${vstup}" excludes="*.xml,makra.xsl,*.inc,web.conf"/>
   125 		</copy>
   126 	</target>
   127 	
   128 	<target name="čisti" description="Smaže vygenerovaný obsah.">
   129 		<delete includeemptydirs="true">
   130 			<fileset dir="${výstup}" includes="**/*"/>
   131 			<fileset dir="${funkce}" includes="**/*"/>
   132 			<fileset file="${seznamMaker}"/>
   133 		</delete>
   134 	</target>
   135 	
   136 	<target name="prohlédni" description="Otevře vygenerované stránky ve www prohlížeči.">
   137 		<exec executable="x-www-browser" os="Linux">
   138 			<arg value="${výstup}/index${výstupníPřípona}"/>
   139 		</exec>
   140 	</target>
   141 	
   142 	<target name="licence">
   143 		<echo>${čára}
   144 XML Web generátor Copyright © 2012 František Kučera (frantovo.cz)
   145 This program comes with ABSOLUTELY NO WARRANTY;
   146 This is free software, and you are welcome to redistribute it
   147 under certain conditions; type ‚ant licence-gpl‘ for details.
   148 ${čára}</echo>
   149 	</target>
   150 	
   151 	<target name="licence-gpl">
   152 		<loadfile property="licence.txt" srcFile="licence/licence.txt"/>
   153 		<loadfile property="gpl-3.0.txt" srcFile="licence/gpl-3.0.txt"/>
   154 		<echo>${čára}</echo> 
   155 		<echo>${licence.txt}</echo> 
   156 		<echo>${čára}</echo> 
   157 		<echo>${gpl-3.0.txt}</echo> 
   158 		<echo>${čára}</echo> 
   159 	</target>
   160 	
   161 </project>