[jbosstools-commits] JBoss Tools SVN: r23374 - trunk/build/results.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jul 12 15:56:57 EDT 2010


Author: nickboldt
Date: 2010-07-12 15:56:57 -0400 (Mon, 12 Jul 2010)
New Revision: 23374

Added:
   trunk/build/results/build.xml
Log:
new results page generator (tested, working)

Copied: trunk/build/results/build.xml (from rev 23373, trunk/build/results/buildResults.xml)
===================================================================
--- trunk/build/results/build.xml	                        (rev 0)
+++ trunk/build/results/build.xml	2010-07-12 19:56:57 UTC (rev 23374)
@@ -0,0 +1,165 @@
+<project default="build.results">
+
+	<property name="output.dir" value="${basedir}" />
+
+	<!-- should be set by script or in Hudson -->
+	<property name="ZIPSUFFIX" value="SNAPSHOT" />
+
+	<!-- should be set by Hudson -->
+	<!-- <property name="JOB_NAME" value="jbosstools-3.2.0.M2.continuous" /> -->
+
+	<condition property="WORKINGDIR" value="/home/hudson/static_build_env/jbds/tools/sources" else="${basedir}/../..">
+		<available file="/home/hudson/static_build_env/jbds" type="dir" />
+	</condition>
+
+	<mkdir dir="${WORKINGDIR}" />
+	<echo level="info">WORKINGDIR = ${WORKINGDIR}</echo>
+
+	<condition property="COMMON_TOOLS" value="/home/hudson/static_build_env/jbds/tools">
+		<available file="/home/hudson/static_build_env/jbds" type="dir" />
+	</condition>
+	<condition property="COMMON_TOOLS" value="${WORKINGDIR}/../tools" else="${java.io.tmpdir}">
+		<available file="${WORKINGDIR}/../tools" type="dir" />
+	</condition>
+	<mkdir dir="${COMMON_TOOLS}" />
+	<echo level="info">COMMON_TOOLS = ${COMMON_TOOLS}</echo>
+
+	<condition property="build.xml" value="/home/hudson/static_build_env/jbds/tools/sources/build/build.xml">
+		<available file="/home/hudson/static_build_env/jbds/tools/sources/build/build.xml" type="file" />
+	</condition>
+	<condition property="build.xml" value="${basedir}/../../build/build.xml">
+		<available file="${basedir}/../../build/build.xml" type="file" />
+	</condition>
+	<condition property="build.xml" value="${basedir}/../../build.xml">
+		<available file="${basedir}/../../build.xml" type="file" />
+	</condition>
+	<!-- if can't calculate where build/build.xml is located, must pass in path from parent when calling this script -->
+
+	<target name="init">
+		<ant antfile="${build.xml}" target="init" />
+
+		<macrodef name="get.size">
+			<attribute name="file" />
+			<attribute name="property" />
+			<sequential>
+				<var name="size" unset="true" />
+				<var name="size-in-mb" unset="true" />
+				<if>
+					<available file="@{file}" />
+					<then>
+						<length file="@{file}" property="size" />
+						<math result="size-in-mb">
+							<op op="/">
+								<op op="floor">
+									<op op="*">
+										<op op="/">
+											<num value="${size}" />
+											<num value="1048576" />
+										</op>
+										<num value="100" />
+									</op>
+								</op>
+								<num value="100" />
+							</op>
+						</math>
+
+						<property name="@{property}" value="${size-in-mb}" />
+					</then>
+					<else>
+						<property name="@{property}" value="-1" />
+					</else>
+				</if>
+			</sequential>
+		</macrodef>
+		<taskdef resource="net/sf/antcontrib/antlib.xml">
+			<classpath>
+				<pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
+			</classpath>
+		</taskdef>
+	</target>
+
+	<target name="build.results" depends="init">
+		<!-- 
+			1. resolve variables in download-template.xml to produce download.xml
+			2. XSL transform download.xml to produce download.snippet.txt
+			3. manually copy the contents of this file into a page under 
+				http://www.jboss.org/tools/downloads/
+		-->
+		<for param="UPDATEZIP">
+			<path>
+				<fileset dir="${WORKINGDIR}/site">
+					<include name="*-Update-${ZIPSUFFIX}.zip" />
+					<include name="*-Sources-${ZIPSUFFIX}.zip" />
+				</fileset>
+			</path>
+			<sequential>
+				<var name="filename" unset="true" />
+				<propertyregex property="filename"
+				               input="@{UPDATEZIP}"
+				               defaultvalue="@{UPDATEZIP}"
+				               regexp=".+/([^/]+\.zip)"
+				               replace="\1"
+				               casesensitive="false"
+				               override="true"
+				/>
+				<propertyregex property="COMPONENT"
+				               input="${filename}"
+				               defaultvalue="${filename}"
+				               regexp="(.+)-(Update|Sources)-${ZIPSUFFIX}\.zip"
+				               replace="\1"
+				               casesensitive="false"
+				               override="true"
+				/>
+
+				<if>
+					<and>
+						<isset property="JOB_NAME" />
+						<equals arg1="${COMPONENT}" arg2="${JOB_NAME}" />
+					</and>
+					<then>
+						<if>
+							<equals arg1="${filename}" arg2="${JOB_NAME}-Sources-${ZIPSUFFIX}.zip" />
+							<then>
+								<var name="COMPONENT" unset="true" />
+								<var name="COMPONENT" value="sources" />
+							</then>
+							<elseif>
+								<equals arg1="${filename}" arg2="${JOB_NAME}-Update-${ZIPSUFFIX}.zip" />
+								<then>
+									<var name="COMPONENT" unset="true" />
+									<var name="COMPONENT" value="update" />
+								</then>
+							</elseif>
+						</if>
+					</then>
+				</if>
+
+				<echo level="verbose">UPDATEZIP = @{UPDATEZIP}
+COMPONENT = ${COMPONENT}</echo>
+				<property name="${COMPONENT}-filename" value="${filename}" />
+
+				<get.size file="@{UPDATEZIP}" property="${COMPONENT}-filesize" />
+
+				<!-- 
+				<var name="filesize" unset="true" />
+				<propertycopy from="${COMPONENT}-filesize" property="filesize" override="true" silent="true" />
+				<echo level="info">filesize =  ${filesize}</echo>
+				<echo level="info">filename =  ${filename}</echo>
+				<var name="filesize" unset="true" /> 
+				-->
+				<var name="filename" unset="true" />
+			</sequential>
+		</for>
+
+		<copy todir="${output.dir}" overwrite="true">
+			<fileset file="download-template.xml" />
+			<mapper type="merge" to="download.xml" />
+			<filterchain>
+				<expandproperties />
+			</filterchain>
+		</copy>
+		<xslt in="${output.dir}/download.xml" out="${output.dir}/download-snippet.txt" style="download.xsl" />
+		<delete file="${output.dir}/download.xml" />
+	</target>
+
+</project>


Property changes on: trunk/build/results/build.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list