Skip to content

Commit

Permalink
[MCOMPILER-549] Improve log message in case of recompilation (#201)
Browse files Browse the repository at this point in the history
* idk refactored to immutableOutputFile

* rephrased log output

* reformatted code

* improved log message

* updated test case
  • Loading branch information
BrowneMonke committed Oct 17, 2023
1 parent d138bd4 commit 628c333
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/it/MCOMPILER-500-package-info-incr/verify.groovy
Expand Up @@ -20,7 +20,7 @@ def logFile = new File( basedir, 'build.log' )
assert logFile.exists()
content = logFile.text

assert 1 == content.count( 'Changes detected - recompiling the module!' )
assert 1 == content.count( 'Nothing to compile - all classes are up to date' )
assert 1 == content.count( "Recompiling the module because of ")
assert 1 == content.count( 'Nothing to compile - all classes are up to date.' )


Expand Up @@ -878,20 +878,22 @@ public void execute() throws MojoExecutionException, CompilationFailureException

DirectoryScanResult dsr = computeInputFileTreeChanges(incrementalBuildHelper, sources);

boolean idk = compiler.getCompilerOutputStyle()
boolean immutableOutputFile = compiler.getCompilerOutputStyle()
.equals(CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES)
&& !canUpdateTarget;
boolean dependencyChanged = isDependencyChanged();
boolean sourceChanged = isSourceChanged(compilerConfiguration, compiler);
boolean inputFileTreeChanged = hasInputFileTreeChanged(dsr);
// CHECKSTYLE_OFF: LineLength
if (idk || dependencyChanged || sourceChanged || inputFileTreeChanged)
if (immutableOutputFile || dependencyChanged || sourceChanged || inputFileTreeChanged)
// CHECKSTYLE_ON: LineLength
{
String cause = idk
? "idk"
: (dependencyChanged ? "dependency" : (sourceChanged ? "source" : "input tree"));
getLog().info("Changes detected - recompiling the module! :" + cause);
String cause = immutableOutputFile
? "immutable single output file"
: (dependencyChanged
? "changed dependency"
: (sourceChanged ? "changed source code" : "added or removed source files"));
getLog().info("Recompiling the module because of " + cause + ".");
if (showCompilationChanges) {
for (String fileAdded : dsr.getFilesAdded()) {
getLog().info("\t+ " + fileAdded);
Expand All @@ -903,7 +905,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException

compilerConfiguration.setSourceFiles(sources);
} else {
getLog().info("Nothing to compile - all classes are up to date");
getLog().info("Nothing to compile - all classes are up to date.");

return;
}
Expand Down

0 comments on commit 628c333

Please sign in to comment.