You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/09 17:24:06 UTC

[maven-shared-incremental] 09/44: [MSHARED-264] afterRebuildExecution must create createdFiles.lst file if not exists

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shared-incremental.git

commit a2fc601ecdc29fca4e7d6e3870dc483ea8342fb7
Author: Olivier Lamy <ol...@apache.org>
AuthorDate: Mon Nov 26 23:12:58 2012 +0000

    [MSHARED-264] afterRebuildExecution must create createdFiles.lst file if not exists
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1413919 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/incremental/IncrementalBuildHelper.java | 37 ++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/incremental/IncrementalBuildHelper.java b/src/main/java/org/apache/maven/shared/incremental/IncrementalBuildHelper.java
index e778993..66799a5 100644
--- a/src/main/java/org/apache/maven/shared/incremental/IncrementalBuildHelper.java
+++ b/src/main/java/org/apache/maven/shared/incremental/IncrementalBuildHelper.java
@@ -312,9 +312,11 @@ public class IncrementalBuildHelper
      *
      * <p><b>Attention:</b> This method shall only get invoked if the plugin re-creates <b>all</b> the output.</p>
      *
+     * @param sources file sources to store if create files are not yet stored
+     *
      * @throws MojoExecutionException
      */
-    public void afterRebuildExecution()
+    public void afterRebuildExecution( Set<File> sources )
         throws MojoExecutionException
     {
         DirectoryScanner diffScanner = getDirectoryScanner();
@@ -329,10 +331,41 @@ public class IncrementalBuildHelper
         {
             FileUtils.fileWriteArray( mojoConfigFile, scanResult.getFilesAdded() );
         }
-        catch( IOException e )
+        catch ( IOException e )
         {
             throw new MojoExecutionException( "Error while storing the mojo status", e );
         }
 
+        // in case of clean compile the file is not created so next compile won't see it
+        // we mus create it here
+        mojoConfigFile = new File( mojoConfigBase, INPUT_FILES_LST_FILENAME );
+        if ( !mojoConfigFile.exists() )
+        {
+            try
+            {
+                FileUtils.fileWriteArray( mojoConfigFile, toArrayOfPath( sources ));
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Error while storing the mojo status", e );
+            }
+        }
+
+    }
+
+    private String[] toArrayOfPath( Set<File> files )
+    {
+
+        String[] paths = new String[files.size()];
+
+        int i = 0;
+
+        for ( File file : files )
+        {
+            paths[i] = file.getPath();
+            i++;
+        }
+
+        return paths;
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.