jvanzyl     2004/01/10 00:24:01

  Modified:    maven-mboot/src/bash maven.functions mboot
               maven-mboot/src/main Bootstrapper.java
  Log:
  o dump the local repo setting
  
  Revision  Changes    Path
  1.5       +16 -6     maven-components/maven-mboot/src/bash/maven.functions
  
  Index: maven.functions
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot/src/bash/maven.functions,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- maven.functions   3 Jan 2004 23:49:18 -0000       1.4
  +++ maven.functions   10 Jan 2004 08:24:01 -0000      1.5
  @@ -131,7 +131,7 @@
         
         copyResources
         
  -      if [ -z $2 ]
  +      if [ "$2" = "default" ]
         then
           jarName=`getJarName project.xml`
         else
  @@ -145,6 +145,7 @@
           rm -f bootstrap.classpath > /dev/null 2>&1
           rm -f bootstrap.libs > /dev/null 2>&1
           rm -f bootstrap.resources > /dev/null 2>&1
  +        rm -f bootstrap.repo > /dev/null 2>&1
         fi
       )
   }
  @@ -197,24 +198,33 @@
           # path into the target directory.
           path=`echo $tmpFile | sed "s/$tmpDirectory//;s/\@/\//g;s/^\///"`
   
  -        translatedPath=`dirname $path`
  -        
           targetDirectory="target/classes"
  -        
  +
  +        [ ! -z $MBOOT_DEBUG ] && echo "path = $path"
  +
  +        [ ! -z $path ] && translatedPath=`dirname $path`
  +
  +        [ ! -z $MBOOT_DEBUG ] && echo "translatedPath = $translatedPath"
  +
           if [ ! -z $targetPath ]
           then
  -          targetDirectory="${targetDirectory}/${targetPath}"
  +          [ ! -z $MBOOT_DEBUG ] && echo "targetPath = $targetPath"
  +          targetDirectory="${targetDirectory}/${targetPath}/${translatedPath}"
           else
             targetDirectory="${targetDirectory}/${translatedPath}"
           fi
           
  +        [ ! -z $MBOOT_DEBUG ] && echo "targetDirectory = $targetDirectory"
  +        
           [ ! -d $targetDirectory ] && mkdir -p $targetDirectory
           
  -        cp $file $targetDirectory
  +        cp $file $targetDirectory > /dev/null 2>&1
           
         done
       done
     done
  +  
  +  find target/classes -name 'CVS*' -exec rm -rf {} > /dev/null 2>&1 \;
   }
   
   # OS specific support.  $var _must_ be set to either true or false.
  
  
  
  1.5       +1 -1      maven-components/maven-mboot/src/bash/mboot
  
  Index: mboot
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot/src/bash/mboot,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mboot     3 Jan 2004 23:48:28 -0000       1.4
  +++ mboot     10 Jan 2004 08:24:01 -0000      1.5
  @@ -11,7 +11,7 @@
   }
   
   dir="."
  -jar=""
  +jar="default"
   leaveBootFiles=""
   
   while [ $# -gt 0 ]; do
  
  
  
  1.4       +58 -57    maven-components/maven-mboot/src/main/Bootstrapper.java
  
  Index: Bootstrapper.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot/src/main/Bootstrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Bootstrapper.java 9 Jan 2004 11:49:29 -0000       1.3
  +++ Bootstrapper.java 10 Jan 2004 08:24:01 -0000      1.4
  @@ -1,3 +1,4 @@
  +
   import org.xml.sax.Attributes;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXParseException;
  @@ -12,6 +13,7 @@
   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;
  @@ -21,7 +23,7 @@
   public class Bootstrapper
   {
       public static final String SNAPSHOT_SIGNATURE = "-SNAPSHOT";
  -    
  +
       private BootstrapPomParser bootstrapPomParser;
   
       private List dependencies;
  @@ -58,16 +60,16 @@
           String basedir = args[0];
   
           Properties properties = loadProperties( new File( System.getProperty( 
"user.home" ), "build.properties" ) );
  -        
  -        setRemoteRepo(properties.getProperty( "maven.repo.remote" ));
  +
  +        setRemoteRepo( properties.getProperty( "maven.repo.remote" ) );
   
           String mavenRepoLocalProperty = properties.getProperty( "maven.repo.local" 
);
  -        
  +
           if ( mavenRepoLocalProperty == null )
           {
               mavenRepoLocalProperty = System.getProperty( "user.home" ) + 
"/maven/repository";
           }
  -        
  +
           mavenRepoLocal = new File( mavenRepoLocalProperty );
   
           if ( !mavenRepoLocal.exists() )
  @@ -117,20 +119,11 @@
               classPath.append( mavenRepoLocal + "/" + getArtifactPath( d, "/" ) + 
":" );
   
               libs.append( mavenRepoLocal + "/" + getArtifactPath( d, "/" ) + "\n" );
  -
           }
   
  -        FileWriter writer = new FileWriter( "bootstrap.classpath" );
  -
  -        writer.write( classPath.toString() );
  -
  -        writer.close();
  -
  -        writer = new FileWriter( "bootstrap.libs" );
  +        writeFile( "bootstrap.classpath", classPath.toString() );
   
  -        writer.write( libs.toString() );
  -
  -        writer.close();
  +        writeFile( "bootstrap.libs", libs.toString() );
   
           resources = bootstrapPomParser.getResources();
   
  @@ -138,7 +131,7 @@
   
           for ( Iterator i = resources.iterator(); i.hasNext(); )
           {
  -            Resource r  = (Resource) i.next();
  +            Resource r = (Resource) i.next();
   
               // Not sure why r would be null. Happening in drools-core.
               if ( r == null )
  @@ -157,6 +150,12 @@
   
               int size = r.getIncludes().size();
   
  +            // If there are no includes specified then we want it all.
  +            if ( size == 0 )
  +            {
  +                res.append( "'*'" );
  +            }
  +
               for ( int j = 0; j < size; j++ )
               {
                   String include = (String) r.getIncludes().get( j );
  @@ -166,7 +165,7 @@
                       include = include.substring( 3 );
                   }
   
  -                res.append("'").append( include ).append("'");
  +                res.append( "'" ).append( include ).append( "'" );
   
                   if ( j != size - 1 )
                   {
  @@ -177,9 +176,17 @@
               res.append( "\n" );
           }
   
  -        writer = new FileWriter( "bootstrap.resources" );
  +        writeFile( "bootstrap.resources", res.toString() );
  +
  +        writeFile( "bootstrap.repo", mavenRepoLocal.getPath() );
  +    }
  +
  +    private void writeFile( String name, String contents )
  +        throws Exception
  +    {
  +        Writer writer = new FileWriter( name );
   
  -        writer.write( res.toString() );
  +        writer.write( contents );
   
           writer.close();
       }
  @@ -209,15 +216,15 @@
                       directory.mkdirs();
                   }
   
  -                if ( destinationFile.exists() && !file.endsWith(SNAPSHOT_SIGNATURE))
  +                if ( destinationFile.exists() && !file.endsWith( SNAPSHOT_SIGNATURE 
) )
                   {
                       continue;
                   }
   
                   log( "Downloading dependency: " + file );
  -                
  -                getRemoteArtifact(file, destinationFile);
  -                
  +
  +                getRemoteArtifact( file, destinationFile );
  +
                   if ( !destinationFile.exists() )
                   {
                       throw new Exception( "Failed to download " + file );
  @@ -229,40 +236,34 @@
               }
           }
       }
  -    
  -    private void setRemoteRepo(String repos)
  +
  +    private void setRemoteRepo( String repos )
       {
           remoteRepos = new ArrayList();
  -        
  -        if (repos == null)
  +
  +        if ( repos == null )
           {
  -            remoteRepos.add("http://www.ibiblio.org/maven/";);
  +            remoteRepos.add( "http://www.ibiblio.org/maven/"; );
               return;
           }
  -        
  -        StringTokenizer st = new StringTokenizer(repos, ",");
  -        while (st.hasMoreTokens())
  +
  +        StringTokenizer st = new StringTokenizer( repos, "," );
  +        while ( st.hasMoreTokens() )
           {
  -            remoteRepos.add((String)st.nextToken().trim());
  +            remoteRepos.add( st.nextToken().trim() );
           }
       }
  -    
  +
       private List getRemoteRepo()
       {
           return remoteRepos;
       }
   
  -    /**
  -     * Retrieve a <code>remoteFile</code> from the maven remote repositories
  -     * and store it at <code>localFile</code>
  -     * @param artifact the artifact to retrieve from the repositories.
  -     * @return true if the retrieval succeeds, false otherwise.
  -     */
       private boolean getRemoteArtifact( String file, File destinationFile )
       {
           boolean fileFound = false;
   
  -        for ( Iterator i = getRemoteRepo().iterator(); i.hasNext();)
  +        for ( Iterator i = getRemoteRepo().iterator(); i.hasNext(); )
           {
               String remoteRepo = (String) i.next();
   
  @@ -301,7 +302,7 @@
                   // in case there is a newer version (i.e. snapshots) in another repo
                   fileFound = true;
               }
  -            catch (FileNotFoundException e)
  +            catch ( FileNotFoundException e )
               {
                   // Ignore
               }
  @@ -324,13 +325,13 @@
                   //
                   // print a warning, in any case, so user catches on to mistyped
                   // hostnames, or other snafus
  -                log("Error retrieving artifact from [" + url + "]: ");
  +                log( "Error retrieving artifact from [" + url + "]: " );
               }
           }
   
           return fileFound;
       }
  -    
  +
       /**
        * <p>Replaces all occurrences of a String within another String.</p>
        *
  @@ -355,19 +356,19 @@
        * @return the text with any replacements processed,
        *  <code>null</code> if null String input
        */
  -    private String replace(String text, String repl, String with)
  +    private String replace( String text, String repl, String with )
       {
  -        StringBuffer buf = new StringBuffer(text.length());
  +        StringBuffer buf = new StringBuffer( text.length() );
           int start = 0, end = 0;
  -        while ((end = text.indexOf(repl, start)) != -1)
  +        while ( ( end = text.indexOf( repl, start ) ) != -1 )
           {
  -            buf.append(text.substring(start, end)).append(with);
  +            buf.append( text.substring( start, end ) ).append( with );
               start = end + repl.length();
           }
  -        buf.append(text.substring(start));
  +        buf.append( text.substring( start ) );
           return buf.toString();
       }
  -    
  +
       private void log( String message )
       {
           System.out.println( message );
  @@ -390,7 +391,7 @@
       private static Properties loadProperties( InputStream is )
       {
           Properties properties = new Properties();
  -        
  +
           try
           {
               if ( is != null )
  @@ -479,7 +480,7 @@
               {
                   return;
               }
  -            else if( rawName.equals( "unitTest" ) )
  +            else if ( rawName.equals( "unitTest" ) )
               {
                   insideUnitTest = true;
               }
  @@ -640,8 +641,8 @@
   
           public String getId()
           {
  -            if (    isValid( getGroupId() )
  -                 && isValid( getArtifactId() ) )
  +            if ( isValid( getGroupId() )
  +                && isValid( getArtifactId() ) )
               {
                   // We have something like:
                   //
  @@ -691,7 +692,7 @@
           {
               // If the jar name has been explicty set then use that. This
               // is when the <jar/> element is explicity used in the POM.
  -            if ( jar != null)
  +            if ( jar != null )
               {
                   return jar;
               }
  @@ -756,8 +757,8 @@
   
           private boolean isValid( String value )
           {
  -            if (    value != null
  -                 && value.trim().equals("") == false )
  +            if ( value != null
  +                && value.trim().equals( "" ) == false )
               {
                   return true;
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to