directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r694269 - in /directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers: MojoHelperUtils.java archive/ArchiveInstallerCommand.java
Date Thu, 11 Sep 2008 14:18:37 GMT
Author: pamarcelot
Date: Thu Sep 11 07:18:34 2008
New Revision: 694269

URL: http://svn.apache.org/viewvc?rev=694269&view=rev
Log:
Improved the Archive Target based on Felix's proposal on the mailing list (prefix the content
of the dist when creating the installer).

Modified:
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java?rev=694269&r1=694268&r2=694269&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
Thu Sep 11 07:18:34 2008
@@ -255,9 +255,11 @@
     {
         if ( src.isDirectory() )
         {
+            File[] files = src.listFiles();
+
             dest.mkdirs();
 
-            for ( File file : src.listFiles() )
+            for ( File file : files )
             {
                 copyFiles( file, new File( dest, file.getName() ) );
             }

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java?rev=694269&r1=694268&r2=694269&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
Thu Sep 11 07:18:34 2008
@@ -107,7 +107,9 @@
         log.info( "Creating Archive Installer..." );
 
         // Creating the archive directory
-        File archiveDirectory = new File( imagesDirectory, target.getId() );
+        File targetDirectory = new File( imagesDirectory, target.getId() );
+        File archiveDirectory = new File( targetDirectory, target.getApplication().getName()
+ "_"
+            + target.getApplication().getVersion() );
 
         log.info( "Copying Archive Installer files" );
 
@@ -116,11 +118,14 @@
         {
             // Copying the apacheds.bat file
             MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
"apacheds.bat" ),
-                new File( archiveDirectory, "apacheds.bat" ), false );
+                new File( targetDirectory, "apacheds.bat" ), false );
 
             // Copying the apacheds.sh file
             MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
"apacheds.sh" ),
-                new File( archiveDirectory, "apacheds.sh" ), false );
+                new File( targetDirectory, "apacheds.sh" ), false );
+
+            // Copying all the files in the final archive directory
+            MojoHelperUtils.copyFiles( targetDirectory, archiveDirectory );
         }
         catch ( IOException e )
         {
@@ -130,17 +135,18 @@
 
         // Generating the Bin
         log.info( "Generating Archive Installer" );
-        
+
         Project project = new Project();
-        project.setBaseDir( archiveDirectory );
-        
+        project.setBaseDir( targetDirectory );
+
         // ZIP Archive
         if ( archiveType.equalsIgnoreCase( "zip" ) )
-        {   
+        {
             Zip zipTask = new Zip();
             zipTask.setProject( project );
             zipTask.setDestFile( new File( imagesDirectory, target.getFinalName() ) );
-            zipTask.setBasedir( archiveDirectory );
+            zipTask.setBasedir( targetDirectory );
+            zipTask.setIncludes( archiveDirectory.getName() + "/**" );
             zipTask.execute();
         }
         // TAR Archive
@@ -149,7 +155,8 @@
             Tar tarTask = new Tar();
             tarTask.setProject( project );
             tarTask.setDestFile( new File( imagesDirectory, target.getFinalName() ) );
-            tarTask.setBasedir( archiveDirectory );
+            tarTask.setBasedir( targetDirectory );
+            tarTask.setIncludes( archiveDirectory.getName() + "/**" );
             tarTask.execute();
         }
         // TAR.GZ Archive
@@ -160,7 +167,8 @@
             Tar tarTask = new Tar();
             tarTask.setProject( project );
             tarTask.setDestFile( tarFile );
-            tarTask.setBasedir( archiveDirectory );
+            tarTask.setBasedir( targetDirectory );
+            tarTask.setIncludes( archiveDirectory.getName() + "/**" );
             tarTask.execute();
 
             GZip gzipTask = new GZip();
@@ -179,7 +187,8 @@
             Tar tarTask = new Tar();
             tarTask.setProject( project );
             tarTask.setDestFile( tarFile );
-            tarTask.setBasedir( archiveDirectory );
+            tarTask.setBasedir( targetDirectory );
+            tarTask.setIncludes( archiveDirectory.getName() + "/**" );
             tarTask.execute();
 
             BZip2 bzip2Task = new BZip2();



Mime
View raw message