avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 20837 - in avalon/trunk/tools/magic: artifact/src/dist engine/src/java/org/apache/avalon/magic jar/src/dist java/src/dist prepare/src/dist test/src/dist xdoc/src/dist
Date Sat, 05 Jun 2004 18:09:31 GMT
Author: niclas
Date: Sat Jun  5 11:09:30 2004
New Revision: 20837

Modified:
   avalon/trunk/tools/magic/artifact/src/dist/magic.bsh
   avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Artifact.java
   avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Main.java
   avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Util.java
   avalon/trunk/tools/magic/jar/src/dist/magic.bsh
   avalon/trunk/tools/magic/java/src/dist/magic.bsh
   avalon/trunk/tools/magic/prepare/src/dist/magic.bsh
   avalon/trunk/tools/magic/test/src/dist/magic.bsh
   avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh
Log:
Various fixes found when building the entire Avalon codebase.

Modified: avalon/trunk/tools/magic/artifact/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/artifact/src/dist/magic.bsh	(original)
+++ avalon/trunk/tools/magic/artifact/src/dist/magic.bsh	Sat Jun  5 11:09:30 2004
@@ -56,7 +56,7 @@
         Path result = new Path( m_Project );
         for( int i=0 ; i < artifacts.length ; i++ )
         {
-            File localFile = artifacts[i].toLocalFile();
+            File localFile = artifacts[i].getContentFile();
             Path.PathElement pe = result.createPathElement();
             pe.setLocation( localFile );
         }
@@ -83,6 +83,25 @@
     public void upload( Artifact artifact )
         throws IOException
     {
+        String destDir =    m_Context.getProperty( "artifact.remote.dir" );
+        String host =       m_Context.getProperty( "artifact.remote.host" );
+        String username =   m_Context.getProperty( "artifact.remote.username" );
+
+        String fullDest = username + "@" + host + ":" + destDir + "/" + 
+            artifact.getGroupId() + "/" + artifact.getType() + "s/";
+            
+        String source = artifact.toLocalFile().getAbsolutePath();
+        upload( source, fullDest );
+        
+        // TODO:  Optimize so both files are uploaded in the same SSH session,
+        //        which probably happens with Ant filesets.
+        source = source + ".md5";
+        upload( source, fullDest );
+    }
+    
+    private void upload( String source, String dest )
+        throws IOException
+    {
         int port = -1;
         try
         {
@@ -91,39 +110,24 @@
         {} // ignore
 
         boolean trust = "true".equals( m_Context.getProperty( "artifact.remote.trust" ) );
-        boolean failOnError = "true".equals( m_Context.getProperty( "artifact.remote.fail.on.error"
) );
         String host =       m_Context.getProperty( "artifact.remote.host" );
-        String destDir =    m_Context.getProperty( "artifact.remote.dir" );
         String keyfile =    m_Context.getProperty( "artifact.remote.keys.file" );
         String knownhosts = m_Context.getProperty( "artifact.remote.knownhosts.file" );
         String passphrase = m_Context.getProperty( "artifact.remote.passphrase" );
         String password =   m_Context.getProperty( "artifact.remote.password" );
         String username =   m_Context.getProperty( "artifact.remote.username" );
 
-        System.out.println( "    Host:" + host );
-        System.out.println( "    User:" + username );
-        System.out.println( "     Dir:" + destDir );
-        System.out.println( " KeyFile:" + keyfile );
-        System.out.println( "   Known:" + knownhosts );
-        System.out.println( "  Phrase:" + passphrase );
-        System.out.println( "Password:" + password );
+        if( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug( "    Host:" + host );
+            getLogger().debug( "    User:" + username );
+            getLogger().debug( "     Dir:" + dest );
+            getLogger().debug( " KeyFile:" + keyfile );
+            getLogger().debug( "   Known:" + knownhosts );
+            getLogger().debug( "  Phrase:" + passphrase );
+            getLogger().debug( "Password:" + password );
+        }
 
-        String fullDest = username + "@" + host + ":" + destDir + "/" + 
-            artifact.getGroupId() + "/" + artifact.getType() + "s/";
-            
-        String source = artifact.toLocalFile().getAbsolutePath();
-        upload( source, host, fullDest, keyfile, passphrase, password );
-        
-        // TODO:  Optimize so both files are uploaded in the same SSH session,
-        //        which probably happens with Ant filesets.
-        source = source + ".md5";
-        upload( source, host, fullDest, keyfile, passphrase, password );
-    }
-    
-    private void upload( String source, String host, String dest, 
-        String keyfile, String passphrase, String password )
-        throws IOException
-    {
         try
         {
             m_Project.addTaskDefinition( "scp", Scp.class );
@@ -151,7 +155,7 @@
 
             if( ! "".equals( username ) )
                 scp.setUsername( username );
-            scp.setTodir( fullDest );
+            scp.setTodir( dest );
             
             scp.execute();
         } catch( Exception e )

Modified: avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Artifact.java
==============================================================================
--- avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Artifact.java	(original)
+++ avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Artifact.java	Sat Jun
 5 11:09:30 2004
@@ -50,11 +50,11 @@
             repository = DEFAULT_REPOSITORY;
         
         m_Context = context;
-        m_Repository = repository;
-        m_ArtifactId = artifactId;
-        m_GroupId = groupId;
-        m_Version = version;
-        m_Type = type;
+        m_Repository = repository.trim();
+        m_ArtifactId = artifactId.trim();
+        m_GroupId = groupId.trim();
+        m_Version = version.trim();
+        m_Type = type.trim();
     }
 
     public static Artifact resolve( PluginContext context, String artifactId )
@@ -157,6 +157,11 @@
             while( ( line = br.readLine() ) != null )
             {
                 line = line.trim();
+                if( line.startsWith( "#" ) )
+                    continue;
+                int pos = line.indexOf( "//" );
+                if( pos >= 0 )
+                    line = line.substring( 0, pos ).trim();
                 if( ! line.equals( "" ) )
                     deps.add( line );
             }

Modified: avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Main.java
==============================================================================
--- avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Main.java	(original)
+++ avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Main.java	Sat Jun  5
11:09:30 2004
@@ -45,6 +45,7 @@
     {
         String cwd = System.getProperty( "user.dir" );
         File f = new File( cwd );
+        System.setProperty( "user.dir", "{invalid.dir.to.be.seen.if.used}" );
         return f.getAbsoluteFile();
     }
     

Modified: avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Util.java
==============================================================================
--- avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Util.java	(original)
+++ avalon/trunk/tools/magic/engine/src/java/org/apache/avalon/magic/Util.java	Sat Jun  5
11:09:30 2004
@@ -75,6 +75,7 @@
             int b;
             int counter = 0;
             int kbs = 0;
+            System.out.print( "Downloading " + url + " :  " );
             while( ( b = bis.read() ) != -1 )
             {
                 counter++;

Modified: avalon/trunk/tools/magic/jar/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/jar/src/dist/magic.bsh	(original)
+++ avalon/trunk/tools/magic/jar/src/dist/magic.bsh	Sat Jun  5 11:09:30 2004
@@ -115,11 +115,11 @@
     private File prepareManifest()
     {
         String manifestName = m_Context.getProperty( "jar.manifest" );
-        File srcManifest = new File( manifestName ); 
+        File srcManifest = new File( m_Context.getProjectDir(), manifestName ); 
         if( srcManifest.exists() )
         {
             String destDirName = m_Context.getProperty( "jar.manifest.build.dir" );
-            File toDir = new File( destDirName ); 
+            File toDir = new File( m_Context.getProjectDir(), destDirName ); 
             toDir.mkdirs();
 
             getLogger().info( "Copying " + srcManifest + " to " + toDir );
@@ -141,11 +141,11 @@
         throws IOException
     {
         String dest = m_Context.getProperty( "jar.build.dest.dir" );
-        File destDir = new File( dest );
-        m_JarFile = new File( dest, m_CurrentArtifact.getFilename() );
+        File destDir = new File( m_Context.getProjectDir(), dest );
+        m_JarFile = new File( destDir, m_CurrentArtifact.getFilename() );
         destDir.mkdirs();
         
-        File fromDir = new File( m_Context.getProperty( "jar.build.src.dir" ) );
+        File fromDir = new File( m_Context.getProjectDir(), m_Context.getProperty( "jar.build.src.dir"
) );
 
         Jar jar = (Jar) m_Project.createTask( "jar" );
         /* Set the destination */

Modified: avalon/trunk/tools/magic/java/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/java/src/dist/magic.bsh	(original)
+++ avalon/trunk/tools/magic/java/src/dist/magic.bsh	Sat Jun  5 11:09:30 2004
@@ -71,11 +71,11 @@
             logger.debug( "Starting Compile." );
             
         String destdirname = m_Context.getProperty( "java.build.dest.dir" );
-        File toDir = new File( destdirname ); 
+        File toDir = new File( m_Context.getProjectDir(), destdirname ); 
         toDir.mkdirs();
                 
         String srcdirname = m_Context.getProperty( "java.build.src.dir" );
-        File fromDir = new File( srcdirname ); 
+        File fromDir = new File( m_Context.getProjectDir(), srcdirname ); 
         
         String classpath = m_Context.getProperty( "java.class.path" );
         compile( classpath, toDir, fromDir );

Modified: avalon/trunk/tools/magic/prepare/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/prepare/src/dist/magic.bsh	(original)
+++ avalon/trunk/tools/magic/prepare/src/dist/magic.bsh	Sat Jun  5 11:09:30 2004
@@ -55,13 +55,13 @@
     public void copySources()
     {
         String destdirname = m_Context.getProperty( "prepare.build.src.dir" );
-        File toDir = new File( destdirname ); 
+        File toDir = new File( m_Context.getProjectDir(), destdirname ); 
         String srcdirname = m_Context.getProperty( "prepare.src.dir" );
-        File fromDir = new File( srcdirname ); 
+        File fromDir = new File( m_Context.getProjectDir(), srcdirname ); 
         toDir.mkdirs();  /* ensure that the directory exists. */
         
         String textFiles = m_Context.getProperty( "prepare.filtered.files" );
-        
+
         copy( fromDir, toDir, textFiles, "", true );
         copy( fromDir, toDir, "**/*", textFiles, false );
     }

Modified: avalon/trunk/tools/magic/test/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/test/src/dist/magic.bsh	(original)
+++ avalon/trunk/tools/magic/test/src/dist/magic.bsh	Sat Jun  5 11:09:30 2004
@@ -67,11 +67,11 @@
     private void compileTests( String classpath )
     {
         String destdirname = m_Context.getProperty( "junit.build.dest.dir" );
-        File toDir = new File( destdirname ); 
+        File toDir = new File( m_Context.getProjectDir(), destdirname ); 
         toDir.mkdirs();
                 
         String srcdirname = m_Context.getProperty( "junit.build.src.dir" );
-        File fromDir = new File( srcdirname ); 
+        File fromDir = new File( m_Context.getProjectDir(), srcdirname ); 
         
         JavacPlugin javac = (JavacPlugin) m_JavacPlugin;
         

Modified: avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh
==============================================================================
--- avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh	(original)
+++ avalon/trunk/tools/magic/xdoc/src/dist/magic.bsh	Sat Jun  5 11:09:30 2004
@@ -71,13 +71,13 @@
         
         getLogger().info( "Start XDoc generation." );
         
-        File srcDir = new File( m_Context.getProperty( "xdoc.src.dir" ) );
+        File srcDir = new File( m_Context.getProjectDir(), m_Context.getProperty( "xdoc.src.dir"
) );
         if( ! srcDir.exists() )
         {
             getLogger().warn( "Xdocs source directory does not exist:" + srcDir );
             return;
         }
-        File destDir = new File( m_Context.getProperty( "xdoc.build.src.dir" ) );
+        File destDir = new File( m_Context.getProjectDir(), m_Context.getProperty( "xdoc.build.src.dir"
) );
 
         String theme = m_Context.getProperty( "xdoc.theme.name" );
         String output = m_Context.getProperty( "xdoc.output.format" );
@@ -98,7 +98,7 @@
             File dir = new File( themeDir, "resources" );
             copyResources( dir );
             
-            dir = new File( m_Context.getProperty( "xdoc.resources.dir" ) );
+            dir = new File( m_Context.getProjectDir(), m_Context.getProperty( "xdoc.resources.dir"
) );
             copyResources( dir );
         } 
         catch( RuntimeException e )
@@ -114,8 +114,8 @@
         getLogger().debug( "Converting Navigation." );
         File xslFile = new File( themeDir,  "nav-aggregate.xsl" );
         String srcDir = m_Context.getProperty( "xdoc.src.dir" );
-        File fromDir = new File( srcDir );
-        File toDir = new File( m_Context.getProperty( "xdoc.build.src.dir" ) );
+        File fromDir = new File( m_Context.getProjectDir(), srcDir );
+        File toDir = new File( m_Context.getProjectDir(), m_Context.getProperty( "xdoc.build.src.dir"
) );
         String sep = File.separatorChar == '\\' ? "\\\\" : File.separator;
         transformTrax( fromDir, toDir, xslFile, "^.*" + sep + "navigation.xml$", "", ".xml",
"xml" );
     }
@@ -126,8 +126,8 @@
         getLogger().debug( "Converting XML documents." );
         File xslFile = new File( themeDir,  "transform.xsl" );
         String srcDir = m_Context.getProperty( "xdoc.build.src.dir" );
-        File fromDir = new File( srcDir );
-        File toDir = new File( m_Context.getProperty( "xdoc.dest.dir" ) );
+        File fromDir = new File( m_Context.getProjectDir(), srcDir );
+        File toDir = new File( m_Context.getProjectDir(), m_Context.getProperty( "xdoc.dest.dir"
) );
         String output = m_Context.getProperty( "xdoc.output.format" );
         String sep = File.separatorChar == '\\' ? "\\\\" : File.separator;
         transformTrax( fromDir, toDir, xslFile, "^.*\\.xml$", "^.*" + sep + "navigation.xml$",
"." + output, "html" );
@@ -135,7 +135,7 @@
     
     private void copyResources( File fromDir )
     {
-        File destDir = new File( m_Context.getProperty( "xdoc.dest.dir" ) );
+        File destDir = new File( m_Context.getProjectDir(), m_Context.getProperty( "xdoc.dest.dir"
) );
         PreparePlugin prepare = (PreparePlugin) m_PreparePlugin;
         
         prepare.copy( fromDir, destDir, "**/*", "", false );

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message