Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
publish.xml 19.27 KiB
<project
    name="Publish Build"
    default="default"
    basedir=".">

	<!-- Properties that must be passed to this script:
        buildDirectory: Path to perform the build in.  (A working directory)
        buildType:		Type of build (nightly, integration etc.)
        buildId:		Build name
        buildLabel:		<buildType>-<buildName>-<timestamp>
    -->

    <property environment="env" />

	 <fail unless="buildDirectory" message="buildDirectory must be provided to publish" />
   <fail unless="buildLabel"     message="buildLabel must be provided to publish" />
	 <fail unless="wtp.builder.home" message="wtp.builder.home must be provided to publish" />
   <fail unless="build.distribution" message="build.distribution must be provided to publish" />

	<property
        name="resultDir"
        value="${buildDirectory}/${buildLabel}" />
	<!--name of generated index page-->
    <property
        name="indexFileName"
        value="index.php" />
    <property
        name="templateDir"
        value="${wtp.builder.home}/distribution/${build.distribution}.site" />
    <property
        name="resultingIndex"
        value="${resultDir}/${indexFileName}" />
    <echo
        level="debug"
        message="resultDir: ${resultDir}" />
    <echo
        level="debug"
        message="templateDir: ${templateDir}" />
    <echo
        level="debug"
        message="resultingIndex: ${resultingIndex}" />



    <target name="default">
        <copy
            overwrite="true"
            file="${wtp.builder.home}/distribution/${build.distribution}.site/templateFiles/${indexTemplateFilename}"
            tofile="${resultingIndex}" />
        <antcall target="countFiles" />
        <antcall target="generateCompileIndex" />
        <antcall target="generateJUnitTestsIndex" />
        <antcall target="getStaticFiles" />
    </target>

    <target name="generateCompileIndex">


		<!--
            <taskdef name="indexResults" classname="org.eclipse.wtp.releng.tools.ResultsSummaryGenerator" />
        -->

		<!--
            isBuildTested:  true|false  should JUnit plugin test results be used to generate index page
            dropTokenList:  comma separated list of strings which should be replaced by the fileName attribute settings in the testManifest.xml.
            xmlDirectoryName:  path to directory containing JUnit plugin test results in xml format (see doc is org.eclipse.test).
            dropDirectoryName: path to directory containing the result of the build.
            testResultsTemplateFileName:  path to template file used to generate page with links to JUnit test results	
            testResultsHtmlFileName:  name of file which will be generated with links to JUnit test results
            dropHtmlFileName:  name of generated index page
            hrefTestResultsTargetPath:  relative path from index page to directory containing JUnit html test results
            hrefCompileLogsTargetPath:  relative path from index page directory containing compilelogs
            testManifestFileName:	name of xml file containing descriptions of zip types and log files
            
            
            
        -->
        <property
            file="${buildDirectory}/maps/${env.RELENG}/maps/dependencies.properties" />

		<!-- create tables of test plugin compiles first -->
        <antcall
            target="generateCompileOutput">
            <param
                name="outputDirectory"
                value="${resultDir}/testcompilelogs" />
        </antcall>

		<!-- create table of code plugins compiles -->
        <summarizeResults
            isBuildTested="false"
            includeAll="true"
            dropTokenList="${dropTokenList}"
            xmlDirectoryName=""
            dropDirectoryName="${resultDir}"
            testResultsTemplateFileName="${templateDir}/templateFiles/compileResults.php.template"
            testResultsHtmlFileName="compileResults.php"
            hrefTestResultsTargetPath="testResults/html"
            hrefCompileLogsTargetPath="compilelogs"
            compileLogsDirectoryName="${resultDir}/compilelogs" />
        <xslt
            basedir="${resultDir}/compilelogs"
            destdir="${resultDir}/compilelogs"
            includes="**/*.bin.xml"
            scanincludeddirectories="true"
            style="compilerXMLOutputToHTML.xsl"
            force="true" />
        <tstamp>
            <format
                property="TODAY"
                pattern="MMMM d, yyyy" />
        </tstamp>

		<!--  Insert Build Type descriptor  -->
        <antcall
            target="${buildType}" />
        <antcall
            target="writeData" />

		<!--  Update timestamp on file to permit overwrite through Ant copy task  -->
        <touch
            file="${resultingIndex}" />
    </target>
    <target
        name="generateCompileOutput"
        depends="checkIfCompileLogs"
        if="doCompileLogs">
        <summarizeResults
            isBuildTested="false"
            includeAll="true"
            dropTokenList="${dropTokenList}"
            xmlDirectoryName=""
            dropDirectoryName="${resultDir}"
            testResultsTemplateFileName="${templateDir}/templateFiles/testCompileResults.php.template"
            testResultsHtmlFileName="testCompileResults.php"
            hrefTestResultsTargetPath=""
            hrefCompileLogsTargetPath="testcompilelogs"
            compileLogsDirectoryName="${outputDirectory}" />
        <xslt
            basedir="${outputDirectory}"
            destdir="${outputDirectory}"
            includes="**/*.bin.xml"
            scanincludeddirectories="true"
            style="compilerXMLOutputToHTML.xsl"
            force="true" />
    </target>
    <target
        name="generateJUnitTestsIndex"
        depends="checkIfTested"
        if="doTests">

		<!--
            isBuildTested:  true|false  should JUnit plugin test results be used to generate index page
            dropTokenList:  comma separated list of strings which should be replaced by the fileName attribute settings in the testManifest.xml.
            xmlDirectoryName:  path to directory containing JUnit plugin test results in xml format (see doc is org.eclipse.test).
            dropDirectoryName: path to directory containing the result of the build.
            testResultsTemplateFileName:  path to template file used to generate page with links to JUnit test results	
            testResultsHtmlFileName:  name of file which will be generated with links to JUnit test results
            dropHtmlFileName:  name of generated index page
            hrefTestResultsTargetPath:  relative path from index page to directory containing JUnit html test results
            hrefCompileLogsTargetPath:  relative path from index page directory containing compilelogs
            testManifestFileName:	name of xml file containing descriptions of zip types and log files
            
            
            
        -->
        <property
            file="${buildDirectory}/maps/${env.RELENG}/maps/dependencies.properties" />

		<!-- create table of test plugin compiles first -->
		<!-- set isBuildTested to true for the "compile only" results -->
        <summarizeResults
            isBuildTested="true"
            dropTokenList="${dropTokenList}"
            dropDirectoryName="${resultDir}"
            xmlDirectoryName="${resultDir}/testResults/xml"
            testResultsTemplateFileName="${templateDir}/templateFiles/testResults.php.template"
            testResultsHtmlFileName="testResults.php"
            hrefTestResultsTargetPath="testResults/html"
            compileLogsDirectoryName="" />
        <tstamp>
            <format
                property="TODAY"
                pattern="MMMM d, yyyy" />
        </tstamp>

		<!--  Insert Build Type descriptor  -->
        <antcall
            target="${buildType}" />
        <antcall
            target="writeData" />

		<!--  Update timestamp on file to permit overwrite through Ant copy task  -->
        <touch
            file="${resultingIndex}" />
    </target>
    <target
        name="getStaticFiles">
		<!--get static files required in the buildLabel directory-->
        <copy
            todir="${resultDir}">
            <fileset
                dir="${templateDir}/staticDropFiles" />
        </copy>

		<!--copy buildnotes from plugin directories-->
        <mkdir
            dir="${resultDir}/buildnotes" />
        <copy
            todir="${resultDir}/buildnotes"
            flatten="true">
            <fileset
                dir="${buildDirectory}/plugins"
                includes="**/buildnotes_*.html" />
            <fileset
                dir="${buildDirectory}/features"
                includes="**/buildnotes_*.html" />
        </copy>
        <copy
            file="${templateDir}/staticDropFiles/logIndex.php"
            tofile="${resultDir}/testResults/consolelogs/full/logIndex.php" />
        <copy
            file="${templateDir}/staticDropFiles/logIndex.php"
            tofile="${resultDir}/testResults/consolelogs/testLogs/logIndex.php" />
        <copy
            file="${templateDir}/staticDropFiles/logIndex.php"
            tofile="${resultDir}/testResults/consolelogs/testSysErrorLogs/logIndex.php" />
    </target>
    <target
        name="updateSite">


		<!-- get our authored, tokenized site.xml file -->
        <copy
            file="${wtp.builder.home}/distribution/${build.distribution}.site/templateFiles/siteWTP.xml"
            tofile="${buildDirectory}/${buildLabel}/updateSite/site.xml"
            overwrite="true"
            failonerror="true" />
		<!-- get the ${buildDirectory}/finalPluginsVersions.properties, and 
            read as properties -->
		<!-- substitute property value for tokens -->
        <replace
            file="${buildDirectory}/${buildLabel}/updateSite/site.xml"
            propertyfile="${buildDirectory}/finalFeaturesVersions.properties">
            <replacefilter
                token="@org.eclipse.wst@"
                property="org.eclipse.wst" />
            <replacefilter
                token="@org.eclipse.wst.sdk@"
                property="org.eclipse.wst.sdk" />
            <replacefilter
                token="@org.eclipse.jst@"
                property="org.eclipse.jst" />
            <replacefilter
                token="@org.eclipse.jst.sdk@"
                property="org.eclipse.jst.sdk" />
            <replacefilter
                token="@org.eclipse.jpt.feature@"
                property="org.eclipse.jpt.feature" />
            <replacefilter
                token="@org.eclipse.jpt_sdk.feature@"
                property="org.eclipse.jpt_sdk.feature" />
        </replace>
    </target>
    <target
        name="countFiles">
		<!--	
            files.count is a file that should exist in the drop directory with a count of the zip files in the same directory.
            It is required to generate a link to the build on the downloads page.
        -->
        <countBuildFiles
            sourceDirectory="${resultDir}"
            filterString=".zip,.tar.gz"
            outputFile="${resultDir}/files.count" />
    </target>

	<!--Build type descriptors-->
    <target
        name="I">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Integration" />
    </target>
    <target
        name="S">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Stable" />
    </target>
    <target
        name="N">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Nightly" />
    </target>
    <target
        name="M">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Maintenance" />
    </target>
    <target
        name="R">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Release" />
    </target>
    <target
        name="T">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Test" />
    </target>
    <target
        name="P">
        <replace
            file="${resultingIndex}"
            token="%wtpandprereqs%"
            value=" " />
        <replace
            file="${resultingIndex}"
            token="@type@"
            value="Patches" />
    </target>
    <target
        name="checkIfTested">
        <echo
            level="debug"
            message="isBuildTested: ${isBuildTested}" />
        <condition
            property="doTests">
            <equals
                arg1="${isBuildTested}"
                arg2="true"
                trim="true"
                casesensitive="false" />
        </condition>
    </target>
    <target
        name="checkIfCompileLogs">
        <condition
            property="doCompileLogs">
            <available
                file="${outputDirectory}" />
        </condition>
        <echo message="doCompileLogs: ${doCompileLogs)   outputDirectory: ${outputDirectory}" />
    </target>
    <target
        name="writeData">
		<!--  Insert Build Date  -->
        <replace
            file="${resultingIndex}"
            token="@date@"
            value="${TODAY}" />

		<!--  Insert Build Name  -->
        <replace
            file="${resultingIndex}"
            token="@build@"
            value="${buildLabel}" />
        <replace
            file="${resultingIndex}"
            token="@buildBranch@"
            value="${buildBranch}" />

		<!--  Insert PreRequsites  -->
        <replace
            file="${resultingIndex}"
            token="@eclipseFile@"
            value="${eclipse.file.linux-gtk-x86}" />
        <replace
            file="${resultingIndex}"
            token="@eclipseURL@"
            value="${eclipse.url}/${eclipse.file.linux-gtk-x86}" />
        <replace
            file="${resultingIndex}"
            token="@eclipseBuildURL@"
            value="${eclipse.url}" />
        <replace
            file="${resultingIndex}"
            token="@eclipsefilelinux@"
            value="${eclipse.file.linux-gtk-x86}" />
        <replace
            file="${resultingIndex}"
            token="@eclipsefilewindows@"
            value="${eclipse.file.win32-win32-x86}" />
        <replace
            file="${resultingIndex}"
            token="@eclipsefilemacos@"
            value="${eclipse.file.macosx-carbon-ppc}" />
        <replace
            file="${resultingIndex}"
            token="@eclipseBuildHome@"
            value="${eclipse.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@eclipse.mirror.prefixuri@"
            value="${eclipse.mirror.prefixuri}" />
        <replace
            file="${resultingIndex}"
            token="@eclipse.fspath.prefix@"
            value="${eclipse.fspath.prefix}" />
        <replace
            file="${resultingIndex}"
            token="@testURL@"
            value="${eclipseTestFramework.url}/${eclipseTestFramework.file}" />
        <replace
            file="${resultingIndex}"
            token="@testFile@"
            value="${eclipseTestFramework.file}" />
        <replace
            file="${resultingIndex}"
            token="@emfFile@"
            value="${emf.file}" />
        <replace
            file="${resultingIndex}"
            token="@emfURL@"
            value="${emf.url}/${emf.file}" />
        <replace
            file="${resultingIndex}"
            token="@emfBuildHome@"
            value="${emf.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@emf.mirror.prefixuri@"
            value="${emf.mirror.prefixuri}" />
        <replace
            file="${resultingIndex}"
            token="@wstFile@"
            value="${wst.file}" />
        <replace
            file="${resultingIndex}"
            token="@wstURL@"
            value="${wst.url}/${wst.file}" />
        <replace
            file="${resultingIndex}"
            token="@wstBuildHome@"
            value="${wst.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@wst.mirror.prefixuri@"
            value="${wst.mirror.prefixuri}" />
        <replace
            file="${resultingIndex}"
            token="@gefFile@"
            value="${gef.file}" />
        <replace
            file="${resultingIndex}"
            token="@gefURL@"
            value="${gef.url}/${gef.file}" />
        <replace
            file="${resultingIndex}"
            token="@gefBuildHome@"
            value="${gef.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@gef.mirror.prefixuri@"
            value="${gef.mirror.prefixuri}" />
        <replace
            file="${resultingIndex}"
            token="@eclipserelengFile@"
            value="${eclipsereleng.file}" />
        <replace
            file="${resultingIndex}"
            token="@eclipserelengURL@"
            value="${eclipsereleng.url}/${eclipsereleng.file}" />
        <replace
            file="${resultingIndex}"
            token="@orbitthirdpartyzipFile@"
            value="${orbitthirdpartyzip.file}" />
        <replace
            file="${resultingIndex}"
            token="@orbitthirdpartyzipURL@"
            value="${orbitthirdpartyzip.url}/${orbitthirdpartyzip.file}" />
        <replace
            file="${resultingIndex}"
            token="@orbitthirdpartyzipBuildHome@"
            value="${orbitthirdpartyzip.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@orbitthirdpartyzip.mirror.prefixuri@"
            value="${orbitthirdpartyzip.mirror.prefixuri}" />


		<!-- no longer used. Post 1.5.5 -->
        <replace
            file="${resultingIndex}"
            token="@jemFile@"
            value="${jem.file}" />
        <replace
            file="${resultingIndex}"
            token="@jemURL@"
            value="${jem.url}/${jem.file}" />
        <replace
            file="${resultingIndex}"
            token="@jemBuildHome@"
            value="${jem.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@jem.mirror.prefixuri@"
            value="${jem.mirror.prefixuri}" />
		<!-- 
            these token/s should not exist in maintenance stream, but 
            do no harm done, so in the interests of keeping builder 
            streams in sync, we'll leave them here as place hold
        -->
        <replace
            file="${resultingIndex}"
            token="@dtpFile@"
            value="${dtp.file}" />
        <replace
            file="${resultingIndex}"
            token="@dtpURL@"
            value="${dtp.url}/${dtp.file}" />
        <replace
            file="${resultingIndex}"
            token="@dtpBuildHome@"
            value="${dtp.build.home}" />
        <replace
            file="${resultingIndex}"
            token="@dtp.mirror.prefixuri@"
            value="${dtp.mirror.prefixuri}" />
    </target>
</project>