-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
159 lines (138 loc) · 7.14 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="NewsRack" default="help" basedir=".">
<description>
Build file for the NewsRack web application
</description>
<target name="help" description="Help">
<echo>
"ant build" compiles all Java files
"ant compile" compiles all Java files
"ant clean" removes all class files
"ant rebuild" rebuilds all class files (clean, compile)
"ant war" builds the war file
</echo>
</target>
<property file="build.properties"/>
<property name="tomcat" value="tomcat8" />
<property name="servlet-jar-dir" value="/usr/share/tomcat8" />
<property name="container.dir" value="/var/lib/${tomcat}/webapps" />
<property name="webapp.name" value="ROOT" /> <!-- override in build.properties -->
<property name="webapp.target.dir" location="${container.dir}/${webapp.name}" />
<property name="home" location="." />
<property name="srcdir" location="${home}/src" />
<property name="javadir" location="${srcdir}/newsrack" />
<property name="viewdir" location="${srcdir}/views" />
<property name="libdir" location="${home}/lib" />
<property name="webapp.config" location="${home}/config" />
<property name="webapp.resources" location="${home}/resources" />
<property name="builddir" location="${home}/build" />
<property name="wardir" location="${builddir}/${webapp.name}" />
<property name="webinf" location="${wardir}/WEB-INF/" />
<property name="classdir" location="${wardir}/WEB-INF/classes" />
<property name="compiler.optimize" value="false" />
<property name="compiler.debug" value="false" />
<property name="parser.dir" location="${javadir}/filter/parser" />
<uptodate property="parser.src.uptodate" srcfile="${parser.dir}/grammar.y" targetfile="${parser.dir}/NRLanguageParser.java" />
<uptodate property="scanner.src.uptodate" srcfile="${parser.dir}/scanner.l" targetfile="${parser.dir}/NRLanguageScanner.java" />
<!--
<uptodate property="legacy.parser.src.uptodate" srcfile="${parser.dir}/legacy/grammar.y" targetfile="${parser.dir}/legacy/NRLanguageParser.java" />
<uptodate property="legacy.scanner.src.uptodate" srcfile="${parser.dir}/legacy/scanner.l" targetfile="${parser.dir}/legacy/NRLanguageScanner.java" />
-->
<path id="build.classpath">
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${servlet-jar-dir}/lib/servlet-api.jar" />
</path>
<target name="beavertask" unless="beaver.available" description="creates Beaver Ant task">
<taskdef name="beaver" classname="beaver.comp.run.AntTask" classpath="${libdir}/beaver.jar"/>
<property name="beaver.available" value="yes"/>
</target>
<target name="jflextask" unless="jflex.available" description="creates JFlex Ant task">
<taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="${libdir}/JFlex.jar"/>
<property name="jflex.available" value="yes"/>
</target>
<target name="parser" unless="parser.src.uptodate" depends="beavertask" description="generate parser">
<beaver file="${parser.dir}/grammar.y" />
</target>
<target name="scanner" unless="scanner.src.uptodate" depends="jflextask,beavertask" description="generate scanner">
<jflex file="${parser.dir}/scanner.l" nobak="yes" />
</target>
<!--
<target name="legacy.parser" unless="legacy.parser.src.uptodate" depends="beavertask" description="generate parser">
<beaver file="${parser.dir}/legacy/grammar.y" />
</target>
<target name="legacy.scanner" unless="legacy.scanner.src.uptodate" depends="jflextask,beavertask" description="generate scanner">
<jflex file="${parser.dir}/legacy/scanner.l" nobak="yes" />
</target>
-->
<target name="compile" description="Compile all sources.">
<mkdir dir="${classdir}" />
<javac srcdir="${srcdir}"
destdir="${classdir}"
includes="newsrack/**"
debug="on"
excludes="**/attic/**,**/XML/**,**/NEW/**,**/old/**,**/test/**,**/db4o/**,**/sql.*/**,**/search/**,**/Zipped*">
<classpath refid="build.classpath" />
</javac>
</target>
<!-- "build" is an alias for "compile" -->
<!--
<target name="build" depends="parser,scanner,legacy.parser,legacy.scanner,compile" description="Compile all sources." />
-->
<target name="build" depends="parser,scanner,compile" description="Compile all sources." />
<target name="rebuild" depends="clean,build" description="Cleanly compiles all sources." />
<target name="prepare" description="Copies all necessary resources into the build dir">
<!-- First, copy over files from the current deployed webapp -->
<copy failonerror="false" todir="${wardir}/crawled.feeds" preservelastmodified="true"> <fileset dir="${webapp.target.dir}/crawled.feeds" /> </copy>
<copy failonerror="false" todir="${wardir}/rss" preservelastmodified="true"> <fileset dir="${webapp.target.dir}/rss" /> </copy>
<!-- Next, copy all other files to the build dir -->
<copy todir="${wardir}"> <fileset dir="${viewdir}" /> </copy>
<copy failonerror="false" todir="${wardir}/report"> <fileset dir="report"/> </copy>
<copy todir="${classdir}"> <fileset dir="${webapp.resources}"/> </copy>
<copy todir="${webinf}/lib">
<fileset dir="${libdir}">
<exclude name="**/attic/*" />
</fileset>
</copy>
<copy todir="${webinf}">
<fileset dir="${webapp.config}">
<exclude name="**/attic/*" />
</fileset>
</copy>
<copy todir="${classdir}">
<fileset dir="${srcdir}">
<exclude name="**/attic/*" />
<include name="**/*.properties" />
<include name="**/*.xml" />
<exclude name="**/rss.xml" />
</fileset>
</copy>
</target>
<target name="war" depends="build,prepare" description="Builds the war file">
<war destfile="${builddir}/${webapp.name}.war" webxml="${webinf}/web.xml"> <fileset dir="${wardir}" /> </war>
</target>
<target name="deploy" depends="war" description="Deploys the web application">
<copy file="${builddir}/${webapp.name}.war" todir="${container.dir}/" />
</target>
<target name="updateweb" description="Updates ftl files in the deployed app">
<copy todir="${container.dir}/${webapp.name}/"> <fileset dir="${viewdir}" /> </copy>
</target>
<target name="clean" description="Remove generated class and build files.">
<delete file="${parser.dir}/NRLanguageParser.java" />
<delete file="${parser.dir}/NRLanguageScanner.java" />
<!--
<delete file="${parser.dir}/legacy/NRLanguageParser.java" />
<delete file="${parser.dir}/legacy/NRLanguageScanner.java" />
-->
<delete file="${builddir}/${webapp.name}.war" />
<delete dir="${webinf}" />
</target>
<target name="all-clean" depends="clean" description="Remove all generated class and build files.">
<delete dir="${wardir}" />
</target>
<target name="urlrewrite-doc" depends="compile" description="UrlRewriteFilter validation and documenting">
<taskdef name="urlrewritedoc" classname="org.tuckey.web.filters.urlrewrite.UrlRewriteDocTask" />
<urlrewritedoc conf="${home}/config/urlrewrite.xml" dest="urlrewrite-conf-overview.html" />
</target>
</project>