-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
161 lines (135 loc) · 6.11 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="gitblit-tbacl-plugin" default="build" xmlns:mx="antlib:org.moxie">
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retrieve Moxie Toolkit
documentation @ http://gitblit-org.github.io/moxie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<property name="moxie.version" value="0.9.2" />
<property name="moxie.url" value="http://gitblit-org.github.io/moxie/maven" />
<property name="moxie.jar" value="moxie-toolkit-${moxie.version}.jar" />
<property name="moxie.dir" value="${user.home}/.moxie" />
<!-- Download Moxie from it's Maven repository to user.home -->
<mkdir dir="${moxie.dir}" />
<get src="${moxie.url}/com/gitblit/moxie/moxie-toolkit/${moxie.version}/${moxie.jar}"
dest="${moxie.dir}" skipexisting="true" verbose="true" />
<!-- Register Moxie tasks -->
<taskdef uri="antlib:org.moxie">
<classpath location="${moxie.dir}/${moxie.jar}" />
</taskdef>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Initialize Moxie and setup build properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="prepare">
<!-- Setup Ant build from build.moxie and resolve dependencies.
If it exists, build.properties is automatically loaded.
Explicitly set mxroot allowing CI servers to override the default. -->
<mx:init verbose="no" mxroot="${moxie.dir}" />
<property name="registry.directory" value="${basedir}/../gitblit-registry" />
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cleanup all build artifacts and directories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="clean" depends="prepare" description="Cleanup all build artifacts and directories">
<mx:clean />
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="compile" depends="prepare" description="compiles from source">
<mx:javac scope="compile" clean="true" />
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="build" depends="compile" description="builds the distribution">
<!-- Generate the plugin jar file stamped with the appropriate manifest atributes -->
<mx:jar includeResources="true" packageSources="true">
<manifest>
<attribute name="plugin-id" value ="${project.artifactId}" />
<attribute name="plugin-version" value="${project.version}" />
<attribute name="plugin-description" value ="${project.description}" />
<attribute name="plugin-provider" value="${project.organization}" />
<attribute name="plugin-class" value="${project.mainclass}" />
<attribute name="plugin-requires" value="${gitblit.version}" />
<attribute name="plugin-dependencies" value="" />
</manifest>
</mx:jar>
<!-- Unpack the built jar to a temporary folder -->
<property name="plugin.classes" value="${project.targetDirectory}/exploded" />
<unzip dest="${plugin.classes}" src="${project.targetDirectory}/${project.artifactId}-${project.version}.jar" />
<!-- Assemble the plugin zip file: classes in classes/ and dependencies in lib/ -->
<mx:zip>
<zipfileset prefix="classes/" dir="${plugin.classes}" />
<!--<zipgroupfileset prefix="classes/" file="${project.targetDirectory}/plugin.jar" /> -->
<dependencies prefix="lib/" />
</mx:zip>
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tag a new version and prepare for the next development cycle.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="tagRelease" depends="prepare" description="tag a new version and prepare for the next development cycle">
<!-- release -->
<property name="dryrun" value="false" />
<mx:version stage="release" dryrun="${dryrun}" />
<property name="project.tag" value="v${project.version}" />
<!-- commit build.moxie & releases.moxie (automatic) -->
<mx:commit showtitle="no">
<message>Prepare ${project.version} release</message>
<tag name="${project.tag}">
<message>${project.name} ${project.version} release</message>
</tag>
</mx:commit>
<!-- create the release process script -->
<mx:if>
<os family="windows" />
<then>
<!-- Windows PowerShell script -->
<!-- set-executionpolicy remotesigned -->
<property name="recipe" value="release_${project.version}.ps1" />
</then>
<else>
<!-- Bash script -->
<property name="recipe" value="release_${project.version}.sh" />
</else>
</mx:if>
<delete file="${recipe}" failonerror="false" quiet="true" verbose="false" />
<!-- Work-around for lack of proper ant property substitution in copy -->
<property name="dollar" value="$"/>
<copy file="release.template" tofile="${recipe}">
<filterset begintoken="${dollar}{" endtoken="}">
<filter token="project.artifactId" value="${project.artifactId}" />
<filter token="project.version" value="${project.version}" />
<filter token="project.commitId" value="${project.commitId}" />
<filter token="project.tag" value="${project.tag}" />
<filter token="project.directory" value="${basedir}" />
<filter token="registry.directory" value="${registry.directory}" />
</filterset>
</copy>
<chmod file="${recipe}" perm="ugo+rx" />
<!-- next cycle -->
<mx:version stage="snapshot" incrementNumber="incremental" dryrun="${dryrun}" />
<mx:commit showtitle="no">
<message>Reset build identifiers for next development cycle</message>
</mx:commit>
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build and deploy to the registry directory without tagging.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="release" depends="build">
<mx:deploy basedir="${registry.directory}" generateIndexPage="true" />
</target>
</project>