-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstandalone.xml
148 lines (124 loc) · 6 KB
/
standalone.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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="Browser-History-Histogram" default="netbeans" basedir=".">
<description>Running Browser History Histogram as a standalone application.
Please run ant -buildfile standalone.xml main
</description>
<property name="projectName" value="Browser-History-Histogram" />
<property name="src.dir" location="src/main" />
<property name="resources.dir" location="src/resources" />
<property name="build.dir" location="build/bin" />
<property name="dist.dir" location="build/dist" />
<property name="dist.lib.dir" location="build/dist/lib" />
<property name="lib.ext.dir" value="release/modules/ext" />
<property name="lib.main.dir" value="release/zlib" />
<property name="main-class" value="main.pt.ipleiria.estg.dei.labcif.bhh.Main" />
<!-- ivy to get dependencies and copy to project lib folder automatically -->
<target name="resolve" description="retrieve dependencies with ivy">
<ivy:retrieve />
</target>
<!-- install ivy -->
<target name="ivy" description="Install ivy">
<mkdir dir="${user.home}/.ant/lib" />
<get dest="${user.home}/.ant/lib/ivy.jar"
src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.4.0-rc1/ivy-2.4.0-rc1.jar" />
</target>
<!-- ivy end -->
<target name="init">
<mkdir dir="${build.dir}" />
</target>
<!-- external libraries classpath, we don't need sources and javadoc -->
<path id="classpath">
<fileset dir="${basedir}/">
<include name="${lib.main.dir}/*.jar" />
<include name="${lib.ext.dir}/*.jar" />
<exclude name="${lib.ext.dir}/*sources.jar"/>
<exclude name="${lib.main.dir}/*sources.jar"/>
<exclude name="${lib.ext.dir}/*javadoc.jar"/>
<exclude name="${lib.main.dir}/*javadoc.jar"/>
</fileset>
</path>
<!-- To work with external libraries, need classpath to compile -->
<target name="compile" depends="init" description="compile the source ">
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath" />
</target>
<target name="copy-resources">
<copy todir="${build.dir}/resources">
<fileset dir="${resources.dir}" /><!-- from -->
</copy>
</target>
<target name="copy-extras">
<copy todir="${build.dir}/main">
<fileset dir="${src.dir}" includes="**/*.xml,**/*.properties,**/*.txt,**/*.ico,**/*.form"/>
</copy>
</target>
<!-- constructs the external libraries classpath name -->
<pathconvert property="classpath.name" pathsep=" ">
<path refid="classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*.jar" to="lib/*.jar" />
</chainedmapper>
</mapper>
</pathconvert>
<target name="copy-dependencies">
<copy todir="${dist.lib.dir}">
<fileset dir="${lib.ext.dir}" includes="**/*.jar" excludes="**/*sources.jar, **/*javadoc.jar" />
<fileset dir="release/zlib" includes="**/*.jar" excludes="**/*sources.jar, **/*javadoc.jar" />
</copy>
<jar jarfile="${dist.lib.dir}/all/dependencies-all.jar">
<zipgroupfileset dir="${lib.ext.dir}">
<include name="**/*.jar" />
</zipgroupfileset>
<zipgroupfileset dir="release/zlib">
<include name="**/*.jar" />
</zipgroupfileset>
</jar>
</target>
<!-- jar it, and declares the ext libraries in manifest.mf file -->
<target name="jar" depends="compile, copy-dependencies, copy-resources, copy-extras" description="package, output to JAR">
<echo message="classpath.name : ${classpath.name} " />
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.lib.dir}" />
<jar jarfile="${dist.dir}/${projectName}.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
</manifest>
<zipfileset src="${dist.lib.dir}/all/dependencies-all.jar"
excludes="META-INF/*.SF" />
</jar>
</target>
<target name="clean" description="clean up">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- Default, run this -->
<target name="main" depends="clean, compile, jar" />
<target name="run" depends="clean, compile, jar, main">
<java jar="${dist.dir}/${projectName}.jar" fork="true"/>
</target>
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<property name="ivy.install.version" value="2.1.0-rc2" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
</project>