summaryrefslogtreecommitdiffstats
path: root/build.xml
blob: 34c195756564d03c9232bf1ac781f30b2383200b (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
<?xml version="1.0" encoding="UTF-8"?>
<project name="gitblit" default="main" basedir=".">

	<!-- Project Properties -->
	<property name="project.jar" value="gitblit.jar" />
	<property name="project.mainclass" value="com.gitblit.Launcher" />
	<property name="distribution.zipfile" value="gitblit.zip" />
	<property name="project.build.dir" value="${basedir}/build" />

	<target name="main">

		<!-- Compile the build tool and execute it.
			 This downloads missing compile-time dependencies from Maven. -->

		<delete dir="${project.build.dir}" />
		<mkdir dir="${project.build.dir}" />
		<javac srcdir="${basedir}/src" destdir="${project.build.dir}">
			<include name="com/gitblit/Build.java" />
			<include name="com/gitblit/Constants.java" />
		</javac>
		<java classpath="${project.build.dir}" classname="com.gitblit.Build" />

		<!-- Compile Project -->
		<path id="master-classpath">
			<fileset dir="${basedir}/lib">
				<include name="*.jar" />
			</fileset>
			<fileset dir="${basedir}/ext">
				<include name="*.jar" />
			</fileset>
		</path>
		<javac destdir="${project.build.dir}">
			<src path="${basedir}/src" />
			<src path="${basedir}/contrib" />
			<classpath refid="master-classpath" />
		</javac>
		<copy todir="${project.build.dir}">
			<fileset dir="${basedir}/src" excludes="**/*.java,**/thumbs.db" />
		</copy>

		<!-- Build jar -->
		<delete file="${project.jar}" />
		<jar index="true" jarfile="${project.jar}">
			<fileset dir="${project.build.dir}">
				<include name="**/*" />
			</fileset>
			<manifest>
				<attribute name="Main-Class" value="${project.mainclass}" />
			</manifest>
			<indexjars>
				<fileset dir="${basedir}/lib" />
			</indexjars>
		</jar>

		<!-- Delete the deploy folder -->
		<delete dir="${basedir}/deploy" />

		<!-- Create deployment folder structure -->
		<mkdir dir="${basedir}/deploy" />
		<copy todir="${basedir}/deploy" file="${project.jar}" />
		<copy todir="${basedir}/deploy/lib">
			<fileset dir="${basedir}/lib">
				<include name="**/*.jar" />
			</fileset>
		</copy>
		<copy todir="${basedir}/deploy">
			<fileset dir="${basedir}/service">
				<include name="**/*" />
			</fileset>
			<fileset dir="${basedir}">
				<include name="*.cmd" />
				<include name="*.properties" />
			</fileset>
		</copy>

		<!-- Create Zip deployment -->
		<zip destfile="${distribution.zipfile}">
			<fileset dir="${basedir}/deploy">
				<include name="**/*" />
			</fileset>
		</zip>

		<!-- Delete the deploy folder -->
		<delete dir="${basedir}/deploy" />

		<!-- Cleanup builds -->
		<delete>
			<fileset dir="${basedir}">
				<include name="${project.jar}" />
			</fileset>
		</delete>
	</target>
</project>