forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r506768 - in /forrest/branches/ivyBuild/tools/ivy/build-scripts: ./ common-ivy.xml common-java.xml common-webapp.xml
Date Tue, 13 Feb 2007 00:41:07 GMT
Author: rgardler
Date: Mon Feb 12 16:41:06 2007
New Revision: 506768

URL: http://svn.apache.org/viewvc?view=rev&rev=506768
Log:
Some example/utility build scripts

Added:
    forrest/branches/ivyBuild/tools/ivy/build-scripts/
    forrest/branches/ivyBuild/tools/ivy/build-scripts/common-ivy.xml
    forrest/branches/ivyBuild/tools/ivy/build-scripts/common-java.xml
    forrest/branches/ivyBuild/tools/ivy/build-scripts/common-webapp.xml

Added: forrest/branches/ivyBuild/tools/ivy/build-scripts/common-ivy.xml
URL: http://svn.apache.org/viewvc/forrest/branches/ivyBuild/tools/ivy/build-scripts/common-ivy.xml?view=auto&rev=506768
==============================================================================
--- forrest/branches/ivyBuild/tools/ivy/build-scripts/common-ivy.xml (added)
+++ forrest/branches/ivyBuild/tools/ivy/build-scripts/common-ivy.xml Mon Feb 12 16:41:06 2007
@@ -0,0 +1,92 @@
+<?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>

Added: forrest/branches/ivyBuild/tools/ivy/build-scripts/common-java.xml
URL: http://svn.apache.org/viewvc/forrest/branches/ivyBuild/tools/ivy/build-scripts/common-java.xml?view=auto&rev=506768
==============================================================================
--- forrest/branches/ivyBuild/tools/ivy/build-scripts/common-java.xml (added)
+++ forrest/branches/ivyBuild/tools/ivy/build-scripts/common-java.xml Mon Feb 12 16:41:06
2007
@@ -0,0 +1,121 @@
+<?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="publish" depends="clean-build, new-version, jar" description="-->
publish this project in the ivy repository">
+        <property name="revision" value="${version}"/>
+    	<ivy:publish
+    	   artifactspattern="[artifact].[ext]"
+           resolver="shared"
+           pubrevision="${revision}" 
+    	/>
+        <echo message="project ${ant.project.name} released with version ${revision}"
/>
+    </target>
+
+    <target name="publish-local" depends="clean-dist, local-version, jar" 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]"
+    		pubrevision="${revision}"
+    		forcedeliver="true"
+			pubdate="${now}"
+    	/>
+        <echo message="project ${ant.project.name} published locally with version ${revision}"
/>
+    </target>
+
+</project>

Added: forrest/branches/ivyBuild/tools/ivy/build-scripts/common-webapp.xml
URL: http://svn.apache.org/viewvc/forrest/branches/ivyBuild/tools/ivy/build-scripts/common-webapp.xml?view=auto&rev=506768
==============================================================================
--- forrest/branches/ivyBuild/tools/ivy/build-scripts/common-webapp.xml (added)
+++ forrest/branches/ivyBuild/tools/ivy/build-scripts/common-webapp.xml Mon Feb 12 16:41:06
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>



Mime
View raw message