1<project name="Publish Build" default="default">
2
3<!-- Properties that must be passed to this script:
4	buildDirectory: Path to perform the build in.  (A working directory)
5	buildType:		Type of build (nightly, integration etc.)
6	buildId:		Build name
7	buildLabel:		<buildType>-<buildName>-<timestamp>
8-->
9<property name="result" value="${buildDirectory}/${buildLabel}" />
10
11<!--name of generated index page-->
12<property name="indexFileName" value="index.html" />
13
14<target name="default">
15	<antcall target="countFiles" />
16	<antcall target="generateIndex" />
17	<antcall target="getStaticFiles" />
18</target>
19	
20<target name="generateIndex">
21 
22  <property name="class" value="org.eclipse.releng.generators.TestResultsGenerator" />
23  <taskdef name="indexResults" classname="${class}" />
24   
25<!--
26	isBuildTested:  true|false  should JUnit plugin test results be used to generate index page
27	dropTokenList:  comma separated list of strings which should be replaced by the fileName attribute settings in the testManifest.xml.
28	xmlDirectoryName:  path to directory containing JUnit plugin test results in xml format (see doc is org.eclipse.test).
29	dropDirectoryName: path to directory containing the result of the build.
30	testResultsTemplateFileName:  path to template file used to generate page with links to JUnit test results	
31	testResultsHtmlFileName:  name of file which will be generated with links to JUnit test results
32	dropHtmlFileName:  name of generated index page
33	hrefTestResultsTargetPath:  relative path from index page to directory containing JUnit html test results
34	hrefCompileLogsTargetPath:  relative path from index page directory containing compilelogs
35	testManifestFileName:	name of xml file containing descriptions of zip types and log files
36
37	
38	
39-->
40	
41	<property name="xmlDirectoryName" value="${result}/testresults/xml" />
42	<property name="dropDirectoryName" value="${result}" />
43	<property name="testResultsTemplateFileName" value="${basedir}/templateFiles/testResults.php.template" />
44	<property name="dropTemplateFileName" value="${basedir}/templateFiles/index.html.template" />
45	<property name="testResultsHtmlFileName" value="testResults.php" />
46	<property name="hrefTestResultsTargetPath" value="testresults/html" />
47	<property name="hrefCompileLogsTargetPath" value="compilelogs" />
48	<property name="compileLogsDirectoryName" value="${result}/compilelogs" />
49	<property name="testManifestFileName" value="${basedir}/testManifest.xml" />
50
51	
52  <indexResults 
53    isBuildTested="${isBuildTested}"
54    buildType="${buildType}"
55    dropTokenList="${dropTokenList}"
56  	platformIdentifierToken="${platformIdentifierToken}"
57  	platformSpecificTemplateList="${platformSpecificTemplateList}"
58    dropHtmlFileName="${indexFileName}"
59    xmlDirectoryName="${xmlDirectoryName}"
60    dropDirectoryName="${dropDirectoryName}"
61    testResultsTemplateFileName="${testResultsTemplateFileName}"
62    dropTemplateFileName="${dropTemplateFileName}"
63    testResultsHtmlFileName="${testResultsHtmlFileName}"
64    hrefTestResultsTargetPath="${hrefTestResultsTargetPath}"
65    hrefCompileLogsTargetPath="${hrefCompileLogsTargetPath}"
66    compileLogsDirectoryName="${compileLogsDirectoryName}"
67    testManifestFileName="${testManifestFileName}"
68  />
69
70	<tstamp>
71		<format property="TODAY" pattern="MMMM d, yyyy"/>
72	</tstamp>
73	
74  	<!--  Insert Build Type descriptor  -->
75  	<antcall target="${buildType}" />
76  	
77  	<!--  Insert Build Date  -->
78	<replace file="${result}/${indexFileName}" token="@date@" value="${TODAY}"/>
79	<replace dir="${result}" value="${TODAY}">
80	  <include name="**/*.php"/>
81	  <replacetoken><![CDATA[@date@]]></replacetoken>
82	</replace>
83	
84  	<!--  Insert Build Name  -->
85	<replace file="${result}/${indexFileName}" token="@build@" value="${buildId}"/>
86	<replace dir="${result}" value="${buildId}">
87	  <include name="**/*.php"/>
88	  <replacetoken><![CDATA[@build@]]></replacetoken>
89	</replace>
90
91
92  	<!--  Update timestamp on file to permit overwrite through Ant copy task  -->
93	<touch file="${result}/${indexFileName}" />
94	<touch>
95	    <fileset dir="${result}">
96	    	<include name="**/*.php"/>
97	    </fileset>
98	</touch>
99		
100</target>
101
102
103<target name="getStaticFiles">
104	<!--get static files required in the buildLabel directory-->
105	<copy todir="${result}">
106		<fileset dir="staticDropFiles" />
107	</copy>
108	
109	<!--copy buildnotes from plugin directories-->
110	<mkdir dir="${result}/buildnotes" />
111	<copy todir="${result}/buildnotes" flatten="true">
112		<fileset dir="${buildDirectory}/plugins" includes="**/buildnotes_*.html" />
113	</copy>
114</target>
115
116<target name="countFiles">
117<!--	files.count is a file that should exist in the drop directory with a count of the zip files in the same directory.
118		It is required to generate a link to the build on the downloads page.
119 -->
120 <taskdef name="countFiles" classname="org.eclipse.releng.generators.FileCounter" />
121 
122	<countFiles 
123		sourceDirectory="${result}"
124		filterString=".zip,.tar.gz"
125		outputFile="${result}/files.count"
126	/>
127	
128</target>
129
130<!--Build type descriptors-->
131<target name="I">
132	<replace file="${result}/${indexFileName}" token="@type@" value="Integration"/>
133	<replace dir="${result}" value="Integration">
134	  <include name="**/*.php"/>
135	  <replacetoken><![CDATA[@type@]]></replacetoken>
136	</replace>
137</target>
138	
139<target name="N">
140	<replace file="${result}/${indexFileName}" token="@type@" value="Nightly"/>
141	<replace dir="${result}" value="Nightly">
142	  <include name="**/*.php"/>
143	  <replacetoken><![CDATA[@type@]]></replacetoken>
144	</replace>
145</target>
146	
147<target name="M">
148	<replace file="${result}/${indexFileName}" token="@type@" value="Maintenance"/>
149	<replace dir="${result}" value="Maintenance">
150	  <include name="**/*.php"/>
151	  <replacetoken><![CDATA[@type@]]></replacetoken>
152	</replace>
153</target>
154
155<target name="R">
156	<replace file="${result}/${indexFileName}" token="@type@" value="Release"/>
157	<replace dir="${result}" value="Release">
158	  <include name="**/*.php"/>
159	  <replacetoken><![CDATA[@type@]]></replacetoken>
160	</replace>
161</target>
162	
163<target name="S">
164	<replace file="${result}/${indexFileName}" token="@type@" value="Stable"/>
165	<replace dir="${result}" value="Stable">
166	  <include name="**/*.php"/>
167	  <replacetoken><![CDATA[@type@]]></replacetoken>
168	</replace>
169</target>
170
171<target name="T">
172	<replace file="${result}/${indexFileName}" token="@type@" value="Test"/>
173	<replace dir="${result}" value="Test">
174	  <include name="**/*.php"/>
175	  <replacetoken><![CDATA[@type@]]></replacetoken>
176	</replace>
177</target>
178	
179</project>