You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/05/30 09:35:09 UTC

[GitHub] [maven-compiler-plugin] ledoyen opened a new pull request, #129: Display recompilation causes

ledoyen opened a new pull request, #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129

   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MCOMPILER) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MCOMPILER-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MCOMPILER-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the integration tests successfully (`mvn -Prun-its clean verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   // TODO
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] ledoyen commented on pull request #129: Display recompilation causes

Posted by GitBox <gi...@apache.org>.
ledoyen commented on PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#issuecomment-1141346510

   Notice that it is a draft, as I did not take the time to open a Jira ticket, clean the code and write tests.
   However, I used the custom version on a big multi-module project to troubleshoot unwanted re-compilation and it works as intended.
   
   That being said, to answer your concern, I introduced the flag `maven.compiler.showCompilationChanges` (defaulted to `false`) to avoid the verbose display when unwanted, and to keep the current behavior by default.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on pull request #129: Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#issuecomment-1141544804

   @ledoyen thanks! and sorry for the gh actions failure but oh we do not pay for support and don't know what is the issue :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy closed pull request #129: [MCOMPILER-499] Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy closed pull request #129: [MCOMPILER-499] Display recompilation causes
URL: https://github.com/apache/maven-compiler-plugin/pull/129


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on a diff in pull request #129: [MCOMPILER-499] Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#discussion_r927281740


##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -1909,6 +1949,52 @@ private String getMavenCompilerPluginVersion()
         return pomProperties.getProperty( "version" );
     }
 
+    private DirectoryScanResult computeInputFileTreeChanges( IncrementalBuildHelper ibh, Set<File> inputFiles )
+            throws MojoExecutionException
+    {
+        File mojoConfigBase = ibh.getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, INPUT_FILES_LST_FILENAME );
+
+        String[] oldInputFiles = new String[0];
+
+        if ( mojoConfigFile.exists() )
+        {
+            try
+            {
+                oldInputFiles = FileUtils.fileReadArray( mojoConfigFile );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Error reading old mojo status " + mojoConfigFile, e );
+            }
+        }
+
+        String[] inputFileNames = new String[ inputFiles.size() ];

Review Comment:
   simply replace the block with a single line. yup even Maven can use modern syntax 😜



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on pull request #129: [MCOMPILER-499] Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#issuecomment-1191118639

   issue created as https://issues.apache.org/jira/browse/MCOMPILER-499


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on a diff in pull request #129: [MCOMPILER-499] Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#discussion_r927281110


##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -1909,6 +1949,52 @@ private String getMavenCompilerPluginVersion()
         return pomProperties.getProperty( "version" );
     }
 
+    private DirectoryScanResult computeInputFileTreeChanges( IncrementalBuildHelper ibh, Set<File> inputFiles )
+            throws MojoExecutionException
+    {
+        File mojoConfigBase = ibh.getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, INPUT_FILES_LST_FILENAME );
+
+        String[] oldInputFiles = new String[0];
+
+        if ( mojoConfigFile.exists() )
+        {
+            try
+            {
+                oldInputFiles = FileUtils.fileReadArray( mojoConfigFile );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Error reading old mojo status " + mojoConfigFile, e );
+            }
+        }
+
+        String[] inputFileNames = new String[ inputFiles.size() ];

Review Comment:
   ```suggestion
   String[] inputFileNames = inputFiles.stream().map(File::getAbsolutePath).toArray(String[]::new);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on pull request #129: Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#issuecomment-1140971008

   sounds like a good idea!
   But I wonder if it could be better to have this not displayed per default (as it can be very verbose)
   maybe a flag such `maven.compiler.showRecompilationCause`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on a diff in pull request #129: [MCOMPILER-499] Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#discussion_r927281110


##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -1909,6 +1949,52 @@ private String getMavenCompilerPluginVersion()
         return pomProperties.getProperty( "version" );
     }
 
+    private DirectoryScanResult computeInputFileTreeChanges( IncrementalBuildHelper ibh, Set<File> inputFiles )
+            throws MojoExecutionException
+    {
+        File mojoConfigBase = ibh.getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, INPUT_FILES_LST_FILENAME );
+
+        String[] oldInputFiles = new String[0];
+
+        if ( mojoConfigFile.exists() )
+        {
+            try
+            {
+                oldInputFiles = FileUtils.fileReadArray( mojoConfigFile );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Error reading old mojo status " + mojoConfigFile, e );
+            }
+        }
+
+        String[] inputFileNames = new String[ inputFiles.size() ];

Review Comment:
   ```suggestion
   String[] inputFileNames = inputFiles.stream().map(file -> file.getAbsolutePath()).toArray(String[]::new);
   ```



##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -1515,7 +1541,14 @@ private boolean isSourceChanged( CompilerConfiguration compilerConfiguration, Co
         {
             for ( File f : staleSources )
             {
-                getLog().debug( "Stale source detected: " + f.getAbsolutePath() );
+                if ( showCompilationChanges )

Review Comment:
   we cannot see it in this GH ui diff but we go in this path only `if ( getLog().isDebugEnabled() )` this must be changed to something such 
   `if ( !staleSources.isEmpty() && (getLog().isDebugEnabled() ||  showCompilationChanges))`
   I guess the idea is to display those files when using `-Dmaven.compiler.showCompilationChanges=true` but without using full debug with `-X`
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-compiler-plugin] olamy commented on pull request #129: [MCOMPILER-499] Display recompilation causes

Posted by GitBox <gi...@apache.org>.
olamy commented on PR #129:
URL: https://github.com/apache/maven-compiler-plugin/pull/129#issuecomment-1197800358

   changes done in another PR #143 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org