Skip to main content
summaryrefslogblamecommitdiffstats
blob: 600789705c5b1e572bfdcac766349de3a8ded161 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                     
                    
 



                                                                                               



                                                                                
                                              
                                      
 



                                                                                             
                                                                                                    


                                                             
                                                                                    


                                                     
                                                                                    
                                                     

                    















                                                                    








                                                                                                   





































                                                                                                                                                
                                                                    


                                                                    
                                                                               
                                                                           









                                                                         
                                                         


                                                
                                                   


                                             
                                                                 


                                                    
                                                           



                                                                                                                   

                                                                                                   








                                                                         
                                                                                          









                                                                                              
                                                                                                                                       
                                                  
                                                                                        











                                                                                                           

                                                                                                           



                                 


                                                                







                                                                                                       
                                                                        


















                                                                                                                                         




                                                                                        
 


                                                  

                                                                             



                                  
                                                   
                                                                                  




                                                          








                                                                                

                                                      
                                            


                                                                                             
                                                  
                                                                        
                                                          
                                                         
                                                     
                                                                            



                                  



                                                                                  
                                                                                

                                               
                                                                                  



                                  

                                                                                  
                                                                                     


                                
                                                                                      


                                       
                                                                             


                                    

                                                                                           
                 


                                                                                               
          
<?xml version="1.0"?>
<project name="CDO">

	<condition property="properties.file" value="build.properties" else="local.properties">
		<isset property="server.build" />
	</condition>

	<condition property="mspec.file" value="build.mspec" else="local.mspec">
		<isset property="server.build" />
	</condition>

	<property file="${properties.file}" />
	<property environment="env" />

	<condition property="build.root" value="${env.WORKSPACE}" else="${basedir}/../build">
		<isset property="env.WORKSPACE" />
	</condition>

	<condition property="buckminster.loglevel" value="${env.BUCKMINSTER_LOGLEVEL}" else="DEBUG">
		<isset property="env.BUCKMINSTER_LOGLEVEL" />
	</condition>

	<condition property="site.pack200" value="${env.SITE_PACK200}" else="false">
		<isset property="env.SITE_PACK200" />
	</condition>

	<condition property="site.signing" value="${env.SITE_SIGNING}" else="false">
		<isset property="env.SITE_SIGNING" />
	</condition>

	<condition property="clean.tools" value="true">
		<equals arg1="${env.CLEAN_TOOLS}" arg2="true" />
	</condition>

	<condition property="clean.tp" value="true">
		<equals arg1="${env.CLEAN_TP}" arg2="true" />
	</condition>

	<condition property="clean.workspace" value="true">
		<equals arg1="${env.CLEAN_WORKSPACE}" arg2="true" />
	</condition>

	<condition property="clean.output" value="true">
		<equals arg1="${env.CLEAN_OUTPUT}" arg2="true" />
	</condition>

	<!-- Default properties intended to be overridden by entries in the above property file -->
	<property name="tools" location="${build.root}/tools" />
	<property name="result" location="${build.root}/result" />
	<property name="workspace" location="${result}/workspace" />
	<property name="targetPlatformPath" location="${result}/tp" />

	<property name="buckminster.output.root" location="${result}/output" />
	<property name="buckminster.output.temp" location="${result}/temp" />

	<!-- This macro executes the default application of an eclipse installation
			 that resides in the folder ${buildtools}/@app -->
	<macrodef name="eclipse.launch">
		<attribute name="app" />
		<element name="args" optional="true" />
		<sequential>
			<!-- We assume that the eclipse installation is beneath ${buildtools} -->
			<property name="@{app}.deploy.dir" value="${tools}/@{app}" />

			<!-- Find the Eclipse launcher and assing its location to the @{app}.launcher property -->
			<pathconvert property="@{app}.launcher">
				<first count="1">
					<sort>
						<fileset dir="${@{app}.deploy.dir}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar" />
						<reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
							<date />
						</reverse>
					</sort>
				</first>
			</pathconvert>

			<!-- Launch the eclipse application -->
			<java fork="true" jar="${@{app}.launcher}" dir="${@{app}.deploy.dir}" failonerror="true">
				<!-- Uncomment to debug <jvmarg value="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y"/> -->
				<args />
			</java>
		</sequential>
	</macrodef>

	<macrodef name="buckminster">
		<attribute name="command" />
		<attribute name="workspace" default="${workspace}" />
		<element name="globargs" optional="true" />
		<element name="cmdargs" optional="true" />
		<sequential>
			<eclipse.launch app="buckminster">
				<args>
					<jvmarg value="-Dbugfix.288796=true" />
					<jvmarg value="-Xmx1024m" />
					<arg value="-data" />
					<arg value="@{workspace}" />
					<arg value="--loglevel" />
					<arg value="${buckminster.loglevel}" />
					<arg value="--displaystacktrace" />
					<globargs />
					<arg value="@{command}" />
					<arg value="-P" />
					<arg value="${properties.tmp}" />
					<cmdargs />
				</args>
			</eclipse.launch>
		</sequential>
	</macrodef>

	<target name="init.clean.tools" if="clean.tools">
		<antcall target="clean.tools" />
	</target>

	<target name="init.clean.tp" if="clean.tp">
		<antcall target="clean.tp" />
	</target>

	<target name="init.clean.workspace" if="clean.workspace">
		<antcall target="clean.workspace" />
	</target>

	<target name="init.clean.output" if="clean.output">
		<antcall target="clean.output" />
	</target>

	<target name="init.checks" depends="init.clean.tools,init.clean.tp,init.clean.workspace,init.clean.output">
		<available file="${tools}/director/director" property="director.exists" />
		<available file="${tools}/buckminster/buckminster" property="buckminster.exists" />
	</target>

	<target name="get.director" unless="director.exists">
		<echo message="Fetching headless director application" />
		<tempfile destdir="${java.io.tmpdir}"
		          prefix="director-"
		          suffix=".zip"
		          property="director.zip"
		          deleteonexit="true" />
		<get src="${eclipse.downloads}/${director.path}" dest="${director.zip}" />
		<mkdir dir="${tools}" />
		<unzip src="${director.zip}" dest="${tools}" />
		<delete file="${director.zip}" />
	</target>

	<target name="install.buckminster" unless="buckminster.exists" depends="get.director">
		<echo message="Configuring headless buckminster with needed features" />
		<eclipse.launch app="director">
			<args>
				<jvmarg value="-Declipse.p2.mirrors=false" />
				<jvmarg value="-Dorg.eclipse.update.jarprocessor.pack200=${org.eclipse.update.jarprocessor.pack200}" />
				<arg value="-r" />
				<arg value="${eclipse.downloads}/${bm.headless.path}" />
				<arg value="-d" />
				<arg value="${tools}/buckminster" />
				<arg value="-p" />
				<arg value="Buckminster" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.cmdline.product" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.core.headless.feature.feature.group" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.pde.headless.feature.feature.group" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.cvs.headless.feature.feature.group" />
				<arg value="-i" />
				<arg value="org.eclipse.buckminster.emma.headless.feature.feature.group" />
			</args>
		</eclipse.launch>
	</target>

	<target name="init.workspace" unless="workspace.exists">
		<mkdir dir="${workspace}" />
	</target>

	<target name="init.build.properties">
		<!-- Echo relevant properties to a temporary file so that Buckminster can read them -->
		<tempfile destdir="${java.io.tmpdir}"
		          prefix="build-"
		          suffix=".properties"
		          deleteonexit="true"
		          property="properties.tmp" />
		<echo message="Properties file is: ${properties.tmp}" />
		<echoproperties destfile="${properties.tmp}">
			<!-- We don't want these. basedir in particular will cause problems if passed explicitly -->
			<propertyset negate="true">
				<propertyref name="basedir" />
				<propertyref name="eclipse.home" />
				<propertyref name="properties.tmp" />
				<propertyref name="line.separator" />
				<propertyref name="path.separator" />
				<propertyref prefix="ant." />
				<propertyref prefix="file." />
				<propertyref prefix="java." />
				<propertyref prefix="sun." />
				<propertyref prefix="user." />
			</propertyset>
		</echoproperties>
	</target>

	<target name="provision" depends="init.checks,init.workspace,install.buckminster,init.build.properties">
		<echo message="Importing projects into workspace ${workspace} and binaries into target platform ${targetPlatformPath}" />
		<buckminster command="setpref">
			<cmdargs>
				<arg value="targetPlatformPath=${targetPlatformPath}" />
			</cmdargs>
		</buckminster>

		<buckminster command="import">
			<cmdargs>
				<arg value="-P" />
				<arg value="${basedir}/${properties.file}" />
				<arg value="${basedir}/${mspec.file}" />
			</cmdargs>
		</buckminster>
	</target>

	<target name="site.p2" depends="provision">
		<echo message="Building all projects in workspace ${workspace}" />
		<buckminster command="build">
			<cmdargs>
				<arg value="--thorough" />
			</cmdargs>
		</buckminster>

		<echo message="Performing org.eclipse.emf.cdo.site#site.p2" />
		<buckminster command="perform">
			<cmdargs>
				<arg value="org.eclipse.emf.cdo.site#site.p2" />
			</cmdargs>
		</buckminster>
	</target>

	<target name="test" depends="site.p2">
		<echo message="Running JUnit tests" />
		<buckminster command="emma">
			<cmdargs>
				<arg value="-l" />
				<arg value="org.eclipse.emf.cdo.tests/CDO AllTests.launch" />
				<arg value="-o" />
				<arg value="${result}/testReport.xml" />
				<arg value="--terseXML" />
				<arg value="--flatXML" />
				<arg value="--xml" />
				<arg value="${result}/coverageReport.xml" />
			</cmdargs>
		</buckminster>
	</target>

	<target name="promote.sites" depends="provision">
		<echo message="Building all projects in workspace ${workspace}" />
		<buckminster command="build" />

		<echo message="Performing org.eclipse.emf.cdo.releng#promote" />
		<buckminster command="perform">
			<cmdargs>
				<arg value="org.eclipse.emf.cdo.releng#promote" />
			</cmdargs>
		</buckminster>
	</target>

	<target name="clean.tools">
		<delete dir="${tools}/director" failonerror="true" quiet="true" />
		<delete dir="${tools}/buckminster" failonerror="true" quiet="true" />
	</target>

	<target name="clean.tp">
		<delete dir="${targetPlatformPath}" failonerror="true" quiet="true" />
	</target>

	<target name="clean.workspace">
		<delete dir="${workspace}" failonerror="true" quiet="true" />
	</target>

	<target name="clean.output">
		<delete dir="${buckminster.output.temp}" failonerror="true" quiet="true" />
		<delete dir="${buckminster.output.root}" failonerror="true" quiet="true" />
	</target>

	<target name="clean.all" depends="clean.tools,clean.workspace,clean.tp,clean.output" />

</project>

Back to the top