maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r344329 - in /maven/components/trunk/bootstrap: ./ bootstrap-installer/ bootstrap-installer/src/ bootstrap-installer/src/main/ bootstrap-installer/src/main/java/ bootstrap-installer/src/main/java/org/ bootstrap-installer/src/main/java/org/a...
Date Tue, 15 Nov 2005 08:06:29 GMT
Author: brett
Date: Tue Nov 15 00:06:13 2005
New Revision: 344329

URL: http://svn.apache.org/viewcvs?rev=344329&view=rev
Log:
split bootstrap into two stages

Added:
    maven/components/trunk/bootstrap/bootstrap-installer/   (with props)
    maven/components/trunk/bootstrap/bootstrap-installer/pom.xml   (with props)
    maven/components/trunk/bootstrap/bootstrap-installer/src/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java
      - copied, changed from r344317, maven/components/trunk/bootstrap/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/resources/
      - copied from r344317, maven/components/trunk/bootstrap/src/main/resources/
    maven/components/trunk/bootstrap/bootstrap-mini/   (with props)
    maven/components/trunk/bootstrap/bootstrap-mini/build
      - copied, changed from r332758, maven/components/trunk/bootstrap/build
    maven/components/trunk/bootstrap/bootstrap-mini/build.bat
      - copied, changed from r332758, maven/components/trunk/bootstrap/build.bat
    maven/components/trunk/bootstrap/bootstrap-mini/pom.xml   (with props)
    maven/components/trunk/bootstrap/bootstrap-mini/src/
      - copied from r332758, maven/components/trunk/bootstrap/src/
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/
      - copied from r344317, maven/components/trunk/bootstrap/src/main/
    maven/components/trunk/bootstrap/bootstrap.sh   (with props)
Removed:
    maven/components/trunk/bootstrap/build
    maven/components/trunk/bootstrap/build.bat
    maven/components/trunk/bootstrap/src/
Modified:
    maven/components/trunk/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/util/JarMojo.java

Propchange: maven/components/trunk/bootstrap/bootstrap-installer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 15 00:06:13 2005
@@ -0,0 +1,2 @@
+target
+*.iml

Added: maven/components/trunk/bootstrap/bootstrap-installer/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-installer/pom.xml?rev=344329&view=auto
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-installer/pom.xml (added)
+++ maven/components/trunk/bootstrap/bootstrap-installer/pom.xml Tue Nov 15 00:06:13 2005
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.bootstrap</groupId>
+  <artifactId>bootstrap-installer</artifactId>
+  <version>2.0.1-SNAPSHOT</version>
+  <name>Maven Bootstrap Installer</name>
+  <description>Tool used to bootstrap m2.</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.bootstrap</groupId>
+      <artifactId>bootstrap-mini</artifactId>
+      <version>2.0.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/components/trunk/bootstrap/bootstrap-installer/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/bootstrap/bootstrap-installer/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Copied: maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java (from r344317, maven/components/trunk/bootstrap/src/main/java/org/apache/maven/bootstrap/Bootstrap.java)
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java?p2=maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java&p1=maven/components/trunk/bootstrap/src/main/java/org/apache/maven/bootstrap/Bootstrap.java&r1=344317&r2=344329&rev=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/src/main/java/org/apache/maven/bootstrap/Bootstrap.java (original)
+++ maven/components/trunk/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java Tue Nov 15 00:06:13 2005
@@ -1,4 +1,4 @@
-package org.apache.maven.bootstrap;
+package org.apache.maven.bootstrap.installer;
 
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
@@ -16,45 +16,16 @@
  * limitations under the License.
  */
 
-import org.apache.maven.bootstrap.compile.CompilerConfiguration;
-import org.apache.maven.bootstrap.compile.JavacCompiler;
-import org.apache.maven.bootstrap.download.ArtifactResolver;
-import org.apache.maven.bootstrap.download.OfflineArtifactResolver;
-import org.apache.maven.bootstrap.download.OnlineArtifactDownloader;
 import org.apache.maven.bootstrap.model.Dependency;
 import org.apache.maven.bootstrap.model.ModelReader;
-import org.apache.maven.bootstrap.model.Plugin;
-import org.apache.maven.bootstrap.model.Repository;
-import org.apache.maven.bootstrap.settings.Mirror;
-import org.apache.maven.bootstrap.settings.Proxy;
-import org.apache.maven.bootstrap.settings.Settings;
 import org.apache.maven.bootstrap.util.FileUtils;
-import org.apache.maven.bootstrap.util.IsolatedClassLoader;
-import org.apache.maven.bootstrap.util.JarMojo;
-import org.xml.sax.SAXException;
+import org.apache.maven.bootstrap.Bootstrap;
 
-import javax.xml.parsers.ParserConfigurationException;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.reflect.Method;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TimeZone;
 
 /**
  * Main class for bootstrap module.
@@ -62,58 +33,29 @@
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
  */
-public class Bootstrap
+public class BootstrapInstaller
 {
-    private static final String MODELLO_PLUGIN_ID = "org.codehaus.modello:modello-maven-plugin";
+    private final Bootstrap bootstrapper;
 
-    private Set inProgress = new HashSet();
-
-    private Map modelFileCache = new HashMap();
-
-    private Map modelCache = new HashMap();
-
-    public static void main( String[] args )
+    public BootstrapInstaller( String[] args )
         throws Exception
     {
-        Bootstrap bootstrap = new Bootstrap();
-
-        bootstrap.run( args );
+        this.bootstrapper = new Bootstrap( args );
     }
 
-    private static File getSettingsPath( String userHome, String[] args )
+    public static void main( String[] args )
         throws Exception
     {
-        for ( int i = 0; i < args.length; i++ )
-        {
-            if ( args[i].equals( "-s" ) || args[i].equals( "--settings" ) )
-            {
-                if ( i == args.length - 1 )
-                {
-                    throw new Exception( "missing argument to -s" );
-                }
-                return new File( args[i + 1] );
-            }
-        }
-        return new File( userHome, ".m2/settings.xml" );
+        BootstrapInstaller bootstrap = new BootstrapInstaller( args );
+
+        bootstrap.run();
     }
 
-    private void run( String[] args )
+    private void run()
         throws Exception
     {
         Date fullStart = new Date();
 
-        String userHome = System.getProperty( "user.home" );
-
-        File settingsXml = getSettingsPath( userHome, args );
-
-        System.out.println( "Using settings from " + settingsXml );
-
-        Settings settings = Settings.read( userHome, settingsXml );
-
-        // TODO: have an alternative implementation of ArtifactDownloader for source compiles
-        //      - if building from source, checkout and build then resolve to built jar (still download POM?)
-        ArtifactResolver resolver = setupRepositories( settings );
-
         String basedir = System.getProperty( "user.dir" );
 
         // TODO: only build this guy, then move the next part to a new phase using it for resolution
@@ -121,17 +63,14 @@
 //        buildProject( basedir, "", resolver, false );
 //        buildProject( basedir, "maven-artifact-manager", resolver );
 
-        // Pre-cache models so we know where they are for dependencies
-        cacheModels( new File( basedir ), resolver );
-
-        buildProject( new File( basedir ), resolver, true );
+        bootstrapper.buildProject( new File( basedir ), true );
 
-        createInstallation( new File( basedir, "target/installation" ), resolver );
+        createInstallation( new File( basedir, "target/installation" ) );
 
-        stats( fullStart, new Date() );
+        Bootstrap.stats( fullStart, new Date() );
     }
 
-    private void createInstallation( File dir, ArtifactResolver resolver )
+    private void createInstallation( File dir )
         throws IOException
     {
         FileUtils.deleteDirectory( dir );
@@ -149,7 +88,7 @@
         File bootDirectory = new File( coreDirectory, "boot" );
         bootDirectory.mkdir();
 
-        ModelReader reader = (ModelReader) modelCache.get( "org.apache.maven:maven-core" );
+        ModelReader reader = bootstrapper.getCachedModel( "org.apache.maven", "maven-core" );
 
         for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); )
         {
@@ -157,543 +96,26 @@
 
             if ( dep.getArtifactId().equals( "classworlds" ) )
             {
-                FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), bootDirectory );
+                FileUtils.copyFileToDirectory( bootstrapper.getArtifactFile( dep ), bootDirectory );
             }
             else if ( dep.getArtifactId().equals( "plexus-container-default" ) ||
                 dep.getArtifactId().equals( "plexus-utils" ) )
             {
-                FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), coreDirectory );
+                FileUtils.copyFileToDirectory( bootstrapper.getArtifactFile( dep ), coreDirectory );
             }
             else
             {
-                FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), libDirectory );
+                FileUtils.copyFileToDirectory( bootstrapper.getArtifactFile( dep ), libDirectory );
             }
         }
 
         Dependency coreAsDep = new Dependency( reader.getGroupId(), reader.getArtifactId(), reader.getVersion(),
                                                reader.getPackaging(), Collections.EMPTY_LIST );
 
-        FileUtils.copyFileToDirectory( resolver.getArtifactFile( coreAsDep ), libDirectory );
+        FileUtils.copyFileToDirectory( bootstrapper.getArtifactFile( coreAsDep ), libDirectory );
 
-        File srcBinDirectory = (File) modelFileCache.get( "org.apache.maven:maven-core" );
-        srcBinDirectory = new File( srcBinDirectory.getParentFile(), "src/bin" );
+        File srcBinDirectory = new File( reader.getProjectFile().getParentFile(), "src/bin" );
 
         FileUtils.copyDirectory( srcBinDirectory, binDirectory, null, "**/.svn/**" );
-    }
-
-    private void cacheModels( File basedir, ArtifactResolver resolver )
-        throws IOException, ParserConfigurationException, SAXException
-    {
-        ModelReader reader = readModel( resolver, new File( basedir, "pom.xml" ), false );
-
-        for ( Iterator i = reader.getModules().iterator(); i.hasNext(); )
-        {
-            String module = (String) i.next();
-
-            cacheModels( new File( basedir, module ), resolver );
-        }
-    }
-
-    private void buildProject( File basedir, ArtifactResolver resolver, boolean buildModules )
-        throws Exception
-    {
-        System.setProperty( "basedir", basedir.getAbsolutePath() );
-
-        File file = new File( basedir, "pom.xml" );
-
-        ModelReader reader = readModel( resolver, file, true );
-
-        String key = reader.getGroupId() + ":" + reader.getArtifactId() + ":" + reader.getPackaging();
-        if ( inProgress.contains( key ) )
-        {
-            return;
-        }
-
-        if ( reader.getPackaging().equals( "pom" ) )
-        {
-            if ( buildModules )
-            {
-                for ( Iterator i = reader.getModules().iterator(); i.hasNext(); )
-                {
-                    String module = (String) i.next();
-
-                    buildProject( new File( basedir, module ), resolver, true );
-                }
-            }
-
-            return;
-        }
-
-        inProgress.add( key );
-
-        if ( resolver.isAlreadyBuilt( key ) )
-        {
-            return;
-        }
-
-        String sources = new File( basedir, "src/main/java" ).getAbsolutePath();
-
-        String resources = new File( basedir, "src/main/resources" ).getAbsolutePath();
-
-        String classes = new File( basedir, "target/classes" ).getAbsolutePath();
-
-        File buildDirFile = new File( basedir, "target" );
-        String buildDir = buildDirFile.getAbsolutePath();
-
-        System.out.println( "Analysing dependencies ..." );
-
-        for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); )
-        {
-            Dependency dep = (Dependency) i.next();
-
-            if ( modelFileCache.containsKey( dep.getId() ) )
-            {
-                buildProject( resolver.getArtifactFile( dep.getPomDependency() ).getParentFile(), resolver, false );
-            }
-        }
-
-        resolver.downloadDependencies( reader.getDependencies() );
-
-        System.out.println();
-        System.out.println();
-        System.out.println( "Building project in " + basedir );
-
-        line();
-
-        // clean
-        System.out.println( "Cleaning " + buildDirFile + "..." );
-        FileUtils.forceDelete( buildDirFile );
-
-        // ----------------------------------------------------------------------
-        // Generate sources - modello
-        // ----------------------------------------------------------------------
-
-        File generatedSourcesDirectory = null;
-        if ( reader.getPlugins().containsKey( MODELLO_PLUGIN_ID ) )
-        {
-            Plugin plugin = (Plugin) reader.getPlugins().get( MODELLO_PLUGIN_ID );
-
-            File model = new File( basedir, (String) plugin.getConfiguration().get( "model" ) );
-
-            System.out.println( "Model exists!" );
-
-            String modelVersion = (String) plugin.getConfiguration().get( "version" );
-            if ( modelVersion == null || modelVersion.trim().length() < 1 )
-            {
-                System.out.println( "No model version configured. Using \'1.0.0\'..." );
-                modelVersion = "1.0.0";
-            }
-
-            generatedSourcesDirectory = new File( basedir, "target/generated-sources/modello" );
-
-            if ( !generatedSourcesDirectory.exists() )
-            {
-                generatedSourcesDirectory.mkdirs();
-            }
-
-            File artifactFile = resolver.getArtifactFile( plugin.asDependencyPom() );
-            ModelReader pluginReader = readModel( resolver, artifactFile, true );
-
-            ClassLoader classLoader =
-                createClassloaderFromDependencies( pluginReader.getDependencies(), null, resolver );
-
-            System.out.println( "Generating model bindings for version \'" + modelVersion + "\' from '" + model + "'" );
-
-            generateModelloSources( model.getAbsolutePath(), "java", generatedSourcesDirectory, modelVersion, "false",
-                                    classLoader );
-            generateModelloSources( model.getAbsolutePath(), "xpp3-reader", generatedSourcesDirectory, modelVersion,
-                                    "false", classLoader );
-            generateModelloSources( model.getAbsolutePath(), "xpp3-writer", generatedSourcesDirectory, modelVersion,
-                                    "false", classLoader );
-        }
-
-        // ----------------------------------------------------------------------
-        // Standard compile
-        // ----------------------------------------------------------------------
-
-        System.out.println( "Compiling sources ..." );
-
-        compile( reader.getDependencies(), sources, classes, null, generatedSourcesDirectory, Dependency.SCOPE_COMPILE,
-                 resolver );
-
-        // ----------------------------------------------------------------------
-        // Standard resources
-        // ----------------------------------------------------------------------
-
-        System.out.println( "Packaging resources ..." );
-
-        copyResources( resources, classes );
-
-        // ----------------------------------------------------------------------
-        // Create JAR
-        // ----------------------------------------------------------------------
-
-        File jarFile = createJar( new File( basedir, "pom.xml" ), classes, buildDir, reader );
-
-        System.out.println( "Packaging " + jarFile + " ..." );
-
-        resolver.addBuiltArtifact( reader.getGroupId(), reader.getArtifactId(), "jar", jarFile );
-
-        line();
-
-        inProgress.remove( key );
-    }
-
-    private ModelReader readModel( ArtifactResolver resolver, File file, boolean resolveTransitiveDependencies )
-        throws ParserConfigurationException, SAXException, IOException
-    {
-        ModelReader reader = new ModelReader( resolver, resolveTransitiveDependencies );
-
-        reader.parse( file );
-
-        resolver.addBuiltArtifact( reader.getGroupId(), reader.getArtifactId(), "pom", file );
-
-        String id = reader.getGroupId() + ":" + reader.getArtifactId();
-        modelFileCache.put( id, file );
-
-        modelCache.put( id, reader );
-
-        return reader;
-    }
-
-    private void line()
-    {
-        System.out.println( "------------------------------------------------------------------" );
-    }
-
-    private File createJar( File pomFile, String classes, String buildDir, ModelReader reader )
-        throws Exception
-    {
-        JarMojo jarMojo = new JarMojo();
-
-        String artifactId = reader.getArtifactId();
-
-        String version = reader.getVersion();
-
-        // ----------------------------------------------------------------------
-        // Create pom.properties file
-        // ----------------------------------------------------------------------
-
-        Properties p = new Properties();
-
-        p.setProperty( "groupId", reader.getGroupId() );
-
-        p.setProperty( "artifactId", reader.getArtifactId() );
-
-        p.setProperty( "version", reader.getVersion() );
-
-        File pomPropertiesDir =
-            new File( new File( classes ), "META-INF/maven/" + reader.getGroupId() + "/" + reader.getArtifactId() );
-
-        pomPropertiesDir.mkdirs();
-
-        File pomPropertiesFile = new File( pomPropertiesDir, "pom.properties" );
-
-        OutputStream os = new FileOutputStream( pomPropertiesFile );
-
-        p.store( os, "Generated by Maven" );
-
-        os.close(); // stream is flushed but not closed by Properties.store()
-
-        FileUtils.copyFile( pomFile, new File( pomPropertiesDir, "pom.xml" ) );
-
-        File jarFile = new File( buildDir, artifactId + "-" + version + ".jar" );
-        jarMojo.execute( new File( classes ), jarFile );
-
-        return jarFile;
-    }
-
-    public String getCurrentUtcDate()
-    {
-        TimeZone timezone = TimeZone.getTimeZone( "UTC" );
-        DateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss" );
-        fmt.setTimeZone( timezone );
-        return fmt.format( new Date() );
-    }
-
-    private void copyResources( String sourceDirectory, String destinationDirectory )
-        throws Exception
-    {
-        File sd = new File( sourceDirectory );
-
-        if ( !sd.exists() )
-        {
-            return;
-        }
-
-        List files = FileUtils.getFiles( sd, "**/**", "**/CVS/**,**/.svn/**", false );
-
-        for ( Iterator i = files.iterator(); i.hasNext(); )
-        {
-            File f = (File) i.next();
-
-            File source = new File( sourceDirectory, f.getPath() );
-
-            File dest = new File( destinationDirectory, f.getPath() );
-
-            if ( !dest.getParentFile().exists() )
-            {
-                dest.getParentFile().mkdirs();
-            }
-
-            FileUtils.copyFile( source, dest );
-        }
-    }
-
-    private static ArtifactResolver setupRepositories( Settings settings )
-        throws Exception
-    {
-        boolean online = true;
-
-        String onlineProperty = System.getProperty( "maven.online" );
-
-        if ( onlineProperty != null && onlineProperty.equals( "false" ) )
-        {
-            online = false;
-        }
-
-        Repository localRepository =
-            new Repository( "local", settings.getLocalRepository(), Repository.LAYOUT_DEFAULT, false, false );
-
-        File repoLocalFile = new File( localRepository.getBasedir() );
-        repoLocalFile.mkdirs();
-
-        if ( !repoLocalFile.canWrite() )
-        {
-            throw new Exception( "Can't write to " + repoLocalFile );
-        }
-
-        ArtifactResolver resolver;
-        if ( online )
-        {
-            OnlineArtifactDownloader downloader = new OnlineArtifactDownloader( localRepository );
-            resolver = downloader;
-            if ( settings.getActiveProxy() != null )
-            {
-                Proxy proxy = settings.getActiveProxy();
-                downloader.setProxy( proxy.getHost(), proxy.getPort(), proxy.getUserName(), proxy.getPassword() );
-            }
-
-            List remoteRepos = downloader.getRemoteRepositories();
-            List newRemoteRepos = new ArrayList();
-
-            for ( Iterator i = remoteRepos.iterator(); i.hasNext(); )
-            {
-                Repository repo = (Repository) i.next();
-
-                boolean foundMirror = false;
-                for ( Iterator j = settings.getMirrors().iterator(); j.hasNext() && !foundMirror; )
-                {
-                    Mirror m = (Mirror) j.next();
-                    if ( m.getMirrorOf().equals( repo.getId() ) )
-                    {
-                        newRemoteRepos.add( new Repository( m.getId(), m.getUrl(), repo.getLayout(), repo.isSnapshots(),
-                                                            repo.isReleases() ) );
-                        foundMirror = true;
-                    }
-                }
-                if ( !foundMirror )
-                {
-                    newRemoteRepos.add( repo );
-                }
-            }
-
-            downloader.setRemoteRepositories( newRemoteRepos );
-
-            System.out.println( "Using the following for your local repository: " + localRepository );
-            System.out.println( "Using the following for your remote repository: " + newRemoteRepos );
-        }
-        else
-        {
-            resolver = new OfflineArtifactResolver( localRepository );
-        }
-
-        return resolver;
-    }
-
-    protected static String formatTime( long ms )
-    {
-        long secs = ms / 1000;
-
-        long min = secs / 60;
-        secs = secs % 60;
-
-        if ( min > 0 )
-        {
-            return min + " minutes " + secs + " seconds";
-        }
-        else
-        {
-            return secs + " seconds";
-        }
-    }
-
-    private void stats( Date fullStart, Date fullStop )
-    {
-        long fullDiff = fullStop.getTime() - fullStart.getTime();
-
-        System.out.println( "Total time: " + formatTime( fullDiff ) );
-
-        System.out.println( "Finished at: " + fullStop );
-    }
-
-    private void compile( Collection dependencies, String sourceDirectory, String outputDirectory,
-                          String extraClasspath, File generatedSources, String scope, ArtifactResolver resolver )
-        throws Exception
-    {
-        JavacCompiler compiler = new JavacCompiler();
-
-        String[] sourceDirectories = null;
-
-        if ( generatedSources != null )
-        {
-            // We might only have generated sources
-
-            if ( new File( sourceDirectory ).exists() )
-            {
-                sourceDirectories = new String[]{sourceDirectory, generatedSources.getAbsolutePath()};
-            }
-            else
-            {
-                sourceDirectories = new String[]{generatedSources.getAbsolutePath()};
-            }
-        }
-        else
-        {
-            if ( new File( sourceDirectory ).exists() )
-            {
-                sourceDirectories = new String[]{sourceDirectory};
-            }
-        }
-
-        if ( sourceDirectories != null )
-        {
-            CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
-            compilerConfiguration.setOutputLocation( outputDirectory );
-            List classpathEntries = classpath( dependencies, extraClasspath, scope, resolver );
-            compilerConfiguration.setNoWarn( true );
-            compilerConfiguration.setClasspathEntries( classpathEntries );
-            compilerConfiguration.setSourceLocations( Arrays.asList( sourceDirectories ) );
-
-            /* Compile with debugging info */
-            String debugAsString = System.getProperty( "maven.compiler.debug", "true" );
-
-            if ( !Boolean.valueOf( debugAsString ).booleanValue() )
-            {
-                compilerConfiguration.setDebug( false );
-            }
-            else
-            {
-                compilerConfiguration.setDebug( true );
-            }
-
-            List messages = compiler.compile( compilerConfiguration );
-
-            for ( Iterator i = messages.iterator(); i.hasNext(); )
-            {
-                System.out.println( i.next() );
-            }
-
-            if ( messages.size() > 0 )
-            {
-                throw new Exception( "Compilation error." );
-            }
-        }
-    }
-
-    private List classpath( Collection dependencies, String extraClasspath, String scope, ArtifactResolver resolver )
-    {
-        List classpath = new ArrayList( dependencies.size() + 1 );
-
-        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
-        {
-            Dependency d = (Dependency) i.next();
-
-            String element = resolver.getArtifactFile( d ).getAbsolutePath();
-
-            if ( Dependency.SCOPE_COMPILE.equals( scope ) )
-            {
-                if ( d.getScope().equals( Dependency.SCOPE_COMPILE ) )
-                {
-                    classpath.add( element );
-                }
-            }
-            else if ( Dependency.SCOPE_RUNTIME.equals( scope ) )
-            {
-                if ( d.getScope().equals( Dependency.SCOPE_COMPILE ) ||
-                    d.getScope().equals( Dependency.SCOPE_RUNTIME ) )
-                {
-                    classpath.add( element );
-                }
-            }
-            else if ( Dependency.SCOPE_TEST.equals( scope ) )
-            {
-                classpath.add( element );
-            }
-        }
-
-        if ( extraClasspath != null )
-        {
-            classpath.add( extraClasspath );
-        }
-
-        return classpath;
-    }
-
-    private void generateModelloSources( String model, String mode, File dir, String modelVersion,
-                                         String packageWithVersion, ClassLoader modelloClassLoader )
-        throws Exception
-    {
-        Class c = modelloClassLoader.loadClass( "org.codehaus.modello.ModelloCli" );
-
-        Object generator = c.newInstance();
-
-        Method m = c.getMethod( "main", new Class[]{String[].class} );
-
-        String[] args = new String[]{model, mode, dir.getAbsolutePath(), modelVersion, packageWithVersion};
-
-        ClassLoader old = Thread.currentThread().getContextClassLoader();
-
-        Thread.currentThread().setContextClassLoader( modelloClassLoader );
-
-        m.invoke( generator, new Object[]{args} );
-
-        Thread.currentThread().setContextClassLoader( old );
-    }
-
-    private IsolatedClassLoader createClassloaderFromDependencies( Collection dependencies, ClassLoader parent,
-                                                                   ArtifactResolver resolver )
-        throws Exception
-    {
-        System.out.println( "Checking for dependencies ..." );
-
-        resolver.downloadDependencies( dependencies );
-
-        IsolatedClassLoader cl;
-        if ( parent == null )
-        {
-            cl = new IsolatedClassLoader();
-        }
-        else
-        {
-            cl = new IsolatedClassLoader( parent );
-        }
-
-        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
-        {
-            Dependency dependency = (Dependency) i.next();
-
-            File f = resolver.getArtifactFile( dependency );
-            if ( !f.exists() )
-            {
-                String msg =
-                    ( !resolver.isOnline() ? "; run again online" : "; there was a problem downloading it earlier" );
-                throw new FileNotFoundException( "Missing dependency: " + dependency + msg );
-            }
-
-            cl.addURL( f.toURL() );
-        }
-
-        return cl;
     }
 }

Modified: maven/components/trunk/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF?rev=344329&r1=344317&r2=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF (original)
+++ maven/components/trunk/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF Tue Nov 15 00:06:13 2005
@@ -1,2 +1,2 @@
 Manifest-Version: 1.0
-Main-Class: org.apache.maven.bootstrap.Bootstrap
+Main-Class: org.apache.maven.bootstrap.installer.BootstrapInstaller

Propchange: maven/components/trunk/bootstrap/bootstrap-mini/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 15 00:06:13 2005
@@ -0,0 +1,2 @@
+*.iml
+target

Copied: maven/components/trunk/bootstrap/bootstrap-mini/build (from r332758, maven/components/trunk/bootstrap/build)
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-mini/build?p2=maven/components/trunk/bootstrap/bootstrap-mini/build&p1=maven/components/trunk/bootstrap/build&r1=332758&r2=344329&rev=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/build (original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/build Tue Nov 15 00:06:13 2005
@@ -10,4 +10,4 @@
 
 "$JAVA_HOME/bin/javac" -g -d ${classesDir} `find ${srcDir} -name '*.java'`
 
-( cd ${classesDir} ; "$JAVA_HOME/bin/jar" -cfm ../bootstrap.jar ../../src/main/resources/META-INF/MANIFEST.MF * )
+( cd ${classesDir} ; "$JAVA_HOME/bin/jar" -cfm ../bootstrap-mini.jar ../../src/main/resources/META-INF/MANIFEST.MF * )

Copied: maven/components/trunk/bootstrap/bootstrap-mini/build.bat (from r332758, maven/components/trunk/bootstrap/build.bat)
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-mini/build.bat?p2=maven/components/trunk/bootstrap/bootstrap-mini/build.bat&p1=maven/components/trunk/bootstrap/build.bat&r1=332758&r2=344329&rev=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/build.bat (original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/build.bat Tue Nov 15 00:06:13 2005
@@ -15,5 +15,5 @@
 del /F/Q sources
 
 cd %classesDir% 
-"%JAVA_HOME%\bin\jar" -cfm ..\bootstrap.jar ..\..\src\main\resources\META-INF\MANIFEST.MF *.*
+"%JAVA_HOME%\bin\jar" -cfm ..\bootstrap-mini.jar ..\..\src\main\resources\META-INF\MANIFEST.MF *.*
 cd ..\..

Added: maven/components/trunk/bootstrap/bootstrap-mini/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-mini/pom.xml?rev=344329&view=auto
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/pom.xml (added)
+++ maven/components/trunk/bootstrap/bootstrap-mini/pom.xml Tue Nov 15 00:06:13 2005
@@ -0,0 +1,9 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.bootstrap</groupId>
+  <artifactId>bootstrap-mini</artifactId>
+  <version>2.0.1-SNAPSHOT</version>
+  <name>Maven Bootstrap Mini Builder</name>
+  <description>Tool used to bootstrap m2.</description>
+</project>

Propchange: maven/components/trunk/bootstrap/bootstrap-mini/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/bootstrap/bootstrap-mini/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java?rev=344329&r1=344317&r2=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java (original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java Tue Nov 15 00:06:13 2005
@@ -21,6 +21,7 @@
 import org.apache.maven.bootstrap.download.ArtifactResolver;
 import org.apache.maven.bootstrap.download.OfflineArtifactResolver;
 import org.apache.maven.bootstrap.download.OnlineArtifactDownloader;
+import org.apache.maven.bootstrap.download.RepositoryMetadata;
 import org.apache.maven.bootstrap.model.Dependency;
 import org.apache.maven.bootstrap.model.ModelReader;
 import org.apache.maven.bootstrap.model.Plugin;
@@ -45,7 +46,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -55,6 +55,7 @@
 import java.util.Properties;
 import java.util.Set;
 import java.util.TimeZone;
+import java.util.Collections;
 
 /**
  * Main class for bootstrap module.
@@ -72,12 +73,45 @@
 
     private Map modelCache = new HashMap();
 
+    private final ArtifactResolver resolver;
+
+    public Bootstrap( String[] args )
+        throws Exception
+    {
+        String userHome = System.getProperty( "user.home" );
+
+        File settingsXml = getSettingsPath( userHome, args );
+
+        System.out.println( "Using settings from " + settingsXml );
+
+        Settings settings = Settings.read( userHome, settingsXml );
+
+        // TODO: have an alternative implementation of ArtifactResolver for source compiles
+        //      - if building from source, checkout and build then resolve to built jar (still download POM?)
+        resolver = setupRepositories( settings );
+    }
+
     public static void main( String[] args )
         throws Exception
     {
-        Bootstrap bootstrap = new Bootstrap();
+        Bootstrap bootstrap = new Bootstrap( args );
+
+        String goal = null;
+        for ( int i = 0; i < args.length && goal == null; i++ )
+        {
+            if ( args[i].equals( "install" ) || args[i].equals( "package" ) )
+            {
+                goal = args[i];
+            }
+        }
 
-        bootstrap.run( args );
+        if ( goal == null )
+        {
+            System.err.println( "Goal 'package' or 'install' must be specified" );
+            return;
+        }
+
+        bootstrap.run( goal );
     }
 
     private static File getSettingsPath( String userHome, String[] args )
@@ -97,88 +131,78 @@
         return new File( userHome, ".m2/settings.xml" );
     }
 
-    private void run( String[] args )
+    private void run( String goal )
         throws Exception
     {
         Date fullStart = new Date();
 
-        String userHome = System.getProperty( "user.home" );
-
-        File settingsXml = getSettingsPath( userHome, args );
-
-        System.out.println( "Using settings from " + settingsXml );
-
-        Settings settings = Settings.read( userHome, settingsXml );
-
-        // TODO: have an alternative implementation of ArtifactDownloader for source compiles
-        //      - if building from source, checkout and build then resolve to built jar (still download POM?)
-        ArtifactResolver resolver = setupRepositories( settings );
-
         String basedir = System.getProperty( "user.dir" );
 
-        // TODO: only build this guy, then move the next part to a new phase using it for resolution
-        // Root POM
-//        buildProject( basedir, "", resolver, false );
-//        buildProject( basedir, "maven-artifact-manager", resolver );
-
-        // Pre-cache models so we know where they are for dependencies
-        cacheModels( new File( basedir ), resolver );
-
-        buildProject( new File( basedir ), resolver, true );
-
-        createInstallation( new File( basedir, "target/installation" ), resolver );
+        if ( "install".equals( goal ) )
+        {
+            File pom = new File( basedir, "pom.xml" );
+            ModelReader reader = readModel( resolver, pom, true );
+            File jar = buildProject( reader );
+            install( reader, pom, jar );
+        }
+        else
+        {
+            buildProject( new File( basedir ), false );
+        }
 
         stats( fullStart, new Date() );
     }
 
-    private void createInstallation( File dir, ArtifactResolver resolver )
-        throws IOException
+    private void install( ModelReader reader, File pom, File jar )
+        throws Exception
     {
-        FileUtils.deleteDirectory( dir );
+        String artifactId = reader.getArtifactId();
 
-        dir.mkdirs();
+        String version = reader.getVersion();
 
-        File libDirectory = new File( dir, "lib" );
-        libDirectory.mkdir();
+        String groupId = reader.getGroupId();
 
-        File binDirectory = new File( dir, "bin" );
+        String type = reader.getPackaging();
 
-        File coreDirectory = new File( dir, "core" );
-        coreDirectory.mkdir();
+        Repository localRepository = resolver.getLocalRepository();
+        File file = localRepository.getArtifactFile(
+            new Dependency( groupId, artifactId, version, type, Collections.EMPTY_LIST ) );
 
-        File bootDirectory = new File( coreDirectory, "boot" );
-        bootDirectory.mkdir();
+        System.out.println( "Installing: " + file );
 
-        ModelReader reader = (ModelReader) modelCache.get( "org.apache.maven:maven-core" );
+        FileUtils.copyFile( jar, file );
 
-        for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); )
-        {
-            Dependency dep = (Dependency) i.next();
+        installPomFile( reader, pom );
 
-            if ( dep.getArtifactId().equals( "classworlds" ) )
-            {
-                FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), bootDirectory );
-            }
-            else if ( dep.getArtifactId().equals( "plexus-container-default" ) ||
-                dep.getArtifactId().equals( "plexus-utils" ) )
-            {
-                FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), coreDirectory );
-            }
-            else
-            {
-                FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), libDirectory );
-            }
-        }
+        RepositoryMetadata metadata = new RepositoryMetadata();
+        metadata.setReleaseVersion( version );
+        metadata.setLatestVersion( version );
+        file = localRepository.getMetadataFile( groupId, artifactId, null, type, "maven-metadata-local.xml" );
+        metadata.write( file );
+
+        metadata = new RepositoryMetadata();
+        metadata.setLocalCopy( true );
+        metadata.setLastUpdated( getCurrentUtcDate() );
+        file = localRepository.getMetadataFile( groupId, artifactId, version, type, "maven-metadata-local.xml" );
+        metadata.write( file );
+    }
+
+    private void installPomFile( ModelReader reader, File source )
+        throws IOException
+    {
+        String artifactId = reader.getArtifactId();
+
+        String version = reader.getVersion();
 
-        Dependency coreAsDep = new Dependency( reader.getGroupId(), reader.getArtifactId(), reader.getVersion(),
-                                               reader.getPackaging(), Collections.EMPTY_LIST );
+        String groupId = reader.getGroupId();
 
-        FileUtils.copyFileToDirectory( resolver.getArtifactFile( coreAsDep ), libDirectory );
+        Repository localRepository = resolver.getLocalRepository();
+        File pom = localRepository.getMetadataFile( groupId, artifactId, version, reader.getPackaging(),
+                                                    artifactId + "-" + version + ".pom" );
 
-        File srcBinDirectory = (File) modelFileCache.get( "org.apache.maven:maven-core" );
-        srcBinDirectory = new File( srcBinDirectory.getParentFile(), "src/bin" );
+        System.out.println( "Installing POM: " + pom );
 
-        FileUtils.copyDirectory( srcBinDirectory, binDirectory, null, "**/.svn/**" );
+        FileUtils.copyFile( source, pom );
     }
 
     private void cacheModels( File basedir, ArtifactResolver resolver )
@@ -194,9 +218,15 @@
         }
     }
 
-    private void buildProject( File basedir, ArtifactResolver resolver, boolean buildModules )
+    public void buildProject( File basedir, boolean buildModules )
         throws Exception
     {
+        if ( buildModules )
+        {
+            // Pre-cache models so we know where they are for dependencies
+            cacheModels( basedir, resolver );
+        }
+
         System.setProperty( "basedir", basedir.getAbsolutePath() );
 
         File file = new File( basedir, "pom.xml" );
@@ -217,7 +247,7 @@
                 {
                     String module = (String) i.next();
 
-                    buildProject( new File( basedir, module ), resolver, true );
+                    buildProject( new File( basedir, module ), true );
                 }
             }
 
@@ -231,6 +261,16 @@
             return;
         }
 
+        buildProject( reader );
+
+        inProgress.remove( key );
+    }
+
+    private File buildProject( ModelReader reader )
+        throws Exception
+    {
+        File basedir = reader.getProjectFile().getParentFile();
+
         String sources = new File( basedir, "src/main/java" ).getAbsolutePath();
 
         String resources = new File( basedir, "src/main/resources" ).getAbsolutePath();
@@ -248,7 +288,7 @@
 
             if ( modelFileCache.containsKey( dep.getId() ) )
             {
-                buildProject( resolver.getArtifactFile( dep.getPomDependency() ).getParentFile(), resolver, false );
+                buildProject( resolver.getArtifactFile( dep.getPomDependency() ).getParentFile(), false );
             }
         }
 
@@ -336,7 +376,7 @@
 
         line();
 
-        inProgress.remove( key );
+        return jarFile;
     }
 
     private ModelReader readModel( ArtifactResolver resolver, File file, boolean resolveTransitiveDependencies )
@@ -528,7 +568,7 @@
         }
     }
 
-    private void stats( Date fullStart, Date fullStop )
+    public static void stats( Date fullStart, Date fullStop )
     {
         long fullDiff = fullStop.getTime() - fullStart.getTime();
 
@@ -695,5 +735,15 @@
         }
 
         return cl;
+    }
+
+    public ModelReader getCachedModel( String groupId, String artifactId )
+    {
+        return (ModelReader) modelCache.get( groupId + ":" + artifactId );
+    }
+
+    public File getArtifactFile( Dependency dep )
+    {
+        return resolver.getArtifactFile( dep );
     }
 }

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java?rev=344329&r1=344317&r2=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java (original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java Tue Nov 15 00:06:13 2005
@@ -16,13 +16,14 @@
  * limitations under the License.
  */
 
-import org.apache.maven.bootstrap.download.DownloadFailedException;
 import org.apache.maven.bootstrap.download.ArtifactResolver;
+import org.apache.maven.bootstrap.download.DownloadFailedException;
 import org.apache.maven.bootstrap.util.AbstractReader;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
 import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -34,8 +35,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import com.sun.corba.se.impl.ior.ObjectAdapterIdArray;
-
 /**
  * Parse a POM.
  *
@@ -276,7 +275,7 @@
             }
 
             // actually, these should be transtive (see MNG-77) - but some projects have circular deps that way
-            ModelReader p = retrievePom( parentGroupId, parentArtifactId, parentVersion, "pom", inheritedScope, false,
+            ModelReader p = retrievePom( parentGroupId, parentArtifactId, parentVersion, inheritedScope, false,
                                          excluded, Collections.EMPTY_LIST );
 
             addDependencies( p.getDependencies(), parentDependencies, inheritedScope, excluded );
@@ -529,7 +528,7 @@
                         excluded.addAll( dependency.getExclusions() );
 
                         ModelReader p = retrievePom( dependency.getGroupId(), dependency.getArtifactId(),
-                                                     dependency.getVersion(), dependency.getType(),
+                                                     dependency.getVersion(),
                                                      dependency.getScope(), resolveTransitiveDependencies, excluded,
                                                      dependency.getChain() );
 
@@ -586,9 +585,8 @@
         return false;
     }
 
-    private ModelReader retrievePom( String groupId, String artifactId, String version, String type,
-                                     String inheritedScope, boolean resolveTransitiveDependencies, Set excluded,
-                                     List chain )
+    private ModelReader retrievePom( String groupId, String artifactId, String version, String inheritedScope,
+                                     boolean resolveTransitiveDependencies, Set excluded, List chain )
         throws SAXException
     {
         String key = groupId + ":" + artifactId + ":" + version;
@@ -656,5 +654,10 @@
     public List getModules()
     {
         return modules;
+    }
+
+    public File getProjectFile()
+    {
+        return pomFile;
     }
 }

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/util/JarMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/util/JarMojo.java?rev=344329&r1=344317&r2=344329&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/util/JarMojo.java (original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/util/JarMojo.java Tue Nov 15 00:06:13 2005
@@ -32,6 +32,8 @@
 {
     private byte[] buffer = new byte[4096];
 
+    private static final String MF = "META-INF/MANIFEST.MF";
+
     public void execute( File basedir, File jarFile )
         throws Exception
     {
@@ -46,9 +48,10 @@
      * Add all files in the specified directory to the archive.
      *
      * @param includes a map <String, File> of items to be include in the outpur
-     * @param baseDir  the directory to add
+     * @param baseDir the directory to add
      */
-    protected void addDirectory( Map includes, File baseDir ) throws IOException
+    protected void addDirectory( Map includes, File baseDir )
+        throws IOException
     {
         addDirectory( includes, "", baseDir );
     }
@@ -57,10 +60,11 @@
      * Add all files in the specified directory to the archive.
      *
      * @param includes a map <String, File> of items to be include in the outpur
-     * @param prefix   value to be added to the front of jar entry names
-     * @param baseDir  the directory to add
+     * @param prefix value to be added to the front of jar entry names
+     * @param baseDir the directory to add
      */
-    protected void addDirectory( Map includes, String prefix, File baseDir ) throws IOException
+    protected void addDirectory( Map includes, String prefix, File baseDir )
+        throws IOException
     {
         addDirectory( includes, null, null, prefix, baseDir );
     }
@@ -68,13 +72,14 @@
     /**
      * Add all files in the specified directory to the archive.
      *
-     * @param includes        a map <String, File> of items to be include in the outpur
+     * @param includes a map <String, File> of items to be include in the outpur
      * @param includesPattern Sets the list of include patterns to use
      * @param excludesPattern Sets the list of exclude patterns to use
-     * @param prefix          value to be added to the front of jar entry names
-     * @param baseDir         the directory to add
+     * @param prefix value to be added to the front of jar entry names
+     * @param baseDir the directory to add
      */
-    protected void addDirectory( Map includes, String includesPattern, String excludesPattern, String prefix, File baseDir )
+    protected void addDirectory( Map includes, String includesPattern, String excludesPattern, String prefix,
+                                 File baseDir )
         throws IOException
     {
         if ( !baseDir.exists() )
@@ -106,18 +111,19 @@
     /**
      * Create the jar file specified and include the listed files.
      *
-     * @param jarFile  the jar file to create
+     * @param jarFile the jar file to create
      * @param includes a Map<String, File>of items to include; the key is the jar entry name
      * @throws IOException if there is a problem writing the archive or reading the sources
      */
-    protected void createJar( File jarFile, Map includes ) throws IOException
+    protected void createJar( File jarFile, Map includes )
+        throws IOException
     {
         File parentJarFile = jarFile.getParentFile();
         if ( !parentJarFile.exists() )
         {
             parentJarFile.mkdirs();
         }
-        JarOutputStream jos = createJar( jarFile, createManifest() );
+        JarOutputStream jos = createJar( jarFile, includes.containsKey( "META-INF/MANIFEST.MF" ) );
         try
         {
             addEntries( jos, includes );
@@ -138,7 +144,7 @@
         Manifest mf = new Manifest();
         Attributes attrs = mf.getMainAttributes();
         attrs.putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" );
-        attrs.putValue( "Created-By", "2.0 (Apache Maven)" );
+        attrs.putValue( "Created-By", "Apache Maven Bootstrap Mini" );
         return mf;
     }
 
@@ -146,17 +152,25 @@
      * Create the specified jar file and return a JarOutputStream to it
      *
      * @param jarFile the jar file to create
-     * @param mf      the manifest to use
+     * @param manifestIncluded if the manifest is included
      * @return a JarOutputStream that can be used to write to that file
      * @throws IOException if there was a problem opening the file
      */
-    protected JarOutputStream createJar( File jarFile, Manifest mf ) throws IOException
+    protected JarOutputStream createJar( File jarFile, boolean manifestIncluded )
+        throws IOException
     {
         jarFile.getParentFile().mkdirs();
         FileOutputStream fos = new FileOutputStream( jarFile );
         try
         {
-            return new JarOutputStream( fos, mf );
+            if ( manifestIncluded )
+            {
+                return new JarOutputStream( fos );
+            }
+            else
+            {
+                return new JarOutputStream( fos, createManifest() );
+            }
         }
         catch ( IOException e )
         {
@@ -176,11 +190,12 @@
     /**
      * Add all entries in the supplied Map to the jar
      *
-     * @param jos      a JarOutputStream that can be used to write to the jar
+     * @param jos a JarOutputStream that can be used to write to the jar
      * @param includes a Map<String, File> of entries to add
      * @throws IOException if there is a problem writing the archive or reading the sources
      */
-    protected void addEntries( JarOutputStream jos, Map includes ) throws IOException
+    protected void addEntries( JarOutputStream jos, Map includes )
+        throws IOException
     {
         for ( Iterator i = includes.entrySet().iterator(); i.hasNext(); )
         {
@@ -194,12 +209,13 @@
     /**
      * Add a single entry to the jar
      *
-     * @param jos    a JarOutputStream that can be used to write to the jar
-     * @param name   the entry name to use; must be '/' delimited
+     * @param jos a JarOutputStream that can be used to write to the jar
+     * @param name the entry name to use; must be '/' delimited
      * @param source the file to add
      * @throws IOException if there is a problem writing the archive or reading the sources
      */
-    protected void addEntry( JarOutputStream jos, String name, File source ) throws IOException
+    protected void addEntry( JarOutputStream jos, String name, File source )
+        throws IOException
     {
         FileInputStream fis = new FileInputStream( source );
         try

Added: maven/components/trunk/bootstrap/bootstrap.sh
URL: http://svn.apache.org/viewcvs/maven/components/trunk/bootstrap/bootstrap.sh?rev=344329&view=auto
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap.sh (added)
+++ maven/components/trunk/bootstrap/bootstrap.sh Tue Nov 15 00:06:13 2005
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# TODO: error checking
+
+(
+  cd bootstrap-mini
+  ./build
+  java -jar target/bootstrap-mini.jar install
+)
+
+BOOTSTRAP_JAR=../bootstrap-mini/target/bootstrap-mini-2.0.1-SNAPSHOT.jar
+
+(
+  cd bootstrap-installer
+  java -jar $BOOTSTRAP_JAR package
+)
+
+(
+  cd ..
+  java -classpath bootstrap/bootstrap-installer/target/bootstrap-installer-2.0.1-SNAPSHOT.jar:bootstrap/bootstrap-mini/target/bootstrap-mini-2.0.1-SNAPSHOT.jar org.apache.maven.bootstrap.installer.BootstrapInstaller
+)
+

Propchange: maven/components/trunk/bootstrap/bootstrap.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/bootstrap/bootstrap.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/components/trunk/bootstrap/bootstrap.sh
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message