-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
167 lines (135 loc) · 6.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
160
161
162
163
164
165
166
167
<?xml version="1.0"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="dream"
default="main"
basedir=".">
<property name="src.dir" value="src" />
<property name="web.dir" value="war" />
<property name="target.dir" value="target" />
<property name="build.dir" value="${web.dir}/WEB-INF" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="resources.dir" value="${src.dir}/resources" />
<property name="lib.dir" value="${build.dir}/lib" />
<property name="base.transient.dir" value="${basedir}/build-transient-src" />
<property name="java.transient.dir" value="${base.transient.dir}/java" />
<property name="soy.src.dir" value="${resources.dir}/soy" />
<property name="soy.generated.dir" value="${java.transient.dir}/com/tqin/dream/soy/tmpl" />
<property name="soy.generated.package" value="com.tqin.dream.soy.tmpl" />
<property name="name" value="dream" />
<property file="build.properties" />
<property environment="env" />
<!--<path id="master-classpath">-->
<!--<fileset dir="${lib.dir}">-->
<!--<include name="*.jar" />-->
<!--</fileset>-->
<!--<pathelement path="${build.dir}" />-->
<!--</path>-->
<target name="info">
<echo>Hi! Welcome to classified Mission DREAM</echo>
</target>
<target name="init" description="Create project structure and timestamp">
<mkdir dir="${src.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${target.dir}" />
<tstamp>
<format property="now" pattern="yyyyMMddHHmmss" locale="en,US" />
</tstamp>
</target>
<target name="clean" description="Clean output directories">
<delete dir="${build.classes}" />
<delete dir="${base.transient.dir}" />
<delete dir="${target.dir}" />
</target>
<target name="clean-lib" description="delete library files">
<delete>
<fileset dir="${lib.dir}">
<include name="*" />
</fileset>
</delete>
</target>
<target name="resolve" description="retrieve dependencies with ivy">
<echo message="Getting dependencies..." />
<mkdir dir="${lib.dir}" />
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" />
<ivy:cachepath pathid="compile.path" conf="compile" />
<ivy:cachepath pathid="runtime.path" conf="runtime" />
<ivy:cachepath pathid="test.path" conf="test" />
</target>
<target name="compile" description="compile source" depends="init,resolve,generate-parseinfo-soy">
<mkdir dir="${build.classes}" />
<javac destdir="${build.classes}" source="${jdk.version}" target="${jdk.version}"
debug="true" includeantruntime="false" classpathref="compile.path">
<src path="${src.dir}" />
<src path="${soy.generated.dir}" />
<!--<classpath refid="master-classpath" />-->
</javac>
</target>
<target name="copy-resources" description="copy java resources (xml, properties)">
<copy todir="${build.classes}">
<fileset dir="${resources.dir}">
<include name="**/*.xml" />
<include name="**/*.properties" />
</fileset>
<fileset dir="${resources.dir}" includes="soy/**" />
</copy>
</target>
<target name="package" depends="clean,compile,copy-resources"
description="create war file for deployment">
<war destfile="${target.dir}/${name}.war" needxmlfile="false">
<webinf dir="${web.dir}/WEB-INF" />
<lib dir="${lib.dir}" />
<zipfileset dir="${web.dir}/resources" prefix="resources" />
</war>
</target>
<target name="deploy-war-to-tomcat" depends="package"
description="copy war file to webapps directory of local tomcat for deploy">
<copy file="${target.dir}/${name}.war" todir="${env.CATALINA_HOME}/webapps" />
</target>
<target name="main" depends="deploy-war-to-tomcat" />
<!--Below will be Soy Stuff-->
<fileset id="soy.src.files" dir="${soy.src.dir}" includes="**/*.soy"/>
<!--Generate Java parse info for given soy files-->
<macrodef name="m_generate-parseinfo-soy">
<attribute name="javaPackage" />
<attribute name="outputDirectory" />
<attribute name="inputFiles" />
<!--
fork: invoke a new JVM, dir: directory to invoke the JVM in,
@param javaPackage Java package of the generated source. must match outputDirectory
@param outputDirectory Target dir for Java output
@param inputFiles Soy source files
-->
<sequential>
<java classname="com.google.template.soy.SoyParseInfoGenerator" fork="true" failonerror="true" maxmemory="256m" dir=".">
<classpath refid="compile.path" />
<arg line="--javaClassNameSource filename" />
<arg line="--javaPackage @{javaPackage}" />
<arg line="--outputDirectory @{outputDirectory}" />
<arg line="--srcs @{inputFiles}" />
</java>
</sequential>
</macrodef>
<target name="check-soy-update">
<uptodate targetfile="${soy.generated.dir}" property="soy.uptodate">
<srcfiles refid="soy.src.files" />
</uptodate>
<condition property="skip.soy.parse">
<or>
<isset property="soy.uptodate" />
</or>
</condition>
</target>
<target name="generate-parseinfo-soy" depends="init,check-soy-update"
unless="skip.soy.parse">
<mkdir dir="${soy.generated.dir}" />
<pathconvert property="soyfiles" refid="soy.src.files" pathsep=" " />
<echo message="${soyfiles}" />
<m_generate-parseinfo-soy javaPackage="${soy.generated.package}"
outputDirectory="${soy.generated.dir}"
inputFiles="${soyfiles}" />
<touch datetime="${now}" pattern="yyyyMMddHHmmss" >
<dirset dir="${soy.generated.dir}" />
</touch>
</target>
</project>