o updating for changes in components

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-08-09 18:57:50 +00:00
parent 45da0a70c0
commit 4f81eed43b
1 changed files with 87 additions and 45 deletions

View File

@ -50,16 +50,31 @@ public class MBoot
"modello/jars/modello-1.0-SNAPSHOT.jar", "modello/jars/modello-1.0-SNAPSHOT.jar",
"xpp3/jars/xpp3-1.1.3.3.jar", "xpp3/jars/xpp3-1.1.3.3.jar",
"xstream/jars/xstream-1.0-SNAPSHOT.jar", "xstream/jars/xstream-1.0-SNAPSHOT.jar",
"qdox/jars/qdox-1.2.jar", "qdox/jars/qdox-1.2.jar"
"maven/jars/maven-plugin-2.0-SNAPSHOT.jar" };
String[] plexusDeps = new String[]
{
"classworlds/jars/classworlds-1.1-SNAPSHOT.jar",
"plexus/jars/plexus-0.16-SNAPSHOT.jar",
"xpp3/jars/xpp3-1.1.3.3.jar",
"xstream/jars/xstream-1.0-SNAPSHOT.jar",
"maven/jars/maven-artifact-2.0-SNAPSHOT.jar",
"maven/jars/wagon-api-1.0-alpha-1-SNAPSHOT.jar",
"maven/jars/wagon-http-lightweight-1.0-alpha-1-SNAPSHOT.jar"
}; };
String[] builds = new String[] String[] builds = new String[]
{ {
"maven-model", "maven-model",
"maven-artifact",
"maven-plugin", "maven-plugin",
"maven-core", "maven-plugin-tools",
"maven-artifact",
"maven-core"
};
String[] pluginBuilds = new String[]
{
"maven-plugins/maven-clean-plugin", "maven-plugins/maven-clean-plugin",
"maven-plugins/maven-compiler-plugin", "maven-plugins/maven-compiler-plugin",
"maven-plugins/maven-install-plugin", "maven-plugins/maven-install-plugin",
@ -70,6 +85,7 @@ public class MBoot
"maven-plugins/maven-surefire-plugin" "maven-plugins/maven-surefire-plugin"
}; };
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Standard locations for resources in Maven projects. // Standard locations for resources in Maven projects.
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -177,6 +193,8 @@ public class MBoot
// Install plugin-parent POM // Install plugin-parent POM
installPomFile( repoLocal, new File( basedir, "maven-plugins/pom.xml" ) ); installPomFile( repoLocal, new File( basedir, "maven-plugins/pom.xml" ) );
createToolsClassLoader();
for ( int i = 0; i < builds.length; i++ ) for ( int i = 0; i < builds.length; i++ )
{ {
String directory = new File( basedir, builds[i] ).getAbsolutePath(); String directory = new File( basedir, builds[i] ).getAbsolutePath();
@ -199,6 +217,29 @@ public class MBoot
System.out.println( "--------------------------------------------------------------------" ); System.out.println( "--------------------------------------------------------------------" );
} }
cl.addURL( new File( repoLocal, "maven/jars/maven-plugin-2.0-SNAPSHOT.jar" ).toURL() );
cl.addURL( new File( repoLocal, "maven/jars/maven-plugin-tools-2.0-SNAPSHOT.jar" ).toURL() );
for ( int i = 0; i < pluginBuilds.length; i++ )
{
String directory = new File( basedir, pluginBuilds[i] ).getAbsolutePath();
System.out.println( "Building project in " + directory + " ..." );
System.out.println( "--------------------------------------------------------------------" );
System.setProperty( "basedir", directory );
buildProject( directory );
reader.reset();
System.out.println( "--------------------------------------------------------------------" );
}
// build the installation // build the installation
String mavenHome; String mavenHome;
@ -256,13 +297,10 @@ public class MBoot
FileUtils.mkdir( new File( core ).getPath() ); FileUtils.mkdir( new File( core ).getPath() );
FileUtils.copyFileToDirectory( repoLocal + "/classworlds/jars/classworlds-1.1-SNAPSHOT.jar", core ); for ( int i = 0; i < plexusDeps.length; i++ )
{
FileUtils.copyFileToDirectory( repoLocal + "/plexus/jars/plexus-0.14-SNAPSHOT.jar", core ); FileUtils.copyFileToDirectory( repoLocal + "/" + plexusDeps[i], core );
}
FileUtils.copyFileToDirectory( repoLocal + "/xpp3/jars/xpp3-1.1.3.3.jar", core );
FileUtils.copyFileToDirectory( repoLocal + "/xstream/jars/xstream-1.0-SNAPSHOT.jar", core );
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// lib // lib
@ -279,7 +317,10 @@ public class MBoot
if ( d.getArtifactId().equals( "classworlds" ) || if ( d.getArtifactId().equals( "classworlds" ) ||
d.artifactId.equals( "plexus" ) || d.artifactId.equals( "plexus" ) ||
d.artifactId.equals( "xstream" ) || d.artifactId.equals( "xstream" ) ||
d.artifactId.equals( "xpp3" ) ) d.artifactId.equals( "xpp3" ) ||
d.artifactId.equals( "junit" ) ||
d.artifactId.equals( "wagon-api" ) ||
d.artifactId.equals( "maven-artifact" ) )
{ {
continue; continue;
} }
@ -291,23 +332,6 @@ public class MBoot
FileUtils.copyFileToDirectory( repoLocal + "/maven/jars/maven-core-2.0-SNAPSHOT.jar", lib ); FileUtils.copyFileToDirectory( repoLocal + "/maven/jars/maven-core-2.0-SNAPSHOT.jar", lib );
// ----------------------------------------------------------------------
// plugins
// ----------------------------------------------------------------------
String plugins = new File( dist, "plugins" ).getAbsolutePath();
FileUtils.mkdir( new File( plugins ).getPath() );
List libs = FileUtils.getFiles( new File( basedir, "maven-plugins" ), "**/target/*.jar", null );
for ( Iterator i = libs.iterator(); i.hasNext(); )
{
File f = (File) i.next();
FileUtils.copyFileToDirectory( f.getAbsolutePath(), plugins );
}
fullStop = new Date(); fullStop = new Date();
stats( fullStart, fullStop ); stats( fullStart, fullStop );
@ -482,13 +506,22 @@ public class MBoot
installPom( basedir, repoLocal ); installPom( basedir, repoLocal );
if ( !reader.artifactId.equals( "maven-plugin" ) && reader.artifactId.endsWith( "plugin" ) )
{
installPlugin( basedir, repoLocal );
}
else
{
installJar( basedir, repoLocal ); installJar( basedir, repoLocal );
} }
}
private void generatePluginDescriptor( String sourceDirectory, String outputDirectory, String pom ) IsolatedClassLoader cl;
private void createToolsClassLoader()
throws Exception throws Exception
{ {
IsolatedClassLoader cl = new IsolatedClassLoader(); cl = new IsolatedClassLoader();
for ( Iterator i = mbootDependencies.iterator(); i.hasNext(); ) for ( Iterator i = mbootDependencies.iterator(); i.hasNext(); )
{ {
@ -498,7 +531,11 @@ public class MBoot
cl.addURL( f.toURL() ); cl.addURL( f.toURL() );
} }
}
private void generatePluginDescriptor( String sourceDirectory, String outputDirectory, String pom )
throws Exception
{
Class c = cl.loadClass( "org.apache.maven.plugin.generator.PluginDescriptorGenerator" ); Class c = cl.loadClass( "org.apache.maven.plugin.generator.PluginDescriptorGenerator" );
Object generator = c.newInstance(); Object generator = c.newInstance();
@ -511,17 +548,6 @@ public class MBoot
private void generateSources( String model, String mode, String dir, String modelVersion, String packageWithVersion ) private void generateSources( String model, String mode, String dir, String modelVersion, String packageWithVersion )
throws Exception throws Exception
{ {
IsolatedClassLoader cl = new IsolatedClassLoader();
for ( Iterator i = mbootDependencies.iterator(); i.hasNext(); )
{
String dependency = (String) i.next();
File f = new File( repoLocal, dependency );
cl.addURL( f.toURL() );
}
Class c = cl.loadClass( "org.codehaus.modello.Modello" ); Class c = cl.loadClass( "org.codehaus.modello.Modello" );
Object generator = c.newInstance(); Object generator = c.newInstance();
@ -616,6 +642,22 @@ public class MBoot
FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ), jar ); FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ), jar );
} }
private void installPlugin( String basedir, String repoLocal )
throws Exception
{
String artifactId = reader.artifactId;
String version = reader.version;
String groupId = reader.groupId;
File jar = new File( repoLocal, "/" + groupId + "/plugins/" + artifactId + "-" + version + ".jar" );
System.out.println( "Installing Plugin: " + jar );
FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ), jar );
}
private void runTests( String basedir, String classes, String testClasses ) private void runTests( String basedir, String classes, String testClasses )
throws Exception throws Exception
{ {