-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
166 lines (150 loc) · 5.89 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="Validation, Diagnostics and build" xmlns:if="ant:if"
xmlns:unless="ant:unless">
<description>
#####################################################################
# Project build file by Martin Holmes (mholmes@uvic.ca), 2023. #
# This build file processes the site content in the pages folder #
# to create a fully-realized site in both languages in the products #
# folder. #
#####################################################################
</description>
<property name="echo.separator" value="************************************************"/>
<property name="saxon" value="${basedir}/utilities/saxon-he-10.jar"/>
<!-- Set of content source files to process. -->
<fileset id="sourceFiles" dir="${basedir}/pages">
<include name="*.xml"/>
</fileset>
<!-- Images to push to the site folder. -->
<fileset id="imgFiles" dir="${basedir}/img">
<include name="*.*"/>
</fileset>
<!-- PDFs and other docs to push to the site folder. -->
<fileset id="docFiles" dir="${basedir}/files">
<include name="*.*"/>
</fileset>
<!-- JS to push to the site folder. -->
<fileset id="jsFiles" dir="${basedir}/js">
<include name="*.*"/>
</fileset>
<!-- Fonts for the site. -->
<!-- <fileset id="fonts" dir="${basedir}/fonts">
<include name="*.*"/>
</fileset>-->
<target name="clean">
<description>
TARGET clean
This target clears out old build products.
</description>
<echo message="${echo.separator}"/>
<echo message="Cleaning up content from previous builds..."/>
<mkdir dir="${basedir}/products"/>
<delete includeemptydirs="true">
<fileset dir="${basedir}/products">
<include name="*"/>
<include name="**/*"/>
</fileset>
</delete>
<!-- Now get the git hash for our build. -->
<exec executable="git">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
<redirector output="GITREV"/>
</exec>
</target>
<target name="buildCss">
<description>
TARGET buildCss
This builds the SCSS file to create CSS and map file for the output site.
</description>
<echo message="${echo.separator}"/>
<echo message="Building SCSS source to create CSS file in HTML folder."/>
<mkdir dir="${basedir}/products/css"/>
<exec executable="sass">
<arg value="${basedir}/css/endings.scss"/>
<arg value="${basedir}/products/css/endings.css"/>
</exec>
</target>
<target name="buildHtml">
<description>
TARGET buildHtml
This target processes all the existing HTML files to
refresh any common components such as menus. It places
the output into a temp folder so that it can be inspected
before overwriting the originals.
</description>
<echo message="${echo.separator}"/>
<echo message="Building all the site pages..."/>
<java fork="true" classname="net.sf.saxon.Transform" classpath="${saxon}" failonerror="true" dir="${basedir}">
<arg value="-s:xsl/build_html.xsl"/>
<arg value="-xsl:xsl/build_html.xsl"/>
<arg value="projDir=${basedir}/"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
</java>
</target>
<target name="copyRequiredFiles">
<copy todir="${basedir}/products/img">
<fileset refid="imgFiles"/>
</copy>
<copy todir="${basedir}/products/files">
<fileset refid="docFiles"/>
</copy>
<copy todir="${basedir}/products/js">
<fileset refid="jsFiles"/>
</copy>
<copy todir="${basedir}/products" file="${basedir}/logos/favicon.svg"/>
<zip basedir="${basedir}/logos" zipfile="${basedir}/products/logos.zip"/>
</target>
<target name="validateSite">
<description>
TARGET validateSite
This target validates the complete collection of XHTML5 documents
comprising the output site, using the VNU validator (the same validator used by
the W3C's online validation service).
Before it can proceed, it has to copy the jar file, which is stored with an
obfuscated name so that it doesn't break Oxygen's ability to build TEI ODD
files due to a duplicate class.
</description>
<echo message="${echo.separator}"/>
<echo message="Validating the HTML pages produced in the build using the VNU validator."/>
<copy file="${basedir}/utilities/vnu.jarx" tofile="${basedir}/utilities/vnu.jar"/>
<java jar="${basedir}/utilities/vnu.jar" failonerror="false" fork="true">
<arg value="--format text"/>
<arg value="--skip-non-html"/>
<arg value="--also-check-css"/>
<arg value="--xml"/>
<arg value="${basedir}/products"/>
</java>
<delete file="${basedir}/utilities/vnu.jar"/>
</target>
<target name="rsyncToLiveServer">
<description>
TARGET rsyncToLiveServer
This pushes the content up to the endings/www folder on the nfs.hcmc.uvic.ca server.
This will overwrite the existing site, but it will not delete any obsolete files.
</description>
<echo message="${echo.separator}"/>
<echo message="Pushing content up to the live site."/>
<exec executable="rsync" dir="${basedir}">
<arg value="--stats"/>
<arg value="--recursive"/>
<arg value="--times"/>
<arg value="--verbose"/>
<arg value="--omit-dir-times"/>
<!--<arg value="-\-delete"/>-->
<arg line="-e ssh"/>
<arg line="products/"/>
<arg line="mholmes@nfs.hcmc.uvic.ca:/home1t/endings/www/"/>
</exec>
</target>
<target name="all">
<description> TARGET all
This target runs all the processes defined elsewhere in the file. </description>
<antcall target="clean"/>
<antcall target="buildCss"/>
<antcall target="buildHtml"/>
<antcall target="copyRequiredFiles"/>
<antcall target="validateSite"/>
</target>
</project>