You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2007/08/29 17:20:12 UTC

svn commit: r570833 - in /forrest/trunk/whiteboard/forrest2/core/tools/ivy: build-scripts/ build-scripts/common-ivy.xml build-scripts/common-java.xml build-scripts/common-webapp.xml ivyconf.xml readme.txt

Author: rgardler
Date: Wed Aug 29 08:20:12 2007
New Revision: 570833

URL: http://svn.apache.org/viewvc?rev=570833&view=rev
Log:
Some utility scripts for working with ivy repos

Added:
    forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/
    forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-ivy.xml   (with props)
    forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-java.xml   (with props)
    forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-webapp.xml   (with props)
    forrest/trunk/whiteboard/forrest2/core/tools/ivy/ivyconf.xml   (with props)
    forrest/trunk/whiteboard/forrest2/core/tools/ivy/readme.txt   (with props)

Added: forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-ivy.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-ivy.xml?rev=570833&view=auto
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-ivy.xml (added)
+++ forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-ivy.xml Wed Aug 29 08:20:12 2007
@@ -0,0 +1,90 @@
+<?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 xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+
+    <property file="${ivy.repository.dir}/build.properties"/>
+    <property file="${basedir}/local.build.properties" />
+    <property name="project.build.dir" location="build"/>
+    
+    <target name="configure">
+        <ivy:configure file="${ivy.repository.dir}/ivyconf.xml" />
+    </target>
+    
+    <target name="resolve" depends="configure, clean-lib" description="--> retrieve dependencies with ivy">
+        <ivy:resolve />
+    </target>
+    
+    <target name="report" depends="resolve" description="--> generates a report of dependencies">
+        <ivy:report todir="${build.dir}"/>
+    </target>
+    
+    <target name="new-version">
+        <propertyfile file="${basedir}/version.properties">
+            <entry  key="version" type="int" operation="+" default="0" />
+        </propertyfile>
+    </target>
+
+    <target name="check-version">
+        <!-- test existence of version file -->
+        <available file="${basedir}/version.properties" property="version.exists"/>
+    </target>
+
+    <target name="init-version" depends="check-version" unless="version.exists">
+        <!-- init version file if it doesn't exist -->
+        <echo message="version=1" file="${basedir}/version.properties" />
+    </target>
+
+    <target name="version" depends="init-version">
+        <!-- copy version file in classpath for later inclusion in jar -->
+        <mkdir dir="${project.build.classes.dir}"/>
+        <copy file="${basedir}/version.properties" tofile="${project.build.classes.dir}/${ant.project.name}.properties" overwrite="true" />
+        <property file="${project.build.classes.dir}/${ant.project.name}.properties" />
+    </target>
+
+    <target name="local-version">
+        <tstamp>
+            <format property="now" pattern="yyyyMMddHHmmss"/>
+        </tstamp>
+        <property name="revision" value="${now}"/>
+        <!-- used only to create a local version and put the corresponding file in the jar so that it will be displayed by the module -->
+        <mkdir dir="${project.build.classes.dir}"/>
+        <echo message="version=${revision}" file="${project.build.classes.dir}/${ant.project.name}.properties" append="false" />
+
+        <property file="${project.build.classes.dir}/${ant.project.name}.properties" />
+    </target>
+
+    <target name="clean-local" depends="configure" description="cleans the local repository for the current module">
+       <delete dir="${ivy.local.default.root}/${ant.project.name}"/>
+    </target>
+
+    <target name="clean-lib" description="--> clean the project libraries directory (dependencies)">
+        <delete includeemptydirs="true" dir="${project.lib.dir}"/>
+    </target>
+
+    <target name="clean-build" description="--> clean the project built files">
+        <delete includeemptydirs="true" dir="${project.build.dir}"/>
+    </target>
+
+    <target name="clean-dist" description="--> clean the project distribution files">
+        <delete includeemptydirs="true" dir="${dist.dir}"/>
+    </target>
+
+    <target name="clean" depends="clean-build, clean-lib" description="--> clean the project and reset version number">
+      <delete file="${basedir}/version.properties"/>
+    </target>
+</project>

Propchange: forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-java.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-java.xml?rev=570833&view=auto
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-java.xml (added)
+++ forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-java.xml Wed Aug 29 08:20:12 2007
@@ -0,0 +1,122 @@
+<?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 xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+
+    <import file="common-ivy.xml"/>
+
+    <property name="project.lib.dir" location="${project.webapp.dir}/WEB-INF/lib" />
+
+    <property name="project.core.src.dir" location="src/main" />
+    <property name="project.test.src.dir" location="src/test" />
+
+    <property name="project.build.classes.dir" location="${project.build.dir}/classes" />
+
+    <property name="compile.debug" value="off" />
+    
+    <property name="dist.dir" location="dist"/>
+    
+    <property name="jar.file" location="${dist.dir}/${ant.project.name}.jar"/>
+    
+    <path id="run.path.id">
+        <path refid="project.core.class.path" />
+        <path location="${project.build.classes.dir}" />
+    </path>
+    
+    <target name="init">
+        <available file="${project.core.src.dir}" property="project.core.src.dir.exists"/>
+        <available file="${project.test.src.dir}" property="project.test.src.dir.exists"/>
+        <ivy:cachepath pathid="project.core.class.path" conf="default" />
+        <ivy:cachepath pathid="project.test.class.path" conf="test" />
+    </target>
+    
+    <target name="compile-test" 
+        depends="compile-core" description="--> compile the project tests"
+        if="project.test.src.dir.exists">
+        <echo>Compiling test files in ${project.test.src.dir}</echo>
+        <mkdir dir="${project.build.classes.dir}" />
+        <javac destdir="${project.build.classes.dir}" debug="${compile.debug}" classpathref="project.test.class.path">
+            <src path="${project.test.src.dir}" />
+        </javac>
+        
+        <echo>Copying resources from test source directory</echo>
+        <copy todir="${project.build.classes.dir}">
+            <fileset dir="${project.test.src.dir}">
+                <exclude name="**.java" />
+            </fileset>
+        </copy>
+        
+        <antcall target="post-compile-test"/>
+    </target>
+    
+    <target name="post-compile-test" description="Run after compile-test. Intended to be overridden if your project needs any post compile processing"/>
+    
+    <target name="compile-core" 
+        depends="resolve, init" description="--> compile the project"
+        if="project.core.src.dir.exists">
+        <echo>Compiling files in ${project.core.src.dir}</echo>
+        <mkdir dir="${project.build.classes.dir}" />
+        <javac destdir="${project.build.classes.dir}" debug="${compile.debug}" classpathref="project.core.class.path">
+            <src path="${project.core.src.dir}" />
+        </javac>
+        
+        <echo>Copying resources from source directory</echo>
+        <copy todir="${project.build.classes.dir}">
+            <fileset dir="${project.core.src.dir}">
+                <exclude name="**.java" />
+            </fileset>
+        </copy>
+        
+        <antcall target="post-compile-core"/>
+    </target>
+    
+    <target name="post-compile-core" description="Run after compile-core. Intended to be overridden if your project needs any post compile processing"/>
+        
+    <target name="run" depends="version, compile-core" description="--> compile and run the project">
+        <java classpathref="run.path.id" classname="${main.class.name}"/>
+    </target>
+    
+    <target name="jar" depends="clean-dist, version, compile-core" description="--> make a jar file for this project">
+        <mkdir dir="${dist.dir}"/>
+        <jar destfile="${jar.file}">
+            <fileset dir="${project.build.classes.dir}"/>
+        </jar>
+    </target>
+    
+    <target name="deliver">
+      <ivy:deliver/>
+    </target>
+    
+    <target name="publish" depends="clean-build, new-version, jar, deliver" description="--> publish this project in the ivy repository">
+        <property name="revision" value="${version}"/>
+        <ivy:publish
+           artifactspattern="[artifact].[ext]"
+           resolver="shared"
+        />
+        <echo message="project ${ant.project.name} released with version ${revision}" />
+    </target>
+
+    <target name="publish-local" depends="clean-dist, local-version, jar, deliver" description="--> publish this project in the local ivy repository">
+        <delete file="${build.dir}/ivy.xml"/> <!-- delete last produced ivy file to be sure a new one will be generated -->
+        <ivy:publish resolver="local"
+            artifactspattern="${dist.dir}/[artifact].[ext]"
+            forcedeliver="true"
+        />
+        <echo message="project ${ant.project.name} published locally with version ${revision}" />
+    </target>
+
+</project>

Propchange: forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-java.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-webapp.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-webapp.xml?rev=570833&view=auto
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-webapp.xml (added)
+++ forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-webapp.xml Wed Aug 29 08:20:12 2007
@@ -0,0 +1,56 @@
+<?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 xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+
+    <property name="project.webapp.dir" location="src/webapp" />
+    <property name="project.lib.dir" location="lib" />
+
+    <property name="serveltEngine.webapp.dir" location="C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps" />
+
+    <path id="project.core.class.path">
+        <fileset dir="${project.lib.dir}">
+            <include name="*.jar" />
+        </fileset>
+    </path>
+    
+    <import file="common-java.xml"/>
+    
+    <target name="deploy-webapp" depends="compile-core">
+        <copy todir="${serveltEngine.webapp.dir}/${ant.project.name}/WEB-INF/classes">
+            <fileset dir="${project.build.classes.dir}" />
+        </copy>
+        
+        <copy todir="${serveltEngine.webapp.dir}/${ant.project.name}">
+            <fileset dir="${project.webapp.dir}" />
+        </copy>
+        
+        <ivy:retrieve/>
+        <copy todir="${serveltEngine.webapp.dir}/${ant.project.name}/WEB-INF/lib">
+            <fileset dir="${project.lib.dir}" />
+        </copy>
+        
+        <antcall target="post-deploy-webapp"/>
+    </target>
+
+    <target name="post-deploy-webapp"/>
+
+    <target name="undeploy-webapp">
+        <delete dir="${serveltEngine.webapp.dir}/${ant.project.name}" />
+    </target>
+
+</project>

Propchange: forrest/trunk/whiteboard/forrest2/core/tools/ivy/build-scripts/common-webapp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: forrest/trunk/whiteboard/forrest2/core/tools/ivy/ivyconf.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/tools/ivy/ivyconf.xml?rev=570833&view=auto
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/tools/ivy/ivyconf.xml (added)
+++ forrest/trunk/whiteboard/forrest2/core/tools/ivy/ivyconf.xml Wed Aug 29 08:20:12 2007
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  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.
+-->
+<ivyconf>
+    <property name="local.repo.dir" value="${ivy.conf.dir}/repository" />
+    <property name="ibiblio-maven2-root"
+        value="http://www.ibiblio.org/maven2/" />
+    <property name="ibiblio-maven2-pattern"
+        value="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" />
+
+    <conf defaultResolver="default" />
+    <resolvers>
+        <chain name="default" returnFirst="true">
+            <filesystem name="local">
+                <ivy
+                    pattern="${local.repo.dir}/[organisation]/[module]/ivy-[revision].xml" />
+                <artifact
+                    pattern="${local.repo.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[type]" />
+            </filesystem>
+            <ibiblio name="apache-snapshot" m2compatible="true"
+                root="http://people.apache.org/repo/m2-snapshot-repository/" />
+            <ibiblio name="maven2" m2compatible="true"
+                root="http://repo1.maven.org/maven2/" />
+            <ibiblio name="apache-incubating" m2compatible="true"
+                root="http://people.apache.org/repo/m2-incubating-repository/" />
+            <ibiblio name="ibiblio-maven2" root="${ibiblio-maven2-root}"
+                pattern="${ibiblio-maven2-pattern}" m2compatible="true"/>
+        </chain>
+    </resolvers>
+</ivyconf>
\ No newline at end of file

Propchange: forrest/trunk/whiteboard/forrest2/core/tools/ivy/ivyconf.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: forrest/trunk/whiteboard/forrest2/core/tools/ivy/readme.txt
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/tools/ivy/readme.txt?rev=570833&view=auto
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/tools/ivy/readme.txt (added)
+++ forrest/trunk/whiteboard/forrest2/core/tools/ivy/readme.txt Wed Aug 29 08:20:12 2007
@@ -0,0 +1,107 @@
+The IVY repository project contains two sets of resources:
+
+1) a set of jars download by IVY
+2) a set of ANT scripts for IVY projects
+
+The jars downloadable by IVY are nothing more than a 
+standard IVY repository, so to make use of this you 
+ought to read the IVY documentation. The ANT scripts,
+however, require some introduction.
+
+ANT Scripts
+-----------
+
+There are a number of ANT scripts in the build-scripts directory
+these are intended to be imported by your project and provide
+a "standard" set of targets for working with projects of various
+types. Each of which will utilise this IVY repository to manage
+their dependencies.
+
+The scripts provided are hierarchical, that is each imports 
+another script "lower" in the hierarchy. This means that your
+project should only import one of these scripts. Each of the 
+scripts handles a single set of requirements for a specific
+type of project. Working from the lowest level of the hierarchy
+we have:
+
+common-ivy.xml
+--------------
+
+This build file provides the targets and configuration necessary
+for working with IVY repositories such as this one
+
+common-java.xml
+---------------
+
+Here we have targets needed to manage a typical Java project.
+
+This file imports the common-ivy.xml file.
+
+
+Your project may need to do some special processing for one
+or more of the targets in this build file. The following
+targets are intended to be overridden by your project build
+file for this purpose.
+
+- post-compile-core
+  This target is called after the compiation of core files. 
+  It should be used to handle  any non-standard compilation
+  tasks. For example, it may copy some resources into the 
+  classpath.
+
+common-webapp.xml
+---------------
+
+Here we have targets needed to manage a typical java web 
+application project.
+
+This file imports the common-java.xml file.
+
+Your project may need to do some special processing for one
+or more of the targets in this build file. The following
+targets are intended to be overridden by your project build
+file for this purpose.
+
+- post-deploy-webapp
+  This target is called after to the depoyment of webapp files
+  to the webap server. It should be used to handle 
+  any non-standard parts of the webapp. For example, it may 
+  copy some resources into the webapp folder.
+
+Project build.xml
+-----------------
+
+Your project build file should import one of the above common 
+build scripts. For example:
+
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="FOO" default="deploy-webapp">
+	<property file="build.properties"/>
+	<import file="${ivy.repository.dir}/build-scripts/common-webapp.xml"/>
+</project>
+
+At the very least your build.properties file will require the path to your
+ivy repository directory. Confusingly, this is not necessarily where the
+jar files are stored, but it is where the build files an ivyconf.xml file
+is located. For exampl:
+
+ivy.repository.dir=../tools/ivy
+
+Project ivy.xml
+---------------
+
+Your project must provide an ivy.xml file. For example:
+
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<ivy-module version="1.0">
+    <info organisation="SAAfE" module="org.saafe.model" revision="20070102000038" status="integration" publication="20070102000038">
+	</info>
+	<configurations>
+	  <conf name="default"/>
+	  <conf name="test" extends="default"/>
+	</configurations>
+	<publications>
+	  <artifact name="org.saafe.model" type="jar" ext="jar"/>
+	</publications>
+</ivy-module>
+

Propchange: forrest/trunk/whiteboard/forrest2/core/tools/ivy/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native