<project name="org.eclipse.rcp.configuration" default="main">

	<target name="main" >
        <property name="product" value="${basedir}/config.product" />
        <property name="id" value="org.eclipse.pde.build.container.feature" />
        <property name="type" value="feature" />
		<property name="verify" value="false" />
		
		<!--
		<echo message="In buildConfiguration.xml"/>
		<echo message="basedir=${basedir}"/>
		<echo message="buildDirectory=${buildDirectory}"/>
		<echo message="buildConfig=${buildConfig}"/>
		<echo message="buildId=${buildId}"/>
		<echo message="product=${product}"/>
		<echo message="eclipse.pdebuild.scripts=${eclipse.pdebuild.scripts}"/>
		-->

		<path id="launcher.paths">
			<fileset dir="${reposource}" includes="plugins/org.eclipse.equinox.launcher*" />
			<!-- the built version of the org.eclipse.equinox.executable feature -->
			<dirset dir="${baseBuildPath}" includes="features/org.eclipse.equinox.executable*" />  
		</path>

		<!-- generate a feature based on our .product file -->
		<ant antfile="${eclipse.pdebuild.scripts}/productBuild/productBuild.xml" target="generateFeature" >
			<property name="nestedInclusions" value="false" />
			<property name="buildDirectory" value="${basedir}/temp"/>
		</ant>
		<!-- generate product build scripts for the generated feature -->
		<echo message="About to call generateScript with buildDirectory = ${basedir}/temp"/>
		<ant antfile="${eclipse.pdebuild.scripts}/genericTargets.xml" target="generateScript">
            <property name="buildDirectory" value="${basedir}/temp"/>
			<property name="baseLocation" value="" />
			<property name="transformedRepoLocation" value="" />
			<property name="pluginPath" refid="launcher.paths" />
			<property name="forceContextQualifier" value="${buildId}" />
        </ant>

		<!-- get the generate p2.inf that got generated with the above scripts --> 
		<move file="${basedir}/temp/features/org.eclipse.pde.build.container.feature/product/p2.inf" tofile="${basedir}/p2.inf" overwrite="true" />
		<replace file="${basedir}/p2.inf" token="@FLAVOR@" value="tooling" />
		
		<!-- publish the configuration feature with the generated p2.inf -->
		<replace file="${basedir}/feature.xml" token="@qualifier@" value="${buildId}" />
		<property name="buildDirectory" value="${baseBuildPath}"/>
		<eclipse.gatherFeature
			metadataRepository="file:${reposource}"
			artifactRepository="file:${reposource}"
			buildResultFolder="${basedir}"
			baseDirectory="${basedir}"
		/>
	</target>
</project>
