You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/07/27 11:51:12 UTC

svn commit: r560173 - /directory/studio/trunk/studio-build/build.xml

Author: pamarcelot
Date: Fri Jul 27 02:51:12 2007
New Revision: 560173

URL: http://svn.apache.org/viewvc?view=rev&rev=560173
Log:
Improved general build script by adding timestamps on documentation generation (help-eclipse, help-html and help-pdf tasks). Now the tasks are only run if the sources are not uptodate with a previous compilation.

Modified:
    directory/studio/trunk/studio-build/build.xml

Modified: directory/studio/trunk/studio-build/build.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-build/build.xml?view=diff&rev=560173&r1=560172&r2=560173
==============================================================================
--- directory/studio/trunk/studio-build/build.xml (original)
+++ directory/studio/trunk/studio-build/build.xml Fri Jul 27 02:51:12 2007
@@ -16,8 +16,8 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<project name="studio-build" default ="jar" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
-	
+<project name="studio-build" default="jar" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+
 	<!-- Setting standard project properties -->
 	<property name="src" value="${basedir}/src" />
 	<property name="src.main.java" value="${src}/main/java" />
@@ -32,65 +32,65 @@
 	<property name="target.html" value="${target}/html" />
 	<property name="target.pdf" value="${target}/pdf" />
 	<property name="lib.dir" value="${basedir}/lib" />
-	
+
 	<!-- Loading specific project, plugin or feature properties -->
 	<property file="${basedir}/project.properties" />
 	<property file="${basedir}/plugin.properties" />
 	<property file="${basedir}/feature.properties" />
-	
+
 
 	<!-- INSTALL-IVY TASK -->
 	<target name="install-ivy">
 		<!-- Installing Ivy -->
 		<path id="ivy.lib.path">
-			<fileset dir="../tools" includes="ivy.jar"/>
-		</path> 
-		<taskdef resource="fr/jayasoft/ivy/ant/antlib.xml" uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/> 
+			<fileset dir="../tools" includes="ivy.jar" />
+		</path>
+		<taskdef resource="fr/jayasoft/ivy/ant/antlib.xml" uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path" />
 		<!-- Configuring Ivy -->
-		<property name="repository.dir" location="../dependencies/externals/"/>
-		<ivy:configure file="../tools/ivyconf.xml"/>
+		<property name="repository.dir" location="../dependencies/externals/" />
+		<ivy:configure file="../tools/ivyconf.xml" />
 	</target>
 
-	
+
 	<!-- RETRIEVE-DEPENDENCIES TASK -->
 	<target name="retrieve-dependencies" depends="install-ivy" description="Retreive dependencies with ivy">
 		<echo>Retrieving dependencies for ${project.name} (${project.id}) version ${project.version}</echo>
-		<mkdir dir="${lib.dir}"/>
-		<ivy:retrieve/>
+		<mkdir dir="${lib.dir}" />
+		<ivy:retrieve />
 	</target>
 
-	
+
 	<!-- BUILD-CLASSPATH TASK -->
-	<target name="build-classpath" description="Computes the classpath" >
+	<target name="build-classpath" description="Computes the classpath">
 		<echo>Building classpath for ${project.name} (${project.id}) version ${project.version}</echo>
 		<path id="classpath">
 			<!-- Project dependencies -->
 			<fileset dir="${lib.dir}" />
 		</path>
 	</target>
-	
+
 
 	<!-- COMPILE TASK -->
 	<target name="compile" depends="retrieve-dependencies,build-classpath" description="Compiles the sources">
 		<echo>Compiling ${project.name} (${project.id}) version ${project.version}</echo>
 		<!-- Compiling main sources -->
-		<mkdir dir="${target.classes}"/>
+		<mkdir dir="${target.classes}" />
 		<javac source="1.5" srcdir="${src.main.java}" destdir="${target.classes}" classpathref="classpath" />
 		<copy todir="${target.classes}" failonerror="false">
 			<fileset dir="${src.main.resources}" />
 		</copy>
 		<!-- Compiling test sources -->
-		<mkdir dir="${target.test-classes}"/>
+		<mkdir dir="${target.test-classes}" />
 		<javac source="1.5" srcdir="${src.test.java}" destdir="${target.test-classes}" classpathref="classpath">
 			<classpath>
 				<pathelement path="${target.classes}" />
-		    </classpath>
+			</classpath>
 		</javac>
 		<copy todir="${target.test-classes}" failonerror="false">
 			<fileset dir="${src.test.resources}" />
 		</copy>
 	</target>
-	
+
 
 	<!-- JAR TASK -->
 	<target name="jar" depends="compile" description="Creates a Jar from the compiled sources">
@@ -106,8 +106,8 @@
 			<fileset dir="${target.build}" />
 		</jar>
 	</target>
-	
-	
+
+
 	<!-- PLUGIN TASK -->
 	<target name="plugin" depends="compile" description="Creates a Plugin Jar from the compiled sources">
 		<copy todir="${target.build}" failonerror="false">
@@ -127,8 +127,8 @@
 			<fileset dir="${target.build}" />
 		</jar>
 	</target>
-	
-	
+
+
 	<!-- FEATURE TASK -->
 	<target name="feature" description="Creates a Feature Jar">
 		<copy todir="${target}/${project.id}_${project.version}" failonerror="false">
@@ -150,54 +150,55 @@
 		<mkdir dir="${target.doc}" />
 		<javadoc destdir="${target.doc}" classpathref="classpath">
 			<fileset dir="${src.main.java}" defaultexcludes="yes">
-				<include name="**/*.java"/>
+				<include name="**/*.java" />
 			</fileset>
 		</javadoc>
 	</target>
 
-	
+
 	<!-- CLEAN TASK -->
 	<target name="clean" description="Deletes any generated file (javadoc, classes, jars, distribution)">
 		<echo>Cleaning ${project.name} (${project.id}) version ${project.version}</echo>
-		<delete dir="${lib.dir}"/>
-		<delete dir="${target}"/>
-		<delete dir="${basedir}/docbook-xml"/>
-		<delete dir="${basedir}/docbook-xsl"/>
+		<delete dir="${lib.dir}" />
+		<delete dir="${target}" />
+		<delete dir="${basedir}/docbook-xml" />
+		<delete dir="${basedir}/docbook-xsl" />
 	</target>
-	
-	
-	<!-- HELP-ECLIPSE TASK -->
+
+
+	<!-- PREPARE-HELP TASK -->
 	<target name="prepare-help" depends="retrieve-dependencies" description="Prepares the help generation">
 		<mkdir dir="${basedir}/docbook-xml" />
 		<unzip dest="${basedir}/docbook-xml">
 			<fileset dir="${basedir}/lib">
-				<include name="**/docbook-xml*.zip"/>
+				<include name="**/docbook-xml*.zip" />
 			</fileset>
 		</unzip>
 		<unzip dest="${basedir}">
 			<fileset dir="${basedir}/lib">
-				<include name="**/docbook-xsl*.zip"/>
+				<include name="**/docbook-xsl*.zip" />
 			</fileset>
 		</unzip>
 		<property name="fromregexp" value="^(docbook-xsl-[^/]+)/(.*)" />
 		<property name="toregexp" value="docbook-xsl/\2" />
 		<move todir="${basedir}">
 			<fileset dir="${basedir}">
-				<include name="docbook-xsl-*/**"/>
+				<include name="docbook-xsl-*/**" />
 			</fileset>
 			<!--<mapper type="regexp" from="${fromregexp}" to="${toregexp}" />-->
 			<regexpmapper from="${fromregexp}" to="${toregexp}" handledirsep="true" />
 		</move>
 		<delete includeemptydirs="true">
 			<fileset dir="${basedir}">
-				<include name="docbook-xsl-*"/>
+				<include name="docbook-xsl-*" />
 			</fileset>
 		</delete>
-    </target>
-	
-	
+	</target>
+
+
 	<!-- HELP-ECLIPSE TASK -->
-	<target name="help-eclipse" depends="prepare-help" description="Generates the help for Eclipse">
+	<target name="help-eclipse" depends="check-help-eclipse" unless="help-eclipse-up2date" description="Generates the help for Eclipse">
+		<antcall target="prepare-help" />
 		<mkdir dir="${target.build}" />
 		<xslt in="${src.main.resources}/0_index.xml" out="${target.build}/index.html" style="${basedir}/docbook-xsl/eclipse/eclipse.xsl">
 			<classpath location="${lib.dir}/xalan-2.7.0.jar" />
@@ -226,10 +227,7 @@
 			<outputproperty name="encoding" value="iso8859_1" />
 			<outputproperty name="indent" value="es" />
 		</xslt>
-		<replaceregexp file="${target.build}/toc.xml"
-		                         match="&lt;toc [^>]*>"
-		                         replace="&lt;toc topic=&#34;html/index.html&#34; label=&#34;${project.name}\&#34;>"
-		                         byline="true"/>
+		<replaceregexp file="${target.build}/toc.xml" match="&lt;toc [^>]*>" replace="&lt;toc topic=&#34;html/index.html&#34; label=&#34;${project.name}\&#34;>" byline="true" />
 		<copy todir="${target.build}" overwrite="true">
 			<fileset dir="${basedir}">
 				<include name="plugin.xml" />
@@ -258,11 +256,23 @@
 		<jar destfile="${target}/${project.id}_${project.version}.jar" manifest="${target.build}/META-INF/MANIFEST.MF">
 			<fileset dir="${target.build}" />
 		</jar>
+		<tstamp>
+			<format pattern="yyyy-MMM-dd, HH:mm 'GMT'Z" property="timestamp" locale="en" />
+		</tstamp>
+		<echo message="${project.name} (${project.id}) version ${project.version} compiled ${timestamp} by ${user.name}" file="${target}/help-eclipse.timestamp" />
 	</target>
 
-	
+	<!-- CHECK-HELP-ECLIPSE TASK -->
+	<target name="check-help-eclipse">
+		<uptodate property="help-eclipse-up2date" targetfile="${target}/help-eclipse.timestamp">
+			<srcfiles dir="${src}" />
+		</uptodate>
+	</target>
+
+
 	<!-- HELP-HTML TASK -->
-	<target name="help-html" depends="prepare-help" description="Generates the help in HTML">
+	<target name="help-html" depends="check-help-html" unless="help-html-up2date" description="Generates the help in HTML">
+		<antcall target="prepare-help" />
 		<mkdir dir="${target.html}" />
 		<copy todir="${target.html}">
 			<fileset dir="${basedir}/resources">
@@ -270,7 +280,7 @@
 			</fileset>
 		</copy>
 		<xslt in="${src.main.resources}/0_index.xml" out="${target.html}/index.html" style="${basedir}/docbook-xsl/html/chunk.xsl">
-			<classpath location="lib/xalan-2.7.0.jar" />			
+			<classpath location="lib/xalan-2.7.0.jar" />
 			<param name="ignore.image.scaling" expression="1" />
 			<param name="manifest.in.base.dir" expression="0" />
 			<!-- <param name="base.dir" expression="html/" /> -->
@@ -296,25 +306,36 @@
 			<outputproperty name="encoding" value="iso8859_1" />
 			<outputproperty name="indent" value="es" />
 		</xslt>
+		<tstamp>
+			<format pattern="yyyy-MMM-dd, HH:mm 'GMT'Z" property="timestamp" locale="en" />
+		</tstamp>
+		<echo message="${project.name} (${project.id}) version ${project.version} compiled ${timestamp} by ${user.name}" file="${target}/help-html.timestamp" />
 	</target>
-	
+
+	<!-- CHECK-HELP-HTML TASK -->
+	<target name="check-help-html">
+		<uptodate property="help-html-up2date" targetfile="${target}/help-html.timestamp">
+			<srcfiles dir="${src}" />
+		</uptodate>
+	</target>
+
 
 	<!-- HELP-PDF TASK -->
-	<target name="help-pdf" depends="prepare-help" description="Generates the help in PDF">
-		<property name="fop.dir" value="${lib.dir}"/>
-		<taskdef name="fop"
-		         classname="org.apache.fop.tools.anttasks.Fop">
-		         <classpath>
-		            <pathelement location="${fop.dir}/avalon-framework-api-4.2.0.jar"/>
-		            <pathelement location="${fop.dir}/avalon-framework-impl-4.2.0.jar"/>
-		            <pathelement location="${fop.dir}/commons-logging-1.1.jar"/>
-		            <pathelement location="${fop.dir}/commons-io-1.3.1.jar"/>
-		            <pathelement location="${fop.dir}/fop-0.9.3.jar"/>
-		            <pathelement location="${fop.dir}/batik-all-1.6.jar"/>
-		            <pathelement location="${fop.dir}/xmlgraphics-commons-1.1.jar"/>
-		         </classpath>
+	<target name="help-pdf" depends="check-help-pdf" unless="help-pdf-up2date" description="Generates the help in PDF">
+		<antcall target="prepare-help" />
+		<property name="fop.dir" value="${lib.dir}" />
+		<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
+			<classpath>
+				<pathelement location="${fop.dir}/avalon-framework-api-4.2.0.jar" />
+				<pathelement location="${fop.dir}/avalon-framework-impl-4.2.0.jar" />
+				<pathelement location="${fop.dir}/commons-logging-1.1.jar" />
+				<pathelement location="${fop.dir}/commons-io-1.3.1.jar" />
+				<pathelement location="${fop.dir}/fop-0.9.3.jar" />
+				<pathelement location="${fop.dir}/batik-all-1.6.jar" />
+				<pathelement location="${fop.dir}/xmlgraphics-commons-1.1.jar" />
+			</classpath>
 		</taskdef>
-		
+
 		<mkdir dir="${target.pdf}" />
 		<copy todir="${target.pdf}">
 			<fileset dir="${basedir}/resources">
@@ -323,7 +344,7 @@
 		</copy>
 
 		<xslt in="${src.main.resources}/0_index.xml" out="${target.pdf}/${project.name}.fo" style="${basedir}/docbook-xsl/fo/docbook.xsl">
-			<classpath location="lib/xalan-2.7.0.jar" />			
+			<classpath location="lib/xalan-2.7.0.jar" />
 			<param name="manifest.in.base.dir" expression="0" />
 			<param name="generate.section.toc.level" expression="5" />
 			<param name="toc.max.depth" expression="3" />
@@ -337,9 +358,18 @@
 			<outputproperty name="encoding" value="iso8859_1" />
 			<outputproperty name="indent" value="es" />
 		</xslt>
-		<fop format="application/pdf" basedir="${target.pdf}" 
-	        fofile="${target.pdf}/${project.name}.fo"
-	        outfile="${target.pdf}/${project.name}.pdf" />
+		<fop format="application/pdf" basedir="${target.pdf}" fofile="${target.pdf}/${project.name}.fo" outfile="${target.pdf}/${project.name}.pdf" />
+		<tstamp>
+			<format pattern="yyyy-MMM-dd, HH:mm 'GMT'Z" property="timestamp" locale="en" />
+		</tstamp>
+		<echo message="${project.name} (${project.id}) version ${project.version} compiled ${timestamp} by ${user.name}" file="${target}/help-pdf.timestamp" />
 	</target>
-	
+
+	<!-- CHECK-HELP-PDF TASK -->
+	<target name="check-help-pdf">
+		<uptodate property="help-pdf-up2date" targetfile="${target}/help-pdf.timestamp">
+			<srcfiles dir="${src}" />
+		</uptodate>
+	</target>
+
 </project>