root/site/build.xml
@
110
| Revision 105, 8.7 kB (checked in by nadya, 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?xml version="1.0"?> |
| 2 | <project name="build-site" default="docs" basedir="."> |
| 3 | |
| 4 | <!-- Initialization properties --> |
| 5 | <property name="project.name" value="site"/> |
| 6 | <property name="docs.src" location="xdocs"/> |
| 7 | <property name="docs.dest" location="pages"/> |
| 8 | <property name="target.dir" location="target"/> |
| 9 | <property name="docs.downloads.src" location="${docs.src}/downloads"/> |
| 10 | |
| 11 | <!-- This docs.downloads.dest value is passed into xdocs/downloads/downloads-cgi.xsl --> |
| 12 | <property name="docs.downloads.dest" location="${docs.dest}/downloads"/> |
| 13 | |
| 14 | <!-- This docs.downloads.tmp value is passed into xdocs/downloads/download-pages.xsl --> |
| 15 | <property name="docs.downloads.tmp" location="${target.dir}/download-xdocs"/> |
| 16 | |
| 17 | <!-- Directory to which news XML content files are generated. --> |
| 18 | <!-- <property name="news.gen.dir" location="${target.dir}/news-gen"/> --> |
| 19 | <!-- Directory to which RSS file is generated. --> |
| 20 | <!-- <property name="rss.output.dir" location="${docs.dest}/site"/> --> |
| 21 | |
| 22 | <target name="clean" description="Delete intermediate files."> |
| 23 | <delete dir="${target.dir}" quiet="yes"/> |
| 24 | </target> |
| 25 | |
| 26 | |
| 27 | <!-- <target name="news-gen" depends="CheckXSL" description="Generates RSS file and new XML content files from news.xml">--> |
| 28 | <!-- <mkdir dir="${rss.output.dir}"/> --> |
| 29 | <!-- <mkdir dir="${news.gen.dir}"/> --> |
| 30 | <!-- <xslt style="xdocs/stylesheets/news2content.xsl" --> |
| 31 | <!-- in="news.xml" --> |
| 32 | <!-- out="${rss.output.dir}/rss.xml" force="true"> --> |
| 33 | <!-- <param name="base.dir" expression="${news.gen.dir}"/> --> |
| 34 | <!-- </xslt> --> |
| 35 | <!-- </target> --> |
| 36 | |
| 37 | <macrodef name="transform"> |
| 38 | <attribute name="from" description="Directory containing source content files"/> |
| 39 | <attribute name="to" description="Output directory"/> |
| 40 | <attribute name="relative-path" default="../.." description="Relative path to root index folder."/> |
| 41 | |
| 42 | <sequential> |
| 43 | <!-- empty.xml is only in the root directory, but doesn't hurt --> |
| 44 | <xslt basedir="@{from}" |
| 45 | destdir="@{to}" |
| 46 | extension=".html" |
| 47 | style="xdocs/stylesheets/site.xsl" |
| 48 | excludes="empty.xml, news.xml, stylesheets/" |
| 49 | includes="**/*.xml" |
| 50 | force="true"> |
| 51 | <param name="relative-path" expression="@{relative-path}"/> |
| 52 | </xslt> |
| 53 | </sequential> |
| 54 | </macrodef> |
| 55 | |
| 56 | <target name="init"> |
| 57 | <!-- Show the build version in gump logs --> |
| 58 | <!-- <echo>Version $Revision: 667840 $ Last updated: $Date: 2008-06-14 20:42:37 +0400 (Сб, 14 ОÑМ 2008) $</echo> --> |
| 59 | <!--antcall target="_gump_run"/--> |
| 60 | |
| 61 | <!-- Check that the correct charset is being used --> |
| 62 | <xslt style="xdocs/stylesheets/charsetchk.xsl" |
| 63 | in="xdocs/empty.xml" |
| 64 | out="${docs.downloads.tmp}/charsetchk.html" force="true"> |
| 65 | </xslt> |
| 66 | <condition property="compareOK"> |
| 67 | <filesmatch file1="xdocs/charsetchk.html" file2="${docs.downloads.tmp}/charsetchk.html"/> |
| 68 | </condition> |
| 69 | <fail unless="compareOK"> |
| 70 | Failed to process some special characters - check the default encoding. |
| 71 | On Windows, try setting the code page - e.g. CHCP 1252 - before running Ant. |
| 72 | </fail> |
| 73 | <delete file="${docs.downloads.tmp}/charsetchk.html"></delete> |
| 74 | </target> |
| 75 | |
| 76 | <target name="docs" depends="init,CheckXSL" |
| 77 | description="Render HTML Pages via XSLT"> |
| 78 | |
| 79 | <condition property="target.vm" value="valid"> |
| 80 | <or> |
| 81 | <equals arg1="1.6" arg2="${java.specification.version}"/> |
| 82 | <equals arg1="1.5" arg2="${java.specification.version}"/> |
| 83 | <equals arg1="1.4" arg2="${java.specification.version}"/> |
| 84 | </or> |
| 85 | </condition> |
| 86 | <fail unless="target.vm" message="Must build with Java 1.4/1.5/1.6"/> |
| 87 | |
| 88 | <!-- Create destination directory if necessary --> |
| 89 | <mkdir dir="${docs.dest}"/> |
| 90 | |
| 91 | <!-- Transform the xml files - requires Ant 1.6.2 --> |
| 92 | <!-- Attempt to do the below styles all in one go |
| 93 | <xslt basedir="${docs.src}" |
| 94 | destdir="${docs.dest}" |
| 95 | style="xdocs/stylesheets/site.xsl" |
| 96 | excludes="empty.xml" |
| 97 | > |
| 98 | <mapper type="glob" from="*.xml" to="*.html"/> |
| 99 | </xslt> |
| 100 | --> |
| 101 | |
| 102 | <echo>*** Top level documentation</echo> |
| 103 | |
| 104 | <transform from="${docs.src}" to="${docs.dest}" relative-path="."/> |
| 105 | |
| 106 | <!-- <echo>*** site subdirectory</echo> --> |
| 107 | |
| 108 | <!-- <transform from="${docs.src}/site" to="${docs.dest}/site" relative-path=".."/> --> |
| 109 | |
| 110 | |
| 111 | <!--<echo>*** site/pmc directory</echo>--> |
| 112 | |
| 113 | <!-- <transform from="${docs.src}/site/pmc" to="${docs.dest}/site/pmc"/> --> |
| 114 | |
| 115 | |
| 116 | <!-- <echo>*** site/news directory</echo> --> |
| 117 | |
| 118 | <!-- <transform from="${docs.src}/site/news" to="${docs.dest}/site/news"/> --> |
| 119 | <!-- <transform from="${news.gen.dir}" to="${docs.dest}/site/news"/> --> |
| 120 | |
| 121 | <!-- <echo>*** Build and/or empty download xdocs</echo> |
| 122 | <mkdir dir="${docs.downloads.tmp}"/> --> |
| 123 | |
| 124 | <!-- Need to empty the input directory, otherwise obsolete files can remain --> |
| 125 | <!-- <delete dir="${docs.downloads.tmp}" file="*.xml"/> --> |
| 126 | |
| 127 | <!-- Seems like we could do one transform and generate the .cgi at the same time, using a text |
| 128 | output method. --> |
| 129 | |
| 130 | <!-- <xslt in="${docs.downloads.src}/downloads.xml" |
| 131 | out="${docs.downloads.tmp}/index.xml" |
| 132 | style="${docs.downloads.src}/download-page.xsl"/> --> |
| 133 | |
| 134 | <!-- empty.xml/.html isn't used except to trigger the creation of the individual project download |
| 135 | files. --> |
| 136 | |
| 137 | <!-- <xslt in="${docs.downloads.src}/downloads.xml" |
| 138 | out="${docs.downloads.tmp}/empty.xml" |
| 139 | style="${docs.downloads.src}/download-pages.xsl"> |
| 140 | <param name="docs.downloads.tmp" expression="${docs.downloads.tmp}"/> |
| 141 | </xslt> |
| 142 | <delete file="${docs.downloads.tmp}/empty.xml"/>--> |
| 143 | |
| 144 | <!-- <echo>*** Convert download xdocs to download pages</echo>--> |
| 145 | |
| 146 | <!-- <transform from="${docs.downloads.tmp}" to="${docs.downloads.dest}"/>--> |
| 147 | |
| 148 | |
| 149 | <!-- create .cgi files --> |
| 150 | <!-- <echo>*** Create download .cgi file</echo> |
| 151 | <xslt in="${docs.downloads.src}/downloads.xml" |
| 152 | out="${docs.downloads.dest}/empty.xml" |
| 153 | style="${docs.downloads.src}/downloads-cgi.xsl"> |
| 154 | <param name="docs.downloads.dest" expression="${docs.downloads.dest}"/> |
| 155 | </xslt> |
| 156 | <delete file="${docs.downloads.dest}/empty.xml"/> |
| 157 | |
| 158 | <echo>*** Copying static resource files</echo> |
| 159 | <copy todir="${docs.dest}/images" filtering="no"> |
| 160 | <fileset dir="${docs.src}/images"> |
| 161 | <include name="**/*.gif"/> |
| 162 | <include name="**/*.jpeg"/> |
| 163 | <include name="**/*.jpg"/> |
| 164 | <include name="**/*.png"/> |
| 165 | <include name="**/*.svg"/> |
| 166 | </fileset> |
| 167 | </copy> --> |
| 168 | |
| 169 | <!-- Not needed, as css file is only present in docs/site directory anyway |
| 170 | <echo>*** Copying CSS files</echo> |
| 171 | <copy todir="${docs.dest}" filtering="no"> |
| 172 | <fileset dir="${docs.src}"> |
| 173 | <include name="**/*.css"/> |
| 174 | </fileset> |
| 175 | </copy> |
| 176 | --> |
| 177 | |
| 178 | <antcall target="remove-ws"></antcall> |
| 179 | |
| 180 | </target> |
| 181 | |
| 182 | <!-- Process output to remove the trailing blank spaces --> |
| 183 | <target name="remove-ws"> |
| 184 | <echo>*** Removing extra white-space</echo> |
| 185 | <replace dir="${docs.dest}" token=" />" value="/>"> |
| 186 | <include name="**/*.html"/> |
| 187 | </replace> |
| 188 | </target> |
| 189 | |
| 190 | <target name="javadocs" |
| 191 | description="Javadocs is a noop"> |
| 192 | |
| 193 | <echo> |
| 194 | This project has no Java code, therefore, it has no |
| 195 | javadocs. This target is here to make Gumpy happy. |
| 196 | </echo> |
| 197 | </target> |
| 198 | |
| 199 | <target name="CheckXSL" description="Check site.xsl for tags with more than one attribute"> |
| 200 | <xslt in="${docs.src}/stylesheets/site.xsl" |
| 201 | out="${docs.src}/stylesheets/dummy.tmp" |
| 202 | style="${docs.src}/stylesheets/sitechk.xsl"/> |
| 203 | <delete file="${docs.src}/stylesheets/dummy.tmp"/> |
| 204 | <xslt in="${docs.src}/stylesheets/news2content.xsl" |
| 205 | out="${docs.src}/stylesheets/dummy.tmp" |
| 206 | style="${docs.src}/stylesheets/sitechk.xsl"/> |
| 207 | <delete file="${docs.src}/stylesheets/dummy.tmp"/> |
| 208 | </target> |
| 209 | |
| 210 | <target name="_gump_run" if="gump.run"> |
| 211 | <echo level="info"> |
| 212 | Gump properties for this run |
| 213 | gump.run = ${gump.run} |
| 214 | date.projectfile = ${date.projectfile} |
| 215 | version.projectfile = ${version.projectfile} |
| 216 | </echo> |
| 217 | <echoproperties prefix="ant"/> |
| 218 | <echoproperties prefix="gump"/> |
| 219 | <echoproperties prefix="os"/> |
| 220 | <echo message="HACK: trying to fix xsl:include error"/> |
| 221 | <delete file="news2content.xsl"/> |
| 222 | <copy todir="."> |
| 223 | <fileset file="${docs.src}/stylesheets/common.xsl"/> |
| 224 | </copy> |
| 225 | <mkdir dir="xsltslt-1.2.1"/> |
| 226 | <copy todir="xsltslt-1.2.1"> |
| 227 | <fileset dir="${docs.src}/stylesheets/xsltslt-1.2.1"/> |
| 228 | </copy> |
| 229 | </target> |
| 230 | |
| 231 | </project> |
Note: See TracBrowser
for help on using the browser.








