blob: b1ee9f43f3b2ef98781a882d1c16646ac99d5375 (
plain)
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
168
169
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="My Vaadin Hello World"
basedir="."
default="package-war">
<target name="configure">
<property file="${basedir}/src/main/resources/Application.properties"/>
<property name="main.dir" value="${basedir}/src/main" />
<property name="build.dir" value="${basedir}/build"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="src.dir" value="${main.dir}/java" />
<property name="web.dir" value="${main.dir}/WebContent"/>
<property name="resources.dir" value="${main.dir}/resources"/>
<property name="classes.dir" value="${build.dir}/WEB-INF/classes"/>
<property name="lib.dir" value="${build.dir}/WEB-INF/lib"/>
<property name="war.name" value="${app.name}-${app.version}.war"/>
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<property file="${basedir}/tomcat.properties"/>
<path id="cp.tomcat">
<fileset dir="${catalina.home}/bin">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef classpathref="cp.tomcat" resource="org/apache/catalina/ant/catalina.tasks" />
</target>
<target name="resolve" description="retrieve dependencies with Ivy">
<ivy:resolve file="ivy.xml" log="download-only"/>
<ivy:cachepath pathid="ivy.deps.server-side" conf="server-side" />
<ivy:cachepath pathid="ivy.deps.themes" conf="themes" />
<ivy:cachefileset setid="ivy.deps.server-side.fileset" conf="server-side"/>
</target>
<target name="ivy-report" depends="configure,resolve">
<ivy:report conf="server-side" organisation="ch.asynk" module="${app.name}"/>
</target>
<target name="clean" depends="configure" description="clean project">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete file="build.log" />
<delete file="test.log" />
<delete file="ivy-report.css" />
<delete>
<fileset dir="${basedir}" includes="ch.asynk-${app.name}-*"/>
</delete>
</target>
<target name="ctags" depends="configure">
<exec executable="ctags" failonerror="false">
<arg value="-R"/>
<arg value="--language-force=java"/>
<arg value="-f.tags"/>
<arg value="${src.dir}"/>
</exec>
</target>
<target name="-compile-theme" depends="configure,resolve">
<property name="theme.dir" value="${build.dir}/VAADIN/themes/${theme}" />
<delete dir="${theme.dir}"/>
<mkdir dir="${theme.dir}"/>
<java classname="com.vaadin.sass.SassCompiler" failonerror="yes" fork="true">
<classpath refid="ivy.deps.themes"/>
<jvmarg value="-Djava.awt.headless=true"/>
<arg value="-ignore-warnings:true"/>
<arg value="-compress:true"/>
<arg value="-minify:true"/>
<arg value="${web.dir}/VAADIN/themes/${theme}/styles.scss"/>
<arg value="${theme.dir}/styles.css"/>
</java>
</target>
<target name="compile-themes" description="compile application's themes">
<antcall target="-compile-theme">
<param name="theme" value="mytheme"/>
</antcall>
</target>
<target name="compile-server-side" description="compile server side components" depends="configure,resolve,ctags">
<record name="build.log" loglevel="verbose" action="start" />
<mkdir dir="${classes.dir}" />
<javac srcdir="${main.dir}"
destdir="${classes.dir}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
includeantruntime="false">
<classpath refid="ivy.deps.server-side"/>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-path"/>
<compilerarg value="-Xlint:-processing"/>
<compilerarg value="-Xmaxerrs"/>
<compilerarg value="10"/>
</javac>
</target>
<target name="compile.all" description="compile everything" depends="compile-server-side,compile-themes"/>
<target name="package-war" depends="compile.all">
<mkdir dir="${lib.dir}"/>
<copy todir="${lib.dir}" flatten="true">
<fileset refid="ivy.deps.server-side.fileset"/>
</copy>
<delete>
<fileset dir="${lib.dir}">
<include name="**/*-sources.jar"/>
<include name="**/*-javadoc.jar"/>
</fileset>
</delete>
<copy todir="${classes.dir}" flatten="true">
<fileset dir="${resources.dir}"/>
</copy>
<delete file="${dist.dir}/${war.name}"/>
<war destfile="${dist.dir}/${war.name}"
webxml="${web.dir}/WEB-INF/web.xml">
<classes dir="${classes.dir}" includes="**" />
<fileset dir="${web.dir}">
<patternset>
<include name="*.html" />
<include name="WEB-INF/lib/*" />
<include name="WEB-INF/*.xml" />
<include name="VAADIN/widgetsets/**/*" />
<include name="VAADIN/themes/**/fonts/**/*" />
<include name="VAADIN/themes/**/icons/**/*" />
<include name="VAADIN/themes/**/images/**/*" />
</patternset>
</fileset>
<fileset dir="${build.dir}">
<include name="WEB-INF/lib/*" />
<include name="VAADIN/themes/**/*" />
</fileset>
</war>
</target>
<!-- tomcat specific targets -->
<target name="remove" depends="configure" description="remove application on servlet container">
<undeploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
failonerror="false"/>
</target>
<target name="install" depends="package-war,remove" description="install application to servlet container">
<copy todir="/tmp" file="${dist.dir}/${war.name}"/>
<deploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
localWar="file://tmp/${war.name}"/>
<delete file="/tmp/${war.name}"/>
</target>
</project>
|