NIHVIVO-2811 Restructure the build utilities into a single directory, and compile them all at the beginning.

This commit is contained in:
j2blake 2011-09-12 19:44:32 +00:00
parent 60e92e9bf0
commit 0e4441935e
14 changed files with 113 additions and 147 deletions

View file

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- ======================================================================
Create:
1) DirDifferenceResourceCollection -
A new resource collection that will allow us to efficiently merge
a primary directory with an overriding directory.
A file in the primary directory is included in the resource collection
if there is no matching file in the blocking directory
====================================================================== -->
<project name="antTypesAndTasks" default="all">
<property name="source.dir" location="./src" />
<property name="antclasses.dir" location="./classes" />
<property name="lib.dir" location="./lib" />
<path id="compile.classpath">
<pathelement location="${lib.dir}/ant.jar" />
</path>
<!-- =================================
target: all
================================= -->
<target name="all" description="compile the custom types and tasks">
<javac srcdir="${source.dir}"
destdir="${antclasses.dir}"
debug="true"
encoding="UTF8"
includeantruntime="false"
source="1.6">
<classpath refid="compile.classpath" />
</javac>
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" description="start from scratch">
<delete dir="${antclasses.dir}" />
<mkdir dir="${antclasses.dir}" />
</target>
</project>

Binary file not shown.

View file

@ -43,6 +43,11 @@ public abstract class AbstractWrappedFileSet implements ResourceCollection {
return fileSet.createExclude();
}
public PatternSet createPatternSet() {
return fileSet.createPatternSet();
}
@Override
public Object clone() {
throw new BuildException(this.getClass().getSimpleName()

View file

@ -1,13 +1,14 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.testing;
package edu.cornell.mannlib.vitro.utilities.testing;
import static edu.cornell.mannlib.vitro.testing.VitroTestRunner.ReportLevel.BRIEF;
import static edu.cornell.mannlib.vitro.testing.VitroTestRunner.ReportLevel.FULL;
import static edu.cornell.mannlib.vitro.testing.VitroTestRunner.ReportLevel.MORE;
import static edu.cornell.mannlib.vitro.utilities.testing.VitroTestRunner.ReportLevel.BRIEF;
import static edu.cornell.mannlib.vitro.utilities.testing.VitroTestRunner.ReportLevel.FULL;
import static edu.cornell.mannlib.vitro.utilities.testing.VitroTestRunner.ReportLevel.MORE;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@ -18,9 +19,7 @@ import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import com.ibm.icu.text.SimpleDateFormat;
import edu.cornell.mannlib.vitro.testing.VitroTestRunner.ReportLevel;
import edu.cornell.mannlib.vitro.utilities.testing.VitroTestRunner.ReportLevel;
/**
* Listen to events as they come from the JUnit test runner. The events from the

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.testing;
package edu.cornell.mannlib.vitro.utilities.testing;
import java.io.File;
import java.util.ArrayList;

View file

@ -15,21 +15,24 @@
- - - - - - - - - - - - - - - - - -->
<dirname property="corebase.dir" file="${ant.file.vitroCore}" />
<!--
If calling from a Product build script, these properties already point to
the product-related locations, so setting them here has no effect.
-->
<!-- A product script will override appbase.dir, but not corebase.dir -->
<property name="appbase.dir" location="${corebase.dir}" />
<property name="build.dir" location=".build" />
<property name="deploy.properties.file" location="config/deploy.properties" />
<property name="war.dir" location="${build.dir}/war" />
<property name="war-webinf.dir" location="${war.dir}/WEB-INF" />
<property name="war-classes.dir" location="${war-webinf.dir}/classes" />
<property name="war-resources.dir" location="${war-webinf.dir}/resources" />
<property name="revisionInfo.build.file" location="${war-resources.dir}/revisionInfo.txt" />
<property name="utilities.base.dir" location="${corebase.dir}/../utilities/buildutils" />
<property name="utilities.source.dir" location="${utilities.base.dir}/src" />
<property name="utilities.lib.dir" location="${utilities.base.dir}/lib" />
<property name="test-classes.dir" location="${build.dir}/testclasses" />
<property name="war.dir" location="${build.dir}/war" />
<property name="war.webinf.dir" location="${war.dir}/WEB-INF" />
<property name="war.classes.dir" location="${war.webinf.dir}/classes" />
<property name="war.resources.dir" location="${war.webinf.dir}/resources" />
<property name="revisionInfo.build.file" location="${war.resources.dir}/revisionInfo.txt" />
<property name="test.classes.dir" location="${build.dir}/testClasses" />
<property name="utility.classes.dir" location="${build.dir}/utilityClasses" />
<property name="javac.deprecation" value="true" />
@ -37,23 +40,30 @@
paths: for compiling and running
- - - - - - - - - - - - - - - - - -->
<path id="compile.classpath">
<fileset dir="${appbase.dir}/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${appbase.dir}/lib" includes="*.jar" />
</path>
<path id="utility.compile.classpath">
<fileset dir="${utilities.lib.dir}" includes="*.jar" />
</path>
<path id="utility.run.classpath">
<pathelement location="${utility.classes.dir}" />
<path refid="utility.compile.classpath" />
</path>
<path id="test.compile.classpath">
<pathelement location="${war-classes.dir}" />
<pathelement location="${war.classes.dir}" />
<path refid="compile.classpath" />
</path>
<path id="test.run.classpath">
<pathelement location="${appbase.dir}/test" />
<pathelement location="${test-classes.dir}" />
<pathelement location="${test.classes.dir}" />
<path refid="test.compile.classpath" />
<path refid="utility.run.classpath" />
</path>
<!-- =================================
target: describe
================================= -->
@ -123,25 +133,43 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<delete dir="${solr.home.dir}" excludes="data/**/*" includeemptydirs="true" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: compileUtilities
- - - - - - - - - - - - - - - - - -->
<target name="compileUtilities">
<mkdir dir="${utility.classes.dir}" />
<javac srcdir="${utilities.source.dir}"
destdir="${utility.classes.dir}"
debug="true"
deprecation="${javac.deprecation}"
encoding="UTF8"
includeantruntime="false"
optimize="false"
source="1.6">
<classpath refid="utility.compile.classpath" />
</javac>
<typedef name="dirDifference"
classname="edu.cornell.mannlib.vitro.utilities.anttasks.DirDifferenceFileSet"
classpathref="utility.run.classpath" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: prepare
- - - - - - - - - - - - - - - - - -->
<target name="prepare" depends="properties">
<target name="prepare" depends="properties, compileUtilities">
<mkdir dir="${build.dir}" />
<mkdir dir="${war-classes.dir}" />
<mkdir dir="${war-resources.dir}" />
<mkdir dir="${test-classes.dir}" />
<mkdir dir="${war.classes.dir}" />
<mkdir dir="${war.resources.dir}" />
<mkdir dir="${test.classes.dir}" />
<!-- copy all sorts of web stuff into the war directory. -->
<copy todir="${war.dir}">
<fileset dir="${appbase.dir}/web">
</fileset>
<fileset dir="${appbase.dir}">
<include name="themes/**/*" />
</fileset>
<fileset dir="${appbase.dir}/web" />
<fileset dir="${appbase.dir}" includes="themes/**/*" />
</copy>
<copy todir="${war-webinf.dir}">
<copy todir="${war.webinf.dir}">
<fileset dir="${appbase.dir}">
<!-- copy the JARs into the war directory -->
<include name="lib/*" />
@ -154,7 +182,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<!-- use the production Log4J properties, unless a debug version exists. -->
<available file="${appbase.dir}/config/debug.log4j.properties"
property="debug.log4j.exists" />
<copy tofile="${war-classes.dir}/log4j.properties" filtering="true" overwrite="true">
<copy tofile="${war.classes.dir}/log4j.properties" filtering="true" overwrite="true">
<fileset dir="${appbase.dir}/config">
<include name="default.log4j.properties" unless="debug.log4j.exists" />
<include name="debug.log4j.properties" if="debug.log4j.exists" />
@ -164,7 +192,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
</filterchain>
</copy>
<copy todir="${war-classes.dir}">
<copy todir="${war.classes.dir}">
<!-- copy the deploy.properties into the war directory -->
<fileset file="${deploy.properties.file}" />
@ -183,14 +211,14 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<target name="compile" depends="prepare" description="--> Compile Java sources">
<!-- deletes all files that depend on changed .java files -->
<depend srcdir="${appbase.dir}/src"
destdir="${war-classes.dir}"
destdir="${war.classes.dir}"
closure="false"
cache="${build.dir}/.depcache">
<classpath refid="compile.classpath" />
</depend>
<javac srcdir="${appbase.dir}/src"
destdir="${war-classes.dir}"
destdir="${war.classes.dir}"
debug="true"
deprecation="${javac.deprecation}"
encoding="UTF8"
@ -206,7 +234,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
================================= -->
<target name="test" depends="compile" unless="skiptests" description="--> Run JUnit tests">
<javac srcdir="${appbase.dir}/test"
destdir="${test-classes.dir}"
destdir="${test.classes.dir}"
debug="true"
deprecation="${javac.deprecation}"
encoding="UTF8"
@ -216,7 +244,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<classpath refid="test.compile.classpath" />
</javac>
<java classname="edu.cornell.mannlib.vitro.testing.VitroTestRunner"
<java classname="edu.cornell.mannlib.vitro.utilities.testing.VitroTestRunner"
fork="yes"
failonerror="true">
<classpath refid="test.run.classpath" />
@ -229,8 +257,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
target: jar
================================= -->
<target name="jar" depends="test" description="--> Compile the Java, and build a JAR file">
<jar basedir="${war-classes.dir}"
destfile="${build.dir}/${ant.project.name}.jar" />
<jar basedir="${war.classes.dir}" destfile="${build.dir}/${ant.project.name}.jar" />
</target>
<!-- =================================
@ -364,20 +391,10 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<attribute name="productName" />
<attribute name="productCheckoutDir" />
<sequential>
<javac srcdir="${corebase.dir}/../utilities/buildutils/revisioninfo"
destdir="${test-classes.dir}"
debug="true"
deprecation="${javac.deprecation}"
encoding="UTF8"
includeantruntime="false"
optimize="false"
source="1.6">
</javac>
<java classname="edu.cornell.mannlib.vitro.utilities.revisioninfo.RevisionInfoBuilder"
fork="no"
failonerror="true">
<classpath refid="test.run.classpath" />
<classpath refid="utility.run.classpath" />
<arg value="@{productName}" />
<arg file="@{productCheckoutDir}" />
<arg file="${revisionInfo.build.file}" />

View file

@ -33,17 +33,10 @@
<pathelement location="${vivoProduct.basedir}/../utilities/anttasks/classes" />
</path>
<!-- - - - - - - - - - - - - - - - - -
custom Ant types
- - - - - - - - - - - - - - - - - -->
<typedef name="dirDifference"
classname="edu.cornell.mannlib.vitro.utilities.anttasks.DirDifferenceFileSet"
classpathref="anttasks.classpath" />
<!-- - - - - - - - - - - - - - - - - -
target: prepare
- - - - - - - - - - - - - - - - - -->
<target name="prepare" depends="product-prepare,vitroCore.prepare" />
<target name="prepare" depends="compileUtilities,product-prepare,vitroCore.prepare" />
<!-- - - - - - - - - - - - - - - - - -
target: product-prepare
@ -61,25 +54,26 @@
<fileset dir="${product.modifications.dir}" />
</copy>
<patternset id="appbase.patterns">
<include name="src/**/*" />
<include name="lib/**/*" />
<include name="test/**/*" />
<include name="themes/**/*" />
<include name="config/*.properties" />
<include name="config/solr/*" />
<include name="context.xml" />
</patternset>
<copy todir="${appbase.dir}" includeemptydirs="true">
<dirDifference dir="${corebase.dir}">
<include name="src/**/*" />
<include name="lib/**/*" />
<include name="test/**/*" />
<include name="themes/**/*" unless="skip.core.themes" />
<include name="config/*.properties" />
<include name="config/solr/*" />
<include name="context.xml" />
<patternset refid="appbase.patterns" />
<exclude name="themes/**/*" if="skip.core.themes" />
<blockingPath>
<pathelement location="." />
</blockingPath>
</dirDifference>
<fileset dir=".">
<include name="src/**/*" />
<include name="lib/**/*" />
<include name="test/**/*" />
<include name="themes/**/*" />
<include name="context.xml" />
<patternset refid="appbase.patterns" />
</fileset>
</copy>
</target>
@ -100,16 +94,16 @@
In regular use, checks that all appropriate source files have license tags.
At release time, applies license text to source files.
NOTE: don't override licenser.properties.file from the command line.
Instead, override licenser.core.properties.file and licenser.product.properties.file
The files are handled as properties so they can be overridden from the command line, if desired.
================================= -->
<target name="licenser" description="--> Check source files for licensing tags">
<property name="licenser.product.properties.file"
location="./config/licenser/licenser.properties" />
<property name="licenser.core.properties.file"
location="${corebase.dir}/config/licenser/licenser.properties" />
<runLicenserScript productname="${ant.project.name}" propertiesfile="${licenser.product.properties.file}" />
<runLicenserScript productname="Vitro core" propertiesfile="${licenser.core.properties.file}" />
<runLicenserScript productname="${ant.project.name}"
propertiesfile="${licenser.product.properties.file}" />
<runLicenserScript productname="Vitro core"
propertiesfile="${licenser.core.properties.file}" />
</target>
</project>