forked from webdetails/cpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
219 lines (163 loc) · 8.19 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!--===========================================================================
This is the build file for the Community Dashboard Framework Plugin project.
This build file will use the common_build.xml file as the default build
process and should only override the tasks that need to differ from
the common build file.
See common_build.xml for more details
============================================================================-->
<project name="Community Plugin Framework" basedir="." default="jar"
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
This build file is used to create the CPF project
and works with the common_build.xml file.
</description>
<!-- Import the subfloor.xml file which contains all the default tasks -->
<import file="common_build.xml"/>
<!--<import file="build-res/subfloor.xml"/>-->
<!--
AS STATED ABOVE, THE ONLY TASKS THAT SHOULD EXIST IN THIS BUILD FILE ARE
THE TASKS THAT NEED TO DIFFER FROM THE DEFAULT IMPLEMENTATION OF THE TASKS
FOUND IN common_build.xml.
-->
<!-- Define the Sonar task if this hasn't been done in a common script -->
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="sonar-ant-task-1.3.jar" />
</taskdef>
<target name="compile.compile" depends="init" description="Performs the actual javac compile">
<javac destdir="${classes.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
fork="true"
source="${javac.source}"
target="${javac.target}">
<classpath>
<path refid="classpath"/>
</classpath>
<src path="${src.dir}"/>
</javac>
</target>
<property name="plugin.name"
value="cpf"
description="Name of the plugin"/>
<property name="resource.dir"
value="resources"
description="Name of the resource directory"/>
<property name="stage.dir"
value="${bin.dir}/stage"
description="Name of the resource directory"/>
<property name="samples.stage.dir"
value="${bin.dir}/stage-samples"
description="Name of the resource directory" />
<tstamp/>
<!-- Build the project.revision property -->
<property name="distribution.version" value="${project.stage}-${project.version}"/>
<echo>distribution.version = ${distribution.version}</echo>
<target name="dist" depends="clean,resolve,jar,source.jar,dist-plugin"/>
<target name="dist-compile" depends="jar,dist-plugin"/>
<property name="plugin.artifact.id" value="${plugin.name}"/>
<property name="plugin.zipfile" value="${plugin.artifact.id}-${distribution.version}.zip"/>
<property name="plugin.samples.zipfile" value="${plugin.artifact.id}-samples-${distribution.version}.zip"/>
<property name="plugin.solution.zipfile" value="${plugin.artifact.id}-solution-${distribution.version}.zip"/>
<!-- Add the target -->
<target name="check-sonar-props">
<available file="/home/tomcat/sonar.properties" property="sonar.props"/>
<echo>${sonar.props}</echo>
</target>
<target name="read-sonar-props" depends="check-sonar-props" if="sonar.props">
<echo>Prop file exists</echo>
<loadproperties srcFile="/home/tomcat/sonar.properties"/>
</target>
<target name="sonar" depends='read-sonar-props'>
<!-- list of mandatories Sonar properties -->
<property name="sonar.sources" value="${src.dir}" />
<!-- list of optional Sonar properties -->
<property name="sonar.binaries" value="${classes.dir}" />
<sonar:sonar key="pt.webdetails:CPF" version="${distribution.version}" xmlns:sonar="antlib:org.sonar.ant"/>
</target>
<target name="resolve"
depends="resolve-default, resolve-test, resolve-runtime, ivy.check-releasable"
description="Retrieves all the dependent libraries" />
<target name="resolve-runtime" depends="resolve-init">
<ivy:resolve file="ivy.xml" conf="runtime" />
<ivy:retrieve conf="runtime" pattern="runtime-lib/[module]-[revision](-[classifier]).[ext]" />
</target>
<!-- ================
Legacy Compat
================ -->
<target name="resolve-legacy" depends="resolve-init">
<ivy:resolve file="ivy.xml" conf="legacy" />
<ivy:retrieve conf="legacy" pattern="${lib.dir}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="dist-legacy" depends="clean,resolve-legacy,jar,dist-plugin"/>
<!-- ================= -->
<!--=======================================================================
dist
Creates a distribution of this project's plugin zip
====================================================================-->
<target name="dist-plugin" depends="jar" description="Creates a distribution">
<!-- delete and re-create the plugin dist folder tree -->
<mkdir dir="${stage.dir}"/>
<mkdir dir="${stage.dir}/${plugin.name}"/>
<mkdir dir="${stage.dir}/${plugin.name}/lib"/>
<!-- copy the plugin jar to the plugin dist lib folder -->
<copy todir="${stage.dir}/${plugin.name}/lib" overwrite="true">
<fileset dir="${dist.dir}">
<include name="${ivy.artifact.id}-${project.revision}.jar"/>
</fileset>
<fileset dir="${devlib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<!-- Copy the plugin.xml and any other files from the resource dir -->
<!-- <copy todir="${stage.dir}/${plugin.name}" overwrite="true">
<fileset dir="${resource.dir}">
<include name="**/*"/>
</fileset>
</copy>-->
<copy todir="${stage.dir}/${plugin.name}" overwrite="true">
<fileset dir="${basedir}">
<include name="readme.txt"/>
</fileset>
</copy>
<!-- create the version file -->
<tstamp/>
<property name="sequential.build.id" value="manual-${DSTAMP}"/>
<echo file="${stage.dir}/${plugin.name}/version.xml" message="<version branch='TRUNK' buildId='${sequential.build.id}'>${distribution.version}</version>"/>
<!-- create a zip file -->
<!-- <zip zipfile="${dist.dir}/${plugin.zipfile}"
basedir="${stage.dir}"
includes="cpf/**/*"
excludes="**/Thumbs.db"/>-->
<echo file="${dist.dir}/marketplace.xml"><version branch="TRUNK">
<version>${distribution.version}</version>
<name>Trunk</name>
<downloadUrl>http://ci.analytical-labs.com/job/Webdetails-CPF/lastSuccessfulBuild/artifact/dist/cpf-TRUNK-SNAPSHOT.zip</downloadUrl>
<samplesDownloadUrl>http://ci.analytical-labs.com/job/Webdetails-CPF/lastSuccessfulBuild/artifact/dist/cpf-samples-TRUNK-SNAPSHOT.zip</samplesDownloadUrl>
<description>Trunk Snapshot. Install at your own risk....</description>
<buildId>${sequential.build.id}</buildId>
</version> </echo>
</target>
<!--=======================================================================
publish-pentaho-nojar (override)
Publishes the jar and plugin zip package to the Maven repository
====================================================================-->
<target name="publish-pentaho-nojar"
depends="install-antcontrib,create-pom,ivy.deliver">
<ant antfile="common_build.xml" target="publish-pentaho-nojar"/>
<ivy:makepom ivyfile="package-ivy.xml" pomfile="plugin-pom.xml"/>
<!-- <ivy:makepom ivyfile="package-ivy.xml" pomfile="samples-pom.xml"/>
<ivy:makepom ivyfile="package-ivy.xml" pomfile="solution-pom.xml"/>-->
<!-- <replace file="plugin-pom.xml" token="jar" value="zip"/>-->
<replace file="plugin-pom.xml" token="%artifact-name%" value="${plugin.artifact.id}"/>
<antcall target="maven-publish-artifact">
<param name="publish.pomFile" value="plugin-pom.xml"/>
<param name="publish.file" value="${dist.dir}/${ivy.artifact.id}-${project.revision}.jar"/>
</antcall>
<!-- <replace file="samples-pom.xml" token="jar" value="zip"/>-->
<!-- <replace file="samples-pom.xml" token="%artifact-name%" value="${plugin.artifact.id}-samples"/>-->
<!-- <antcall target="maven-publish-artifact">
<param name="publish.pomFile" value="samples-pom.xml"/>
<param name="publish.file" value="${dist.dir}/${plugin.samples.zipfile}"/>
</antcall>-->
</target>
</project>