Skip to main content
summaryrefslogtreecommitdiffstats
blob: 6806bdab518af621cf08dff752c5e0acb8f56813 (plain) (blame)
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<project name="Construct Maven build command and run build" default="run">

	<target name="init">
		<property environment="env" />
		<property name="tab" value="     " />
	</target>

	<target name="get-inputs">
		<echo>--------------------------------------------------------------</echo>
		<echo>OSEE BUILD - Build Stage</echo>
		<echo>--------------------------------------------------------------</echo>
		<property name="input-arguments" value="all,all-ide,server,runtime,ote,osee-client,coverage,ats-client,products" />
		<input message="${tab}[input] Select build to perform?" validargs="${input-arguments}" defaultvalue="${default-osee-build-stage}" addproperty="input-osee-build-stage">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-osee-build-stage}]" />

		<switch value="${input-osee-build-stage}">
			<case value="all">
				<!--<property name="osee-build-stage" value="osee-all" />-->
				<property name="osee-build-directory" value="org.eclipse.osee.parent" />
			</case>
			<case value="all-ide">
				<property name="osee-build-stage" value="osee-all-ide" />
				<property name="osee-build-directory" value="org.eclipse.osee.ide.parent" />
			</case>
			<case value="server">
				<property name="osee-build-stage" value="osee-server" />
				<property name="osee-build-directory" value="org.eclipse.osee.x.parent" />
			</case>
			<case value="runtime">
				<property name="osee-build-stage" value="osee-client-runtime" />
				<property name="osee-build-directory" value="org.eclipse.osee.runtime.parent" />
			</case>
			<case value="ote">
				<property name="osee-build-stage" value="osee-ote-client" />
				<property name="osee-build-directory" value="org.eclipse.osee.ote.parent" />
			</case>
			<case value="osee-client">
				<property name="osee-build-stage" value="osee-client" />
				<property name="osee-build-directory" value="org.eclipse.osee.client.parent" />
			</case>
			<case value="coverage">
				<property name="osee-build-stage" value="osee-coverage-client" />
				<property name="osee-build-directory" value="org.eclipse.osee.coverage.parent" />
			</case>
			<case value="ats-client">
				<property name="osee-build-stage" value="osee-ats-client" />
				<property name="osee-build-directory" value="org.eclipse.osee.ats.parent" />
			</case>
			<case value="products">
				<property name="osee-build-stage" value="osee-client-products" />
				<property name="osee-build-directory" value="org.eclipse.osee.client.all.parent" />
			</case>
			<default>
				<echo message="Build stage[${input-osee-build-stage}] is not recognized." />
			</default>
		</switch>
		<var name="build-options" value=" " />
		<if>
			<isset property="osee-build-stage" />
			<then>
				<var name="build-options" value="${build-options}-Dosee-build-stage=${osee-build-stage}" />
			</then>
		</if>

		<echo>--------------------------------------------------------------</echo>
		<echo>OSEE BUILD - Build Options</echo>
		<echo>--------------------------------------------------------------</echo>

		<!-- ORG.ECLIPSE.IP -->
		<input message="${tab}[input] Build using REMOTE ORG.ECLIPSE.IP P2 Site?" validargs="y,n" defaultvalue="${default-build-with-remote-org-eclipse-ip}" addproperty="input-build-with-remote-org-eclipse-ip">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-build-with-remote-org-eclipse-ip}]" />
		<if>
			<equals arg1="${input-build-with-remote-org-eclipse-ip}" arg2="y" />
			<then>
				<input message="${tab}[input] Path to org.eclipse.ip P2 site?${line.separator}${tab}${tab}${tab}" defaultvalue="${default-org-eclipse-ip-site-path}" addproperty="input-org-eclipse-ip-site-path">
					<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
				</input>
				<var name="build-options" value="${build-options} -Declipse-ip-site=&quot;${input-org-eclipse-ip-site-path}&quot;" />
			</then>
		</if>
		
		<!--	SKIP HELP BUILD -->
		<input message="${tab}[input] Build OSEE Help?" validargs="y,n" defaultvalue="${default-build-osee-help}" addproperty="input-build-osee-help">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-build-osee-help}]" />
		<if>
			<equals arg1="${input-build-osee-help}" arg2="n" />
			<then>
				<var name="build-options" value="${build-options} -Dosee-create-help-docs=false -Dskip-help-tests=true" />
			</then>
		</if>

		<!--	SKIP PRODUCT BUILD -->
		<input message="${tab}[input] Build OSEE RCP Product (slows down build)?" validargs="y,n" defaultvalue="${default-build-rcp-ide-product}" addproperty="input-build-rcp-ide-product">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-build-rcp-ide-product}]" />
		<if>
			<equals arg1="${input-build-rcp-ide-product}" arg2="n" />
			<then>
				<var name="build-options" value="${build-options} -Dskip-osee-client-all-product" />
			</then>
		</if>

		<!--	STATIC ANALYSIS -->
		<input message="${tab}[input] Perform Static Analysis?" validargs="y,n" defaultvalue="${default-static-analysis}" addproperty="input-static-analysis">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-static-analysis}]" />
		<if>
			<equals arg1="${input-static-analysis}" arg2="y" />
			<then>
				<var name="build-options" value="${build-options} -Dwith-static-analysis" />
			</then>
		</if>

		<!--	COVERAGE -->
		<input message="${tab}[input] Perform Code Coverage Analysis?" validargs="y,n" defaultvalue="${default-coverage-analysis}" addproperty="input-coverage-analysis">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-coverage-analysis}]" />
		<if>
			<equals arg1="${input-coverage-analysis}" arg2="y" />
			<then>
				<var name="build-options" value="${build-options} -Dwith-code-coverage" />
			</then>
		</if>

		<echo>--------------------------------------------------------------</echo>
		<echo>OSEE BUILD - Maven Options</echo>
		<echo>--------------------------------------------------------------</echo>
		<!--	 LIFECYCLE PHASE -->
		<input message="${tab}[input] Maven lifecycle phase?" defaultvalue="${default-maven-lifecycle}" addproperty="input-maven-lifecycle">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<property name="maven-goal" value="${input-maven-lifecycle}" />

		<echo message="${tab}${tab}Selected: [${maven-goal}]" />

		<!--	DEBUG OPTIONS -->
		<input message="${tab}[input] Maven options (-X -e)?" defaultvalue="${default-maven-options}" addproperty="input-maven-options">
			<handler classname="org.apache.tools.ant.input.DefaultInputHandler" />
		</input>
		<echo message="${tab}${tab}Selected: [${input-maven-options}]" />
		<if>
			<isset property="input-maven-options" />
			<then>
				<var name="build-options" value="${input-maven-options} ${build-options}" />
			</then>
		</if>

		<!--	UPDATE CODE QUALITY STATS -->
		<!--<input message="     [input] Upload code quality data after build [default: n]?" validargs="y,n" addproperty="input-sonar-analysis" />
				 SONAR:  run-sonar -->
		<!--	-Dmaven.test.skip=true -->
		<!-- JAVADOC Generation: allow-javadoc -->

		<property name="maven-options" value="${build-options}" />
		<property name="pom-directory" value="${repository-base}/plugins/${osee-build-directory}" />
	</target>

	<target name="load-settings">
		<property name="custom-settings" value="${store-settings-dir}/custom-settings.properties" />
		<if>
			<not>
				<available file="${custom-settings}" />
			</not>
			<then>
				<mkdir dir="${store-settings-dir}" />
				<copy file="${default-settings-file}" tofile="${custom-settings}" />
			</then>
		</if>
		<loadproperties taskname="load-settings" srcfile="${custom-settings}" />
	</target>

	<target name="save-settings">
		<propertyfile taskname="save-settings" file="${custom-settings}" comment="OSEE Build Last Values Selected">
			<entry key="default-osee-build-stage" value="${input-osee-build-stage}" />
			<entry key="default-build-with-remote-org-eclipse-ip" value="${input-build-with-remote-org-eclipse-ip}" />
			<entry key="default-org-eclipse-ip-site-path" value="${input-org-eclipse-ip-site-path}" />
			<entry key="default-build-osee-help" value="${input-build-osee-help}" />
			<entry key="default-build-rcp-ide-product" value="${input-build-rcp-ide-product}" />
			<entry key="default-static-analysis" value="${input-static-analysis}" />
			<entry key="default-coverage-analysis" value="${input-coverage-analysis}" />
			<entry key="default-maven-lifecycle" value="${input-maven-lifecycle}" />
			<entry key="default-maven-options" value="${input-maven-options}" />
		</propertyfile>
	</target>

	<target name="execute-build">
		<echo>--------------------------------------------------------------</echo>
		<echo>OSEE BUILD - Execute</echo>
		<echo>--------------------------------------------------------------</echo>
		<echo>Maven Goal: [${maven-goal}]</echo>
		<echo>Maven Options: [${maven-options}]</echo>
		<echo>Maven Parent Directory: [${pom-directory}]</echo>
		<echo>Maven Command: [mvn ${maven-goal}${maven-options}]</echo>
		<echo>--------------------------------------------------------------</echo>
		<echo />
		<maven basedir="${pom-directory}" options="${maven-options}" goal="${maven-goal}" resultproperty="maven.build.result" />
	</target>

	<!-- *************************************************************** -->
	<!--   MAIN                                                          -->
	<!-- *************************************************************** -->
	<target name="run" depends="init,load-settings,get-inputs,save-settings,execute-build" />

	<!-- *************************************************************** -->
	<!--   MAVEN MACRO                                                   -->
	<!-- *************************************************************** -->
	<macrodef name="maven">
		<attribute name="options" default="" />
		<attribute name="goal" />
		<attribute name="basedir" />
		<attribute name="resultproperty" default="maven.result" />
		<element name="args" implicit="true" optional="true" />
		<sequential>
			<echo message="MAVEN HOME: [${maven.home}]" />
			<!--<echo message="MAVEN OPTS: [${env.MAVEN_OPTS}]" />-->
			<echo message="POM Directory: [@{basedir}]" />

			<java taskname="mvn" newenvironment="false" classname="org.codehaus.classworlds.Launcher" fork="true" dir="@{basedir}" resultproperty="@{resultproperty}">
				<syspropertyset>
					<propertyref prefix="javax.net.ssl" />
				</syspropertyset>
				<classpath>
					<fileset dir="${maven.home}/boot">
						<include name="*.jar" />
					</fileset>
					<fileset dir="${maven.home}/lib">
						<include name="*.jar" />
					</fileset>
				</classpath>
				<sysproperty key="classworlds.conf" value="${maven.home}/bin/m2.conf" />
				<sysproperty key="maven.home" value="${maven.home}" />
				<arg line="--batch-mode @{options} @{goal}" />
			</java>
		</sequential>
	</macrodef>

</project>

Back to the top