harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r527837 - in /harmony/enhanced/buildtest/trunk: build.xml download.xml parameters.xml
Date Thu, 12 Apr 2007 08:43:07 GMT
Author: smishura
Date: Thu Apr 12 01:43:06 2007
New Revision: 527837

URL: http://svn.apache.org/viewvc?view=rev&rev=527837
Log:
Add a set of targets to manage build-and-test infra dependencies

Added:
    harmony/enhanced/buildtest/trunk/download.xml
    harmony/enhanced/buildtest/trunk/parameters.xml
Modified:
    harmony/enhanced/buildtest/trunk/build.xml

Modified: harmony/enhanced/buildtest/trunk/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/trunk/build.xml?view=diff&rev=527837&r1=527836&r2=527837
==============================================================================
--- harmony/enhanced/buildtest/trunk/build.xml (original)
+++ harmony/enhanced/buildtest/trunk/build.xml Thu Apr 12 01:43:06 2007
@@ -23,18 +23,11 @@
         http://incubator.apache.org/harmony
     </description>
 
+    <import file="download.xml"/>
+
     <!--The cc.property file contains the nameand values of properties-->
     <property file="cc.properties" />
 
-
-    <!-- files we need -->
-    <property name="cc.filename" value="cruisecontrol-bin-2.5" />
-    <property name="junitjar.filename" value="ant-junit-1.6.5" />
-
-    <!-- where to fetch from -->
-    <property name="cc.location" value="http://umn.dl.sourceforge.net/sourceforge/cruisecontrol/"
/>
-    <property name="junitjar.location" value="http://mirrors.ibiblio.org/pub/mirrors/maven2/ant/ant-junit/1.6.5/"
/>
-
     <!-- where to assemble all the pieces -->
     <property name="target.dir" location="cc" />
     <mkdir dir="${target.dir}" />
@@ -168,29 +161,26 @@
          Main setup - download, unpack, checkout
          ========================================== -->
     <target name="setup" description="fetch and setup build/test/ci system"
-        depends="set.proxy,no.proxy">
-
-        <!-- get the version of CruiseControl unless we have the zip locally -->
-
-        <get src="${cc.location}${cc.filename}.zip" dest="${cc.filename}.zip" usetimestamp="true"
verbose="true" />
+        depends="set.proxy,no.proxy,download">
 
-        <get src="${junitjar.location}${junitjar.filename}.jar" dest="${junitjar.filename}.jar"
usetimestamp="true" verbose="true" />
+        <property name="cc.filename" location="${depends}/cruisecontrol_2.6.1/cruisecontrol.zip"
/>
+        <property name="junitjar.filename" value="${depends}/ant-junit-1.6.5/ant-junit-1.6.5.jar"
/>
 
         <!-- unzip it, rename, add ant-junit jar and cleanout the junk -->
 
-        <unzip src="${cc.filename}.zip" dest="." />
+        <unzip src="${cc.filename}" dest="." />
 
-        <move file="${cc.filename}" tofile="${target.dir}" />
+        <move file="cruisecontrol-bin-2.5" tofile="${target.dir}" />
 
         <delete dir="${target.dir}/projects/connectfour" includeEmptyDirs="true" verbose="false"
/>
         <delete dir="${target.dir}/logs/connectfour" includeEmptyDirs="true" verbose="false"
/>
         <delete file="${target.dir}/config.xml" />
         <delete file="${target.dir}/copyres.xml" />
 
-        <delete dir="${cc.filename}" includeEmptyDirs="true" verbose="false" />
+        <delete dir="cruisecontrol-bin-2.5" includeEmptyDirs="true" verbose="false" />
 
         <!-- copy the ant-junit jar to cc/lib -->
-        <copy file="${junitjar.filename}.jar" todir="${target.dir}/lib" />
+        <copy file="${junitjar.filename}" todir="${target.dir}/lib" />
 
         <copy todir="${target.dir}" flatten="yes">
             <fileset dir="config/xsl" />

Added: harmony/enhanced/buildtest/trunk/download.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/trunk/download.xml?view=auto&rev=527837
==============================================================================
--- harmony/enhanced/buildtest/trunk/download.xml (added)
+++ harmony/enhanced/buildtest/trunk/download.xml Thu Apr 12 01:43:06 2007
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+     
+         http://www.apache.org/licenses/LICENSE-2.0
+     
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License. 
+-->
+<project default="download">
+    <description>
+        Framework for managing project dependencies
+    </description>
+
+    <!-- temporary file to store intermediate results of iteration -->
+    <property name="tmp.file" value="tmp.txt" />
+
+    <!-- root directory for storing downloaded files -->
+    <property name="depends" value="depends" />
+
+    <!-- ============================
+        Entry point of the framework
+        ============================ -->
+    <target name="download"
+            depends="-setup-proxy"
+            description="Downloads dependencies">
+
+        <!-- default properties file -->
+        <property name="props.file" value="parameters.xml" />
+
+        <xmlproperty file="${props.file}" />
+
+        <!-- flash propertyset as string to file for iteration   -->
+        <!-- the string has the following format:                -->
+        <!--     "name1=file1, name2=file2 ..."                  -->
+        <propertyset id="tmp.id">
+            <propertyref regex="parameters\.external\..+\.file$" />
+            <regexpmapper from="parameters\.external\.(.+)\.file$" to="\1" />
+        </propertyset>
+        <property name="tmp.str" refid="tmp.id" />
+        <echo message="${tmp.str}" file="${tmp.file}" />
+
+        <!-- iterate over propertyset fetching required dependencies -->
+        <ant antfile="download.xml" target="-iterate" inheritall="false">
+            <propertyset>
+                <propertyref prefix="parameters.external" />
+            </propertyset>
+        </ant>
+
+        <delete file="${tmp.file}" />
+    </target>
+
+    <!-- ============================
+        Targets for iteration over propertyset of external dependencies
+        ============================ -->
+    <target name="-next" if="donext">
+        <!-- make ant iterate over propertyset:                 -->
+        <!-- load a name of dependency from temporary file and  -->
+        <!-- flash the rest of dependencies back to the file.   -->
+        <loadproperties srcfile="${tmp.file}">
+            <filterchain>
+                <tokenfilter>
+                    <replaceregex pattern="^([^=]+)=.*" replace="name=\1" />
+                </tokenfilter>
+            </filterchain>
+        </loadproperties>
+        <loadproperties srcfile="${tmp.file}">
+            <filterchain>
+                <tokenfilter>
+                    <replaceregex pattern="^[^=]+=[^,]+,? ?(.*)$"
+                                  replace="rest=\1" />
+                </tokenfilter>
+            </filterchain>
+        </loadproperties>
+        <echo message="${rest}" file="${tmp.file}" />
+
+        <!-- do download for the dependency -->
+        <fetch resource="${name}" />
+
+        <ant antfile="download.xml" target="-iterate" inheritall="false">
+            <propertyset>
+                <propertyref prefix="parameters.external" />
+            </propertyset>
+        </ant>
+    </target>
+
+    <target name="-iterate">
+        <!-- check if next iteration should be done -->
+        <condition property="donext">
+            <length file="${tmp.file}" length="0" when="greater" />
+        </condition>
+        <ant antfile="download.xml" target="-next" inheritAll="false">
+            <propertyset>
+                <propertyref prefix="parameters.external" />
+                <propertyref name="donext" />
+            </propertyset>
+        </ant>
+    </target>
+
+    <!-- ============================
+        Downloading dependencies 
+        ============================ -->
+    <macrodef name="fetch">
+        <attribute name="resource" />
+        <sequential>
+            <property name="url"
+                      value="${parameters.external.@{resource}.url}" />
+            <property name="dirlocation"
+                      location="${depends}/${parameters.external.@{resource}.dir}" />
+            <property name="filelocation"
+                      location="${dirlocation}/${parameters.external.@{resource}.file}" />
+            <available property="exists" type="file" file="${filelocation}" />
+            <condition property="md5"
+                       value="${parameters.external.@{resource}.md5}">
+                <isset property="parameters.external.@{resource}.md5" />
+            </condition>
+
+            <ant antfile="download.xml" target="-download" />
+        </sequential>
+    </macrodef>
+
+    <target name="-download" depends="-really-download,-check-md5" />
+
+    <target name="-really-download" unless="exists">
+        <mkdir dir="${dirlocation}" />
+        <get verbose="true"
+             usetimestamp="true"
+             src="${url}"
+             dest="${filelocation}" />
+    </target>
+
+    <target name="-check-md5" if="md5">
+        <checksum file="${filelocation}" property="cur.md5" />
+        <condition property="md5.verified" value="true">
+            <equals arg1="${cur.md5}" arg2="${md5}" />
+        </condition>
+        <fail unless="md5.verified">
+...
+
+File ${filelocation} has incorrect md5 checksum.  Expected:
+  ${md5}
+found:
+  ${cur.md5}
+
+            </fail>
+        <echo>Checksum verified for ${filelocation}</echo>
+    </target>
+
+    <!-- ============================
+        Set up the proxy
+        ============================ -->
+    <target name="-setup-proxy"
+            if="http.proxyHost"
+            description="Set up the proxy">
+        <echo>Setting up the proxy: ${http.proxyHost}:${http.proxyPort}</echo>
+        <setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" />
+    </target>
+</project>

Added: harmony/enhanced/buildtest/trunk/parameters.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/trunk/parameters.xml?view=auto&rev=527837
==============================================================================
--- harmony/enhanced/buildtest/trunk/parameters.xml (added)
+++ harmony/enhanced/buildtest/trunk/parameters.xml Thu Apr 12 01:43:06 2007
@@ -0,0 +1,17 @@
+<parameters>
+    <required/>
+    <optional/>
+    <external>
+        <ant-junit>
+            <dir>ant-junit-1.6.5</dir>
+            <file>ant-junit-1.6.5.jar</file>
+            <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/ant/ant-junit/1.6.5/ant-junit-1.6.5.jar</url>
+        </ant-junit>
+        <cc>
+            <dir>cruisecontrol_2.6.1</dir>
+            <file>cruisecontrol.zip</file>
+            <url>http://umn.dl.sourceforge.net/sourceforge/cruisecontrol/cruisecontrol-bin-2.5.zip</url>
+        </cc>
+    </external>
+</parameters>
+



Mime
View raw message