maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r422907 [1/3] - in /maven/plugins/branches/MASSEMBLY-124: ./ src/functional-tests/ src/functional-tests/java/org/apache/maven/plugin/assembly/ src/main/java/org/apache/maven/plugin/assembly/ src/main/java/org/apache/maven/plugin/assembly/ar...
Date Mon, 17 Jul 2006 22:35:00 GMT
Author: jdcasey
Date: Mon Jul 17 15:34:58 2006
New Revision: 422907

URL: http://svn.apache.org/viewvc?rev=422907&view=rev
Log:
Finished with main refactoring...now to add tests.

Added:
    maven/plugins/branches/MASSEMBLY-124/src/functional-tests/
      - copied from r421932, maven/plugins/branches/MASSEMBLY-124/src/test/
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/ComponentsXmlArchiverFileFilter.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractAssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractDirectoryMojo.java
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AttachedAssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/DirectoryInlineMojo.java
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/DirectoryMojo.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/SingleAssemblyMojo.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/SingleAssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/UnpackMojo.java   (contents, props changed)
      - copied, changed from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/UnpackMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFileUtils.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java   (with props)
    maven/plugins/branches/MASSEMBLY-124/src/test/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/org/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/org/apache/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/org/apache/maven/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/org/apache/maven/plugin/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/org/apache/maven/plugin/assembly/
    maven/plugins/branches/MASSEMBLY-124/src/test/java/org/apache/maven/plugin/assembly/interpolation/
Removed:
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractAssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractUnpackingMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AttachedAssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/ComponentsXmlArchiverFileFilter.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/SingleAssemblyMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/UnpackMojo.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/interpolation/ReflectionProperties.java
Modified:
    maven/plugins/branches/MASSEMBLY-124/pom.xml
    maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java
    maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java
    maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java
    maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/UnpackMojoTest.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/repository/DefaultRepositoryAssembler.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/repository/RepositoryAssembler.java
    maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java

Modified: maven/plugins/branches/MASSEMBLY-124/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/pom.xml?rev=422907&r1=422906&r2=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/pom.xml (original)
+++ maven/plugins/branches/MASSEMBLY-124/pom.xml Mon Jul 17 15:34:58 2006
@@ -5,7 +5,7 @@
     <version>1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>maven-assembly-plugin</artifactId>
+  <artifactId>maven-assembly-plugin.MASSEMBLY-124</artifactId>
   <packaging>maven-plugin</packaging>
   <name>Maven Assembly Plugin</name>
   <version>2.2-SNAPSHOT</version>
@@ -125,7 +125,7 @@
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>file-management</artifactId>
-      <version>1.0</version>
+      <version>1.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>

Modified: maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java?rev=422907&r1=421932&r2=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java Mon Jul 17 15:34:58 2006
@@ -20,6 +20,7 @@
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.assembly.mojos.AssemblyMojo;
 import org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub;
 import org.apache.maven.plugin.assembly.stubs.JarArchiverStub;
 import org.apache.maven.plugin.assembly.stubs.ReactorMavenProjectStub;

Modified: maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java?rev=422907&r1=421932&r2=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java Mon Jul 17 15:34:58 2006
@@ -1,5 +1,6 @@
 package org.apache.maven.plugin.assembly;
 
+import org.apache.maven.plugin.assembly.mojos.DirectoryInlineMojo;
 import org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.project.MavenProject;

Modified: maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java?rev=422907&r1=421932&r2=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java Mon Jul 17 15:34:58 2006
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.maven.plugin.assembly.mojos.DirectoryMojo;
 import org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.project.MavenProject;

Modified: maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/UnpackMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/UnpackMojoTest.java?rev=422907&r1=421932&r2=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/UnpackMojoTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/functional-tests/java/org/apache/maven/plugin/assembly/UnpackMojoTest.java Mon Jul 17 15:34:58 2006
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.assembly.mojos.UnpackMojo;
 import org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub;
 import org.apache.maven.plugin.assembly.stubs.UnArchiverWithException;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,56 @@
+package org.apache.maven.plugin.assembly;
+
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.util.List;
+
+
+public interface AssemblerConfigurationSource
+{
+
+    File getDescriptor();
+
+    String getDescriptorId();
+
+    File[] getDescriptors();
+
+    String[] getDescriptorReferences();
+
+    File getDescriptorSourceDirectory();
+
+    File getBasedir();
+
+    MavenProject getProject();
+
+    boolean isSiteIncluded();
+
+    File getSiteDirectory();
+
+    String getFinalName();
+
+    boolean isAssemblyIdAppended();
+
+    String getClassifier();
+
+    String getTarLongFileMode();
+
+    File getOutputDirectory();
+
+    File getWorkingDirectory();
+
+    MavenArchiveConfiguration getJarArchiveConfiguration();
+
+    ArtifactRepository getLocalRepository();
+
+    File getTemporaryRootDirectory();
+
+    File getArchiveBaseDirectory();
+
+    List getFilters();
+
+    List getReactorProjects();
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,103 @@
+package org.apache.maven.plugin.assembly.archive;
+
+import org.apache.maven.plugin.assembly.filter.ComponentsXmlArchiverFileFilter;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class ArchiveAssemblyUtils
+{
+
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    private ArchiveAssemblyUtils()
+    {
+    }
+
+    public static void addDirectory( Archiver archiver, File directory, String output, List includes,
+                                     List fileSetExcludes, ComponentsXmlArchiverFileFilter componentsXmlFilter )
+        throws ArchiveCreationException
+    {
+        // TODO Handle this in the archiver!
+        List excludes = new ArrayList( fileSetExcludes );
+        excludes.addAll( FileUtils.getDefaultExcludesAsList() );
+        
+        if ( directory.exists() )
+        {
+            List adaptedExcludes = excludes;
+
+            // TODO: more robust set of filters on added files in the archiver
+            File componentsXml = new File( directory, ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH );
+            if ( componentsXml.exists() )
+            {
+                try
+                {
+                    componentsXmlFilter.addComponentsXml( componentsXml );
+                }
+                catch ( IOException e )
+                {
+                    throw new ArchiveCreationException( "Error reading components.xml to merge: " + e.getMessage(), e );
+                }
+                catch ( XmlPullParserException e )
+                {
+                    throw new ArchiveCreationException( "Error reading components.xml to merge: " + e.getMessage(), e );
+                }
+                adaptedExcludes = new ArrayList( excludes );
+                adaptedExcludes.add( ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH );
+            }
+
+            try
+            {
+                String[] includesArray = (String[]) includes.toArray( EMPTY_STRING_ARRAY );
+                String[] excludesArray = (String[]) adaptedExcludes.toArray( EMPTY_STRING_ARRAY );
+                
+                archiver.addDirectory( directory, output, includesArray, excludesArray );
+            }
+            catch ( ArchiverException e )
+            {
+                throw new ArchiveCreationException( "Error adding directory to archive: " + e.getMessage(), e );
+            }
+        }
+    }
+
+    /**
+     * Unpacks the archive file.
+     * 
+     * @param file
+     *            File to be unpacked.
+     * @param location
+     *            Location where to put the unpacked files.
+     */
+    public static void unpack( File file, File location, ArchiverManager archiverManager )
+        throws ArchiveExpansionException, NoSuchArchiverException
+    {
+        try
+        {
+            UnArchiver unArchiver = archiverManager.getUnArchiver( file );
+
+            unArchiver.setSourceFile( file );
+
+            unArchiver.setDestDirectory( location );
+
+            unArchiver.extract();
+        }
+        catch ( IOException e )
+        {
+            throw new ArchiveExpansionException( "Error unpacking file: " + file + "to: " + location, e );
+        }
+        catch ( ArchiverException e )
+        {
+            throw new ArchiveExpansionException( "Error unpacking file: " + file + "to: " + location, e );
+        }
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveAssemblyUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,18 @@
+package org.apache.maven.plugin.assembly.archive;
+
+
+public class ArchiveCreationException
+    extends Exception
+{
+
+    public ArchiveCreationException( String message, Throwable error )
+    {
+        super( message, error );
+    }
+
+    public ArchiveCreationException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveCreationException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,18 @@
+package org.apache.maven.plugin.assembly.archive;
+
+
+public class ArchiveExpansionException
+    extends Exception
+{
+
+    public ArchiveExpansionException( String message, Throwable error )
+    {
+        super( message, error );
+    }
+
+    public ArchiveExpansionException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/ArchiveExpansionException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,17 @@
+package org.apache.maven.plugin.assembly.archive;
+
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
+import org.apache.maven.plugins.assembly.model.Assembly;
+
+import java.io.File;
+
+
+public interface AssemblyArchiver
+{
+    String ROLE = AssemblyArchiver.class.getName();
+
+    File createArchive( Assembly assembly, String fullName, String format, AssemblerConfigurationSource configSource )
+        throws ArchiveCreationException, AssemblyFormattingException;
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/AssemblyArchiver.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,895 @@
+package org.apache.maven.plugin.assembly.archive;
+
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.filter.AssemblyExcludesArtifactFilter;
+import org.apache.maven.plugin.assembly.filter.AssemblyIncludesArtifactFilter;
+import org.apache.maven.plugin.assembly.filter.AssemblyScopeArtifactFilter;
+import org.apache.maven.plugin.assembly.filter.ComponentsXmlArchiverFileFilter;
+import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
+import org.apache.maven.plugin.assembly.format.FileFormatter;
+import org.apache.maven.plugin.assembly.format.FileSetFormatter;
+import org.apache.maven.plugin.assembly.repository.RepositoryAssembler;
+import org.apache.maven.plugin.assembly.repository.RepositoryAssemblyException;
+import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
+import org.apache.maven.plugin.assembly.utils.FilterUtils;
+import org.apache.maven.plugin.assembly.utils.ProjectUtils;
+import org.apache.maven.plugins.assembly.model.Assembly;
+import org.apache.maven.plugins.assembly.model.DependencySet;
+import org.apache.maven.plugins.assembly.model.FileItem;
+import org.apache.maven.plugins.assembly.model.FileSet;
+import org.apache.maven.plugins.assembly.model.ModuleBinaries;
+import org.apache.maven.plugins.assembly.model.ModuleSet;
+import org.apache.maven.plugins.assembly.model.ModuleSources;
+import org.apache.maven.plugins.assembly.model.Repository;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.model.fileset.util.FileSetManager;
+import org.apache.maven.wagon.PathUtils;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.jar.Manifest;
+import org.codehaus.plexus.archiver.jar.ManifestException;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.archiver.tar.TarArchiver;
+import org.codehaus.plexus.archiver.tar.TarLongFileMode;
+import org.codehaus.plexus.archiver.war.WarArchiver;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @plexus.component role="org.apache.maven.plugin.assembly.archive.ArchiveCreator"
+ *                   role-hint="default"
+ */
+public class DefaultAssemblyArchiver
+    extends AbstractLogEnabled
+    implements AssemblyArchiver
+{
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchiverManager archiverManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private RepositoryAssembler repositoryAssembler;
+
+    public File createArchive( Assembly assembly, String fullName, String format,
+                               AssemblerConfigurationSource configSource )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        File destFile = null;
+
+        String filename = fullName + "." + format;
+
+        try
+        {
+            Archiver archiver = createArchiver( format, configSource.getTarLongFileMode() );
+
+            destFile = createArchive( archiver, assembly, filename, configSource );
+        }
+        catch ( NoSuchArchiverException e )
+        {
+            throw new ArchiveCreationException( "Unable to obtain archiver for extension '" + format + "'" );
+        }
+        catch ( ArchiverException e )
+        {
+            throw new ArchiveCreationException( "Error creating assembly: " + e.getMessage(), e );
+        }
+
+        return destFile;
+    }
+
+    /**
+     * Creates the necessary archiver to build the distribution file.
+     * 
+     * @param format
+     *            Archive format
+     * @param tarLongFileMode
+     * @return archiver Archiver generated
+     * @throws org.codehaus.plexus.archiver.ArchiverException
+     * @throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException
+     */
+    protected Archiver createArchiver( String format, String tarLongFileMode )
+        throws ArchiverException, NoSuchArchiverException
+    {
+        Archiver archiver;
+        if ( format.startsWith( "tar" ) )
+        {
+            TarArchiver tarArchiver = (TarArchiver) this.archiverManager.getArchiver( "tar" );
+            archiver = tarArchiver;
+            int index = format.indexOf( '.' );
+            if ( index >= 0 )
+            {
+                // TODO: this needs a cleanup in plexus archiver - use a real
+                // typesafe enum
+                TarArchiver.TarCompressionMethod tarCompressionMethod = new TarArchiver.TarCompressionMethod();
+                // TODO: this should accept gz and bz2 as well so we can skip
+                // over the switch
+                String compression = format.substring( index + 1 );
+                if ( "gz".equals( compression ) )
+                {
+                    tarCompressionMethod.setValue( "gzip" );
+                }
+                else if ( "bz2".equals( compression ) )
+                {
+                    tarCompressionMethod.setValue( "bzip2" );
+                }
+                else
+                {
+                    // TODO: better handling
+                    throw new IllegalArgumentException( "Unknown compression format: " + compression );
+                }
+                tarArchiver.setCompression( tarCompressionMethod );
+
+                TarLongFileMode tarFileMode = new TarLongFileMode();
+
+                tarFileMode.setValue( tarLongFileMode );
+
+                tarArchiver.setLongfile( tarFileMode );
+            }
+        }
+        else if ( "war".equals( format ) )
+        {
+            WarArchiver warArchiver = (WarArchiver) this.archiverManager.getArchiver( "war" );
+            warArchiver.setIgnoreWebxml( false ); // See MNG-1274
+            archiver = warArchiver;
+        }
+        else
+        {
+            archiver = this.archiverManager.getArchiver( format );
+        }
+
+        return archiver;
+    }
+
+    protected File createArchive( Archiver archiver, Assembly assembly, String filename,
+                                  AssemblerConfigurationSource configSource )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        ComponentsXmlArchiverFileFilter componentsXmlFilter = new ComponentsXmlArchiverFileFilter();
+
+        addAssemblyRepositories( archiver, assembly, configSource );
+        addAssemblyDependencySets( archiver, assembly, configSource, componentsXmlFilter );
+        addAssemblyModules( archiver, assembly, configSource, componentsXmlFilter );
+        addAssemblyFileSets( archiver, assembly, configSource, componentsXmlFilter );
+        addAssemblyFileList( archiver, assembly, configSource, componentsXmlFilter );
+
+        MavenArchiveConfiguration archive = configSource.getJarArchiveConfiguration();
+
+        try
+        {
+            componentsXmlFilter.addToArchive( archiver );
+        }
+        catch ( IOException e )
+        {
+            throw new ArchiveCreationException( "Error adding component descriptors to assembly archive: "
+                + e.getMessage(), e );
+        }
+        catch ( ArchiverException e )
+        {
+            throw new ArchiveCreationException( "Error adding component descriptors to assembly archive: "
+                + e.getMessage(), e );
+        }
+
+        File outputDirectory = configSource.getOutputDirectory();
+        File destFile = new File( outputDirectory, filename );
+
+        if ( archiver instanceof JarArchiver )
+        {
+            // TODO: I'd really prefer to rewrite MavenArchiver as either a
+            // separate manifest creation utility (and to
+            // create an include pom.properties etc into another archiver), or
+            // an implementation of an archiver
+            // (the first is preferable).
+            MavenArchiver mavenArchiver = new MavenArchiver();
+
+            if ( archive != null )
+            {
+                try
+                {
+                    Manifest manifest;
+                    File manifestFile = archive.getManifestFile();
+
+                    if ( manifestFile != null )
+                    {
+                        try
+                        {
+                            manifest = new Manifest( new FileReader( manifestFile ) );
+                        }
+                        catch ( FileNotFoundException e )
+                        {
+                            throw new ArchiveCreationException( "Manifest not found: " + e.getMessage() );
+                        }
+                        catch ( IOException e )
+                        {
+                            throw new ArchiveCreationException( "Error processing manifest: " + e.getMessage(), e );
+                        }
+                    }
+                    else
+                    {
+                        manifest = mavenArchiver.getManifest( configSource.getProject(), archive.getManifest() );
+                    }
+
+                    if ( manifest != null )
+                    {
+                        JarArchiver jarArchiver = (JarArchiver) archiver;
+                        jarArchiver.addConfiguredManifest( manifest );
+                    }
+                }
+                catch ( ManifestException e )
+                {
+                    throw new ArchiveCreationException( "Error creating manifest: " + e.getMessage(), e );
+                }
+                catch ( DependencyResolutionRequiredException e )
+                {
+                    throw new ArchiveCreationException( "Dependencies were not resolved: " + e.getMessage(), e );
+                }
+            }
+        }
+
+        archiver.setDestFile( destFile );
+        try
+        {
+            archiver.createArchive();
+        }
+        catch ( ArchiverException e )
+        {
+            throw new ArchiveCreationException( "Error creating assembly archive: " + e.getMessage(), e );
+        }
+        catch ( IOException e )
+        {
+            throw new ArchiveCreationException( "Error creating assembly archive: " + e.getMessage(), e );
+        }
+
+        return destFile;
+    }
+
+    protected void addAssemblyRepositories( Archiver archiver, Assembly assembly,
+                                            AssemblerConfigurationSource configSource )
+        throws ArchiveCreationException
+    {
+        List modulesList = assembly.getModuleSets();
+        boolean includeBaseDirectory = assembly.isIncludeBaseDirectory();
+        File tempRoot = configSource.getTemporaryRootDirectory();
+
+        for ( Iterator i = modulesList.iterator(); i.hasNext(); )
+        {
+            Repository repository = (Repository) i.next();
+
+            File repositoryDirectory = new File( tempRoot, repository.getOutputDirectory() );
+
+            if ( !repositoryDirectory.exists() )
+            {
+                repositoryDirectory.mkdirs();
+            }
+
+            try
+            {
+                repositoryAssembler.assemble( repositoryDirectory, repository, configSource );
+            }
+            catch ( RepositoryAssemblyException e )
+            {
+                throw new ArchiveCreationException( "Failed to assembly repository: " + e.getMessage(), e );
+            }
+
+            try
+            {
+                if ( includeBaseDirectory )
+                {
+                    archiver.addDirectory( repositoryDirectory, repository.getOutputDirectory() + "/" );
+                }
+                else
+                {
+                    archiver.addDirectory( repositoryDirectory );
+                }
+            }
+            catch ( ArchiverException e )
+            {
+                throw new ArchiveCreationException( "Error adding directory to archive: " + e.getMessage(), e );
+            }
+        }
+    }
+
+    protected void addAssemblyDependencySets( Archiver archiver, Assembly assembly,
+                                              AssemblerConfigurationSource configSource,
+                                              ComponentsXmlArchiverFileFilter componentsXmlFilter )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        List dependencySets = assembly.getDependencySets();
+        MavenProject project = configSource.getProject();
+        boolean includeBaseDirectory = assembly.isIncludeBaseDirectory();
+
+        for ( Iterator i = dependencySets.iterator(); i.hasNext(); )
+        {
+            DependencySet dependencySet = (DependencySet) i.next();
+            String output = dependencySet.getOutputDirectory();
+            output = AssemblyFormatUtils.getOutputDirectory( output, project, configSource.getFinalName(),
+                includeBaseDirectory );
+
+            archiver.setDefaultDirectoryMode( Integer.parseInt( dependencySet.getDirectoryMode(), 8 ) );
+
+            archiver.setDefaultFileMode( Integer.parseInt( dependencySet.getFileMode(), 8 ) );
+
+            getLogger().debug(
+                "DependencySet[" + output + "]" + " dir perms: "
+                    + Integer.toString( archiver.getDefaultDirectoryMode(), 8 ) + " file perms: "
+                    + Integer.toString( archiver.getDefaultFileMode(), 8 ) );
+
+            Set allDependencyArtifacts = ProjectUtils.getDependencies( project );
+            Set dependencyArtifacts = new HashSet( allDependencyArtifacts );
+
+            AssemblyScopeArtifactFilter scopeFilter = new AssemblyScopeArtifactFilter( dependencySet.getScope() );
+
+            FilterUtils.filterArtifacts( dependencyArtifacts, dependencySet.getIncludes(), dependencySet.getExcludes(),
+                true, Collections.singletonList( scopeFilter ) );
+
+            File workDirectory = configSource.getWorkingDirectory();
+
+            for ( Iterator j = dependencyArtifacts.iterator(); j.hasNext(); )
+            {
+                Artifact artifact = (Artifact) j.next();
+
+                String fileNameMapping = AssemblyFormatUtils.evaluateFileNameMapping( dependencySet
+                    .getOutputFileNameMapping(), artifact );
+                if ( dependencySet.isUnpack() )
+                {
+                    // TODO: something like zipfileset in plexus-archiver
+                    // archiver.addJar( )
+
+                    File tempLocation = new File( workDirectory, fileNameMapping );
+                    boolean process = false;
+                    if ( !tempLocation.exists() )
+                    {
+                        tempLocation.mkdirs();
+                        process = true;
+                    }
+                    else if ( artifact.getFile().lastModified() > tempLocation.lastModified() )
+                    {
+                        process = true;
+                    }
+
+                    if ( process )
+                    {
+                        try
+                        {
+                            ArchiveAssemblyUtils.unpack( artifact.getFile(), tempLocation, archiverManager );
+                        }
+                        catch ( NoSuchArchiverException e )
+                        {
+                            throw new ArchiveCreationException( "Unable to obtain unarchiver for file '"
+                                + artifact.getFile() + "'" );
+                        }
+                        catch ( ArchiveExpansionException e )
+                        {
+                            throw new ArchiveCreationException( "Unable to expand archive: '" + artifact.getFile()
+                                + "'" );
+                        }
+
+                        /*
+                         * If the assembly is 'jar-with-dependencies', remove
+                         * the security files in all dependencies that will
+                         * prevent the uberjar to execute. Please see
+                         * MASSEMBLY-64 for details.
+                         */
+                        if ( archiver instanceof JarArchiver )
+                        {
+                            String[] securityFiles = { "*.RSA", "*.DSA", "*.SF", "*.rsa", "*.dsa", "*.sf" };
+                            org.apache.maven.shared.model.fileset.FileSet securityFileSet = new org.apache.maven.shared.model.fileset.FileSet();
+                            securityFileSet.setDirectory( tempLocation.getAbsolutePath() + "/META-INF/" );
+
+                            for ( int sfsi = 0; sfsi < securityFiles.length; sfsi++ )
+                            {
+                                securityFileSet.addInclude( securityFiles[sfsi] );
+                            }
+
+                            FileSetManager fsm = new FileSetManager( getLogger() );
+                            try
+                            {
+                                fsm.delete( securityFileSet );
+                            }
+                            catch ( IOException e )
+                            {
+                                throw new ArchiveCreationException( "Failed to delete security files: "
+                                    + e.getMessage(), e );
+                            }
+                        }
+                    }
+
+                    ArchiveAssemblyUtils.addDirectory( archiver, tempLocation, output, null, FileUtils
+                        .getDefaultExcludesAsList(), componentsXmlFilter );
+                }
+                else
+                {
+                    try
+                    {
+                        archiver.addFile( artifact.getFile(), output + fileNameMapping );
+                    }
+                    catch ( ArchiverException e )
+                    {
+                        throw new ArchiveCreationException( "Error adding file '" + artifact.getFile()
+                            + "' to archive: " + e.getMessage(), e );
+                    }
+                }
+            }
+
+            allDependencyArtifacts.removeAll( dependencyArtifacts );
+
+            for ( Iterator it = allDependencyArtifacts.iterator(); it.hasNext(); )
+            {
+                Artifact artifact = (Artifact) it.next();
+
+                // would be better to have a way to find out when a specified
+                // include or exclude
+                // is never triggered and warn() it.
+                getLogger().debug( "artifact: " + artifact + " not included" );
+            }
+        }
+    }
+
+    /**
+     * Process Files that will be included in the distribution.
+     * 
+     * @param archiver
+     * @param componentsXmlFilter
+     * @param fileSets
+     * @param includeBaseDirecetory
+     * @throws ArchiveCreationException
+     * @throws IOException
+     * @throws AssemblyFormattingException
+     * @throws IOException
+     */
+    protected void addAssemblyFileSets( Archiver archiver, Assembly assembly,
+                                        AssemblerConfigurationSource configSource,
+                                        ComponentsXmlArchiverFileFilter componentsXmlFilter )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        List fileSets = assembly.getFileSets();
+        boolean includeBaseDirectory = assembly.isIncludeBaseDirectory();
+
+        addFileSets( archiver, fileSets, includeBaseDirectory, configSource, componentsXmlFilter );
+    }
+
+    private void addFileSets( Archiver archiver, List fileSets, boolean includeBaseDirectory,
+                              AssemblerConfigurationSource configSource,
+                              ComponentsXmlArchiverFileFilter componentsXmlFilter )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        File archiveBaseDir = configSource.getArchiveBaseDirectory();
+
+        if ( archiveBaseDir != null )
+        {
+            if ( !archiveBaseDir.exists() )
+            {
+                throw new ArchiveCreationException( "The archive base directory '" + archiveBaseDir.getAbsolutePath()
+                    + "' does not exist" );
+            }
+            else if ( !archiveBaseDir.isDirectory() )
+            {
+                throw new ArchiveCreationException( "The archive base directory '" + archiveBaseDir.getAbsolutePath()
+                    + "' exists, but it is not a directory" );
+            }
+        }
+
+        File basedir = configSource.getBasedir();
+        MavenProject project = configSource.getProject();
+
+        FileSetFormatter fileSetFormatter = new FileSetFormatter( configSource, getLogger() );
+
+        for ( Iterator i = fileSets.iterator(); i.hasNext(); )
+        {
+            FileSet fileSet = (FileSet) i.next();
+            String directory = fileSet.getDirectory();
+            String output = fileSet.getOutputDirectory();
+
+            if ( output == null )
+            {
+                output = directory;
+            }
+
+            if ( getLogger().isDebugEnabled() )
+            {
+                getLogger().debug(
+                    "FileSet[" + output + "]" + " dir perms: "
+                        + Integer.toString( archiver.getDefaultDirectoryMode(), 8 ) + " file perms: "
+                        + Integer.toString( archiver.getDefaultFileMode(), 8 )
+                        + (fileSet.getLineEnding() == null ? "" : " lineEndings: " + fileSet.getLineEnding()) );
+            }
+
+            output = AssemblyFormatUtils.getOutputDirectory( output, project, configSource.getFinalName(),
+                includeBaseDirectory );
+
+            archiver.setDefaultDirectoryMode( Integer.parseInt( fileSet.getDirectoryMode(), 8 ) );
+
+            archiver.setDefaultFileMode( Integer.parseInt( fileSet.getFileMode(), 8 ) );
+
+            if ( directory == null )
+            {
+                directory = basedir.getAbsolutePath();
+            }
+
+            File fileSetDir = null;
+
+            if ( archiveBaseDir == null )
+            {
+                fileSetDir = new File( directory );
+            }
+            else
+            {
+                fileSetDir = new File( archiveBaseDir, directory );
+            }
+
+            getLogger().debug( "The archive base directory is '" + archiveBaseDir.getAbsolutePath() + "'" );
+
+            if ( !fileSetDir.isAbsolute() )
+            {
+                fileSetDir = new File( basedir, directory );
+            }
+
+            if ( archiveBaseDir.exists() )
+            {
+                try
+                {
+                    archiveBaseDir = fileSetFormatter.formatFileSetForAssembly( archiveBaseDir, fileSet );
+                }
+                catch ( IOException e )
+                {
+                    throw new ArchiveCreationException( "Error fixing file-set line endings for assembly: "
+                        + e.getMessage(), e );
+                }
+
+                getLogger().debug( "Archive base directory: '" + archiveBaseDir.getAbsolutePath() + "'" );
+
+                ArchiveAssemblyUtils.addDirectory( archiver, archiveBaseDir, output, fileSet.getIncludes(), fileSet
+                    .getExcludes(), componentsXmlFilter );
+            }
+        }
+    }
+
+    /**
+     * Copy files to the distribution with option to change destination name
+     * 
+     * @param archiver
+     * @param componentsXmlFilter
+     * @param fileList
+     * @throws ArchiveCreationException
+     * @throws AssemblyFormattingException
+     */
+    protected void addAssemblyFileList( Archiver archiver, Assembly assembly,
+                                        AssemblerConfigurationSource configSource,
+                                        ComponentsXmlArchiverFileFilter componentsXmlFilter )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        List fileList = assembly.getFiles();
+        File basedir = configSource.getBasedir();
+
+        FileFormatter fileFormatter = new FileFormatter( configSource, getLogger() );
+        for ( Iterator i = fileList.iterator(); i.hasNext(); )
+        {
+            FileItem fileItem = (FileItem) i.next();
+
+            String sourcePath = fileItem.getSource();
+
+            // ensure source file is in absolute path for reactor build to work
+            File source = new File( sourcePath );
+
+            // save the original sourcefile's name, because filtration may
+            // create a temp file with a different name.
+            String sourceName = source.getName();
+
+            if ( !source.isAbsolute() )
+            {
+                source = new File( basedir, sourcePath );
+            }
+
+            fileFormatter.format( source, fileItem.isFiltered(), fileItem.getLineEnding() );
+
+            String destName = fileItem.getDestName();
+
+            if ( destName == null )
+            {
+                destName = sourceName;
+            }
+
+            String outputDirectory = AssemblyFormatUtils.getOutputDirectory( fileItem.getOutputDirectory(),
+                configSource.getProject(), configSource.getFinalName(), assembly.isIncludeBaseDirectory() );
+
+            String target;
+
+            // omit the last char if ends with / or \\
+            if ( outputDirectory.endsWith( "/" ) || outputDirectory.endsWith( "\\" ) )
+            {
+                target = outputDirectory + destName;
+            }
+            else
+            {
+                target = outputDirectory + "/" + destName;
+            }
+
+            try
+            {
+                archiver.addFile( source, target, Integer.parseInt( fileItem.getFileMode() ) );
+            }
+            catch ( ArchiverException e )
+            {
+                throw new ArchiveCreationException( "Error adding file to archive: " + e.getMessage(), e );
+            }
+        }
+    }
+
+    private void addAssemblyModules( Archiver archiver, Assembly assembly, AssemblerConfigurationSource configSource,
+                                     ComponentsXmlArchiverFileFilter componentsXmlFilter )
+        throws ArchiveCreationException, AssemblyFormattingException
+    {
+        List moduleSets = assembly.getModuleSets();
+        MavenProject project = configSource.getProject();
+        boolean includeBaseDirectory = assembly.isIncludeBaseDirectory();
+        File workDirectory = configSource.getWorkingDirectory();
+
+        for ( Iterator i = moduleSets.iterator(); i.hasNext(); )
+        {
+            ModuleSet moduleSet = (ModuleSet) i.next();
+
+            AndArtifactFilter moduleFilter = new AndArtifactFilter();
+
+            if ( !moduleSet.getIncludes().isEmpty() )
+            {
+                moduleFilter.add( new AssemblyIncludesArtifactFilter( moduleSet.getIncludes() ) );
+            }
+            if ( !moduleSet.getExcludes().isEmpty() )
+            {
+                moduleFilter.add( new AssemblyExcludesArtifactFilter( moduleSet.getExcludes() ) );
+            }
+
+            Set allModuleProjects;
+            try
+            {
+                allModuleProjects = ProjectUtils.getProjectModules( project, configSource.getReactorProjects() );
+            }
+            catch ( IOException e )
+            {
+                throw new ArchiveCreationException( "Error retrieving module-set for project: " + project.getId()
+                    + ": " + e.getMessage(), e );
+            }
+
+            // FIXME: Check source from here down to bum redundant code and
+            // consolidate with existing utils.
+            Set moduleProjects = new HashSet( allModuleProjects );
+
+            FilterUtils.filterProjects( moduleProjects, moduleSet.getIncludes(), moduleSet.getExcludes(), false );
+
+            List moduleFileSets = new ArrayList();
+
+            for ( Iterator j = moduleProjects.iterator(); j.hasNext(); )
+            {
+                MavenProject moduleProject = (MavenProject) j.next();
+
+                String name = moduleProject.getBuild().getFinalName();
+
+                ModuleSources sources = moduleSet.getSources();
+
+                if ( sources != null )
+                {
+                    String output = sources.getOutputDirectory();
+                    output = AssemblyFormatUtils.getOutputDirectory( output, moduleProject, configSource
+                        .getFinalName(), includeBaseDirectory );
+
+                    FileSet moduleFileSet = new FileSet();
+
+                    moduleFileSet.setDirectory( moduleProject.getBasedir().getAbsolutePath() );
+                    moduleFileSet.setOutputDirectory( output );
+
+                    List excludesList = new ArrayList();
+                    excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(), moduleProject.getBuild()
+                        .getDirectory() )
+                        + "/**" );
+                    excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(), moduleProject.getBuild()
+                        .getOutputDirectory() )
+                        + "/**" );
+                    excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(), moduleProject.getBuild()
+                        .getTestOutputDirectory() )
+                        + "/**" );
+                    excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(), moduleProject.getReporting()
+                        .getOutputDirectory() )
+                        + "/**" );
+                    moduleFileSet.setExcludes( excludesList );
+
+                    moduleFileSets.add( moduleFileSet );
+                }
+
+                ModuleBinaries binaries = moduleSet.getBinaries();
+
+                if ( binaries != null )
+                {
+                    Artifact moduleArtifact = moduleProject.getArtifact();
+
+                    if ( moduleArtifact.getFile() == null )
+                    {
+                        throw new ArchiveCreationException(
+                            "Included module: "
+                                + moduleProject.getId()
+                                + " does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated." );
+                    }
+
+                    String output = binaries.getOutputDirectory();
+                    output = AssemblyFormatUtils.getOutputDirectory( output, moduleProject, configSource
+                        .getFinalName(), includeBaseDirectory );
+
+                    archiver.setDefaultDirectoryMode( Integer.parseInt( binaries.getDirectoryMode(), 8 ) );
+
+                    archiver.setDefaultFileMode( Integer.parseInt( binaries.getFileMode(), 8 ) );
+
+                    getLogger().debug(
+                        "ModuleSet[" + output + "]" + " dir perms: "
+                            + Integer.toString( archiver.getDefaultDirectoryMode(), 8 ) + " file perms: "
+                            + Integer.toString( archiver.getDefaultFileMode(), 8 ) );
+
+                    Set binaryDependencies = moduleProject.getArtifacts();
+
+                    List includes = binaries.getIncludes();
+                    List excludes = binaries.getExcludes();
+
+                    FilterUtils.filterArtifacts( binaryDependencies, includes, excludes, true, Collections.EMPTY_LIST );
+
+                    if ( binaries.isUnpack() )
+                    {
+                        // TODO: something like zipfileset in plexus-archiver
+                        // archiver.addJar( )
+
+                        // TODO refactor into the AbstractUnpackMojo
+                        File tempLocation = new File( workDirectory, name );
+                        boolean process = false;
+                        if ( !tempLocation.exists() )
+                        {
+                            tempLocation.mkdirs();
+                            process = true;
+                        }
+                        else if ( moduleArtifact.getFile().lastModified() > tempLocation.lastModified() )
+                        {
+                            process = true;
+                        }
+
+                        if ( process )
+                        {
+                            try
+                            {
+                                try
+                                {
+                                    ArchiveAssemblyUtils.unpack( moduleArtifact.getFile(), tempLocation,
+                                        archiverManager );
+                                }
+                                catch ( ArchiveExpansionException e )
+                                {
+                                    throw new ArchiveCreationException( "Unable to unpack module artifact: '"
+                                        + moduleArtifact.getFile() + "'" );
+                                }
+
+                                if ( binaries.isIncludeDependencies() )
+                                {
+                                    for ( Iterator dependencyIterator = binaryDependencies.iterator(); dependencyIterator
+                                        .hasNext(); )
+                                    {
+                                        Artifact dependencyArtifact = (Artifact) dependencyIterator.next();
+
+                                        try
+                                        {
+                                            ArchiveAssemblyUtils.unpack( dependencyArtifact.getFile(), tempLocation,
+                                                archiverManager );
+                                        }
+                                        catch ( ArchiveExpansionException e )
+                                        {
+                                            throw new ArchiveCreationException( "Unable to unpack dependency: '"
+                                                + dependencyArtifact.getFile() + "' of module: '"
+                                                + moduleProject.getId() + "'" );
+                                        }
+                                    }
+                                }
+                            }
+                            catch ( NoSuchArchiverException e )
+                            {
+                                throw new ArchiveCreationException( "Unable to obtain unarchiver: " + e.getMessage(), e );
+                            }
+
+                            /*
+                             * If the assembly is 'jar-with-dependencies',
+                             * remove the security files in all dependencies
+                             * that will prevent the uberjar to execute. Please
+                             * see MASSEMBLY-64 for details.
+                             */
+                            if ( archiver instanceof JarArchiver )
+                            {
+                                String[] securityFiles = { "*.RSA", "*.DSA", "*.SF", "*.rsa", "*.dsa", "*.sf" };
+                                org.apache.maven.shared.model.fileset.FileSet securityFileSet = new org.apache.maven.shared.model.fileset.FileSet();
+                                securityFileSet.setDirectory( tempLocation.getAbsolutePath() + "/META-INF/" );
+
+                                for ( int sfsi = 0; sfsi < securityFiles.length; sfsi++ )
+                                {
+                                    securityFileSet.addInclude( securityFiles[sfsi] );
+                                }
+
+                                FileSetManager fsm = new FileSetManager( getLogger() );
+                                try
+                                {
+                                    fsm.delete( securityFileSet );
+                                }
+                                catch ( IOException e )
+                                {
+                                    throw new ArchiveCreationException( "Failed to delete security files: "
+                                        + e.getMessage(), e );
+                                }
+                            }
+                        }
+
+                        ArchiveAssemblyUtils.addDirectory( archiver, tempLocation, output, null, FileUtils
+                            .getDefaultExcludesAsList(), componentsXmlFilter );
+                    }
+                    else
+                    {
+                        try
+                        {
+                            String outputFileNameMapping = binaries.getOutputFileNameMapping();
+
+                            archiver
+                                .addFile( moduleArtifact.getFile(), output
+                                    + AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping,
+                                        moduleArtifact ) );
+
+                            if ( binaries.isIncludeDependencies() )
+                            {
+                                for ( Iterator artifacts = binaryDependencies.iterator(); artifacts.hasNext(); )
+                                {
+                                    Artifact dependencyArtifact = (Artifact) artifacts.next();
+
+                                    archiver.addFile( dependencyArtifact.getFile(), output
+                                        + AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping,
+                                            dependencyArtifact ) );
+                                }
+                            }
+                        }
+                        catch ( ArchiverException e )
+                        {
+                            throw new ArchiveCreationException( "Error adding file to archive: " + e.getMessage(), e );
+                        }
+                    }
+                }
+
+                if ( !moduleFileSets.isEmpty() )
+                {
+                    // TODO: includes and excludes
+                    addFileSets( archiver, moduleFileSets, includeBaseDirectory, configSource, componentsXmlFilter );
+                }
+            }
+
+            allModuleProjects.removeAll( moduleProjects );
+
+            for ( Iterator it = allModuleProjects.iterator(); it.hasNext(); )
+            {
+                MavenProject excludedProject = (MavenProject) it.next();
+
+                // would be better to have a way to find out when a specified
+                // include or exclude
+                // is never triggered and warn() it.
+                getLogger().debug( "module: " + excludedProject.getId() + " not included" );
+            }
+        }
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Copied: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java (from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/ComponentsXmlArchiverFileFilter.java)
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java?p2=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java&p1=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/ComponentsXmlArchiverFileFilter.java&r1=421932&r2=422907&rev=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/ComponentsXmlArchiverFileFilter.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java Mon Jul 17 15:34:58 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.assembly;
+package org.apache.maven.plugin.assembly.filter;
 
 /*
  * Copyright 2001-2005 The Apache Software Foundation.

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,18 @@
+package org.apache.maven.plugin.assembly.format;
+
+
+public class AssemblyFormattingException
+    extends Exception
+{
+
+    public AssemblyFormattingException( String message, Throwable error )
+    {
+        super( message, error );
+    }
+
+    public AssemblyFormattingException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/AssemblyFormattingException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,139 @@
+package org.apache.maven.plugin.assembly.format;
+
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
+import org.apache.maven.plugin.assembly.utils.PropertyUtils;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.util.interpolation.ObjectBasedValueSource;
+import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+public class FileFormatter
+{
+
+    private static final String LS = System.getProperty( "line.separator", "\n" );;
+
+    private final Logger logger;
+
+    private final AssemblerConfigurationSource configSource;
+
+    private Properties filterProperties;
+
+    public FileFormatter( AssemblerConfigurationSource configSource, Logger logger )
+    {
+        this.configSource = configSource;
+        this.logger = logger;
+    }
+
+    public File format( final File source, final boolean filter, final String lineEnding )
+        throws AssemblyFormattingException
+    {
+        File result = source;
+
+        String lineEndingChars;
+        if ( lineEnding != null )
+        {
+            lineEndingChars = AssemblyFileUtils.getLineEndingCharacters( lineEnding );
+        }
+        else
+        {
+            lineEndingChars = LS;
+        }
+
+        initializeFiltering();
+
+        File tempRoot = configSource.getTemporaryRootDirectory();
+
+        String sourceName = source.getName();
+
+        FileReader fileReader = null;
+        try
+        {
+            fileReader = new FileReader( source );
+            StringWriter contentWriter = new StringWriter();
+
+            IOUtil.copy( fileReader, contentWriter );
+
+            // support ${token}
+            RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+            interpolator.addValueSource( new MapBasedValueSource( filterProperties ) );
+            interpolator.addValueSource( new ObjectBasedValueSource( configSource.getProject() ) );
+
+            String contents = contentWriter.toString();
+
+            contents = interpolator.interpolate( contents, "project" );
+
+            BufferedReader contentReader = new BufferedReader( new StringReader( contents ) );
+
+            File tempFilterFile = File.createTempFile( sourceName + ".", ".filtered", tempRoot );
+            
+            AssemblyFileUtils.convertLineEndings( contentReader, tempFilterFile, lineEndingChars );
+
+        }
+        catch ( FileNotFoundException e )
+        {
+            throw new AssemblyFormattingException( "File to filter not found: " + e.getMessage(), e );
+        }
+        catch ( IOException e )
+        {
+            throw new AssemblyFormattingException( "Error filtering file '" + source + "': " + e.getMessage(), e );
+        }
+        finally
+        {
+            IOUtil.close( fileReader );
+        }
+
+        return result;
+    }
+
+    private void initializeFiltering()
+        throws AssemblyFormattingException
+    {
+        logger.info( "Initializing assembly filters..." );
+
+        if ( filterProperties == null )
+        {
+            // System properties
+            filterProperties = new Properties( System.getProperties() );
+
+            // Project properties
+            MavenProject project = configSource.getProject();
+            filterProperties.putAll( project.getProperties() );
+
+            List filters = configSource.getFilters();
+
+            if ( filters != null && !filters.isEmpty() )
+            {
+                for ( Iterator i = filters.iterator(); i.hasNext(); )
+                {
+                    String filtersfile = (String) i.next();
+
+                    try
+                    {
+                        Properties properties = PropertyUtils.loadPropertyFile( new File( filtersfile ), true, true );
+
+                        filterProperties.putAll( properties );
+                    }
+                    catch ( IOException e )
+                    {
+                        throw new AssemblyFormattingException( "Error loading property file '" + filtersfile + "'", e );
+                    }
+                }
+            }
+        }
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,96 @@
+package org.apache.maven.plugin.assembly.format;
+
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
+import org.apache.maven.shared.model.fileset.FileSet;
+import org.apache.maven.shared.model.fileset.util.FileSetManager;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+
+public class FileSetFormatter
+{
+    
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    private final AssemblerConfigurationSource configSource;
+
+    private final Logger logger;
+
+    public FileSetFormatter( AssemblerConfigurationSource configSource, Logger logger )
+    {
+        this.configSource = configSource;
+        this.logger = logger;
+    }
+
+    public File formatFileSetForAssembly( File archiveBaseDir, org.apache.maven.plugins.assembly.model.FileSet set )
+        throws AssemblyFormattingException, IOException
+    {
+        File formattedDir = archiveBaseDir;
+        
+        if ( set.getLineEnding() != null )
+        {
+            FileSet fileSet = new FileSet();
+            fileSet.setLineEnding( set.getLineEnding() );
+            fileSet.setDirectory( set.getDirectory() );
+            fileSet.setExcludes( set.getExcludes() );
+            fileSet.setIncludes( set.getIncludes() );
+            
+            String lineEnding = AssemblyFileUtils.getLineEndingCharacters( fileSet.getLineEnding() );
+
+            formattedDir = FileUtils.createTempFile( "", "", configSource.getTemporaryRootDirectory() );
+            
+            formattedDir.delete();
+            formattedDir.mkdirs();
+            
+            String[] includes = (String[]) fileSet.getIncludes().toArray( EMPTY_STRING_ARRAY );
+            if ( includes.length == 0 )
+            {
+                includes = null;
+            }
+
+            // TODO: default excludes should be in the archiver?
+            List excludesList = fileSet.getExcludes();
+            excludesList.addAll( FileUtils.getDefaultExcludesAsList() );
+            
+            fileSet.setExcludes( excludesList );
+            
+            FileSetManager fsm = new FileSetManager( logger );
+            String[] files = fsm.getIncludedFiles( fileSet );
+            
+            for ( int i = 0; i < files.length; i++ )
+            {
+                String file = files[i];
+                
+                File targetFile = new File( formattedDir, file );
+
+                targetFile.getParentFile().mkdirs();
+
+                File sourceFile = new File( archiveBaseDir, file );
+                
+                Reader sourceReader = null;
+                try
+                {
+                    sourceReader = new BufferedReader( new FileReader( sourceFile ) );
+                    
+                    AssemblyFileUtils.convertLineEndings( sourceReader, targetFile, lineEnding );
+                }
+                finally
+                {
+                    IOUtil.close( sourceReader );
+                }
+            }
+        }
+
+        return formattedDir;
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,18 @@
+package org.apache.maven.plugin.assembly.io;
+
+
+public class AssemblyReadException
+    extends Exception
+{
+
+    public AssemblyReadException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public AssemblyReadException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReadException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,22 @@
+package org.apache.maven.plugin.assembly.io;
+
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugins.assembly.model.Assembly;
+
+import java.io.File;
+import java.util.List;
+
+
+public interface AssemblyReader
+{
+
+    public List readAssemblies( AssemblerConfigurationSource configSource )
+        throws AssemblyReadException;
+
+    public Assembly getAssemblyForDescriptorReference( String ref, AssemblerConfigurationSource configSource )
+        throws AssemblyReadException;
+
+    public Assembly getAssemblyFromDescriptorFile( File file, AssemblerConfigurationSource configSource )
+        throws AssemblyReadException;
+
+}

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message