o pushing in some tweaks for trygvis

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-01-16 17:47:06 +00:00
parent 9a10ff55d1
commit 8b47999877
4 changed files with 13 additions and 183 deletions

View File

@ -20,7 +20,7 @@ if $cygwin = true; then
repoLocal=`cygpath -pu "$repoLocal"`
fi
compile ".:$repoLocal/junit/jars/junit-3.8.1.jar:$repoLocal/maven/jars/surefire-runner-1.0.jar:$repoLocal/plexus/jars/plexus-utils-1.0-beta-1.jar" target/classes src/main
compile .:$repoLocal/junit/jars/junit-3.8.1.jar:$repoLocal/maven/jars/surefire-runner-1.0.jar:$repoLocal/plexus/jars/plexus-utils-1.0-beta-1.jar target/classes src/main
isCommandSuccessful $? "Failed compiling Maven bootstrapper classes!"

View File

@ -20,7 +20,7 @@ runJava()
{
# $1 == classpath
# $2 == Main class
# $3 == Main args
# $3 == Mail args
if $cygwin; then
CP=`cygpath -pw "$1"`
@ -33,20 +33,7 @@ runJava()
runTests()
{
# $1 == classpath
# $2 == home args
# $3 == repo local
# $4 == dependencies file
# $5 == includes file
# $6 == excludes file
if $cygwin; then
CP=`cygpath -pw "$1"`
else
CP=$1
fi
"${JAVACMD}" -classpath "$CP" TestRunnerBooter "$2" "$3" $4 $5 $6
# TO DO
}
compile()
@ -153,8 +140,6 @@ buildMavenProject()
fi
echo "Building tests in `pwd`"
repoLocal=`cat bootstrap.repo`
if $cygwin = true; then
@ -171,9 +156,7 @@ buildMavenProject()
copyResources
echo "Running tests in `pwd`"
runTests ".:${MBOOT_HOME}/classes:$repoLocal/junit/jars/junit-3.8.1.jar:$repoLocal/maven/jars/surefire-runner-1.0.jar:$repoLocal/plexus/jars/plexus-utils-1.0-beta-1.jar" "$home" "$repoLocal" bootstrap.libs bootstrap.tests.includes bootstrap.tests.excludes
runTests
if [ "$2" = "default" ]
then
@ -182,8 +165,6 @@ buildMavenProject()
jarName=$2
fi
echo "Building jars (${jarName}) in `pwd`/target"
buildJar $buildDest target/${jarName}
if [ -z $3 ]
@ -192,8 +173,7 @@ buildMavenProject()
rm -f bootstrap.libs > /dev/null 2>&1
rm -f bootstrap.resources > /dev/null 2>&1
rm -f bootstrap.repo > /dev/null 2>&1
rm -f bootstrap.tests.includes > /dev/null 2>&1
rm -f bootstrap.tests.excludes > /dev/null 2>&1
rm -f bootstrap.test > /dev/null 2>&1
fi
)
}

View File

@ -8,13 +8,17 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
public class Bootstrapper
{
@ -22,8 +26,6 @@ public class Bootstrapper
private BootstrapPomParser bootstrapPomParser;
private List dependencies;
private UnitTests unitTests;
private List resources;
@ -75,62 +77,6 @@ public class Bootstrapper
writeFile( "bootstrap.classpath", classPath.toString() );
writeFile( "bootstrap.libs", libs.toString() );
unitTests = bootstrapPomParser.getUnitTests();
StringBuffer tests = new StringBuffer();
tests.append(unitTests.getDirectory());
tests.append("@");
int size = unitTests.getIncludes().size();
// If there are no includes specified then we want it all.
if ( size == 0 )
{
tests.append( "'*'" );
}
for ( int j = 0; j < size; j++ )
{
String include = (String) unitTests.getIncludes().get( j );
tests.append( include );
if ( j != size - 1 )
{
tests.append( "," );
}
}
tests.append( "\n" );
writeFile( "bootstrap.tests.includes", tests.toString() );
tests = new StringBuffer();
tests.append(unitTests.getDirectory());
tests.append("@");
size = unitTests.getExcludes().size();
for ( int j = 0; j < size; j++ )
{
String exclude = (String) unitTests.getExcludes().get( j );
tests.append( exclude );
if ( j != size - 1 )
{
tests.append( "," );
}
}
tests.append( "\n" );
writeFile( "bootstrap.tests.excludes", tests.toString() );
resources = bootstrapPomParser.getResources();
@ -155,7 +101,7 @@ public class Bootstrapper
res.append( "@" );
size = r.getIncludes().size();
int size = r.getIncludes().size();
// If there are no includes specified then we want it all.
if ( size == 0 )
@ -207,8 +153,6 @@ public class Bootstrapper
extends DefaultHandler
{
private List dependencies = new ArrayList();
private UnitTests unitTests;
private List resources = new ArrayList();
@ -232,11 +176,6 @@ public class Bootstrapper
{
return dependencies;
}
public UnitTests getUnitTests()
{
return unitTests;
}
public List getResources()
{
@ -269,13 +208,8 @@ public class Bootstrapper
{
return;
}
else if ( rawName.equals( "unitTestSourceDirectory" ) )
{
unitTests = new UnitTests();
}
else if ( rawName.equals( "unitTest" ) )
{
unitTests = new UnitTests();
insideUnitTest = true;
}
else if ( rawName.equals( "dependency" ) )
@ -318,10 +252,6 @@ public class Bootstrapper
resources.addAll( p.getResources() );
}
else if ( rawName.equals( "unitTestSourceDirectory" ) )
{
unitTests.setDirectory(getBodyText());
}
else if ( rawName.equals( "unitTest" ) )
{
insideUnitTest = false;
@ -366,17 +296,6 @@ public class Bootstrapper
}
}
else if ( insideUnitTest )
{
if ( rawName.equals( "include" ) )
{
unitTests.addInclude( getBodyText() );
}
else if ( rawName.equals( "exclude" ) )
{
unitTests.addExclude( getBodyText() );
}
}
else if ( insideResource )
{
if ( rawName.equals( "directory" ) )
@ -575,46 +494,6 @@ public class Bootstrapper
return false;
}
}
public static class UnitTests
implements Serializable
{
private String directory;
private List includes = new ArrayList();
private List excludes = new ArrayList();
public void addInclude( String pattern )
{
this.includes.add( pattern );
}
public void addExclude( String pattern )
{
this.excludes.add( pattern );
}
public List getIncludes()
{
return this.includes;
}
public List getExcludes()
{
return this.excludes;
}
public void setDirectory( String directory )
{
this.directory = directory;
}
public String getDirectory()
{
return this.directory;
}
}
public static class Resource
implements Serializable

View File

@ -2,14 +2,11 @@ import org.apache.maven.test.TestRunner;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
public class TestRunnerBooter
{
@ -37,40 +34,15 @@ public class TestRunnerBooter
File dependenciesFile = new File(args[2]);
List dependencies = new ArrayList();
BufferedReader buf = new BufferedReader(new FileReader(dependenciesFile));
String line;
while ((line = buf.readLine()) != null)
{
dependencies.add(line);
}
buf.close();
processDependencies( dependencies, classLoader );
File includesFile = new File(args[3]);
List includes = new ArrayList();
buf = new BufferedReader(new FileReader(includesFile));
line = buf.readLine();
String includesStr = line.substring(line.indexOf("@")+1);
StringTokenizer st = new StringTokenizer( includesStr, "," );
while ( st.hasMoreTokens() )
{
includes.add( st.nextToken().trim() );
}
buf.close();
File excludesFile = new File(args[4]);
List includes = new ArrayList();
List excludes = new ArrayList();
buf = new BufferedReader(new FileReader(excludesFile));
line = buf.readLine();
String excludesStr = line.substring(line.indexOf("@")+1);
st = new StringTokenizer( excludesStr, "," );
while ( st.hasMoreTokens() )
{
excludes.add( st.nextToken().trim() );
}
buf.close();
String[] tests = collectTests( basedir,
includes,
@ -92,7 +64,6 @@ public class TestRunnerBooter
}
private void processDependencies(List dependencies, IsolatedClassLoader classLoader)
throws Exception
{
for (Iterator i=dependencies.iterator(); i.hasNext(); )
{