Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify "Compiling" info message: display relative path #250

Merged
merged 2 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,16 @@ protected static String[] toStringArray( List<String> arguments )

return args;
}

protected void logCompiling( String[] sourceFiles, CompilerConfiguration config )
{
if ( ( getLogger() != null ) && getLogger().isInfoEnabled() )
{
String to = ( config.getWorkingDirectory() == null ) ? config.getOutputLocation() :
config.getWorkingDirectory().toPath().relativize( new File( config.getOutputLocation() ).toPath() ).toString();
getLogger().info( "Compiling " +
( sourceFiles == null ? "" : ( sourceFiles.length + " source file" + ( sourceFiles.length == 1 ? " " : "s " ) ) ) +
"to " + to );
}
}
}
17 changes: 17 additions & 0 deletions plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@
</path>
</annotationProcessorPaths>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
<version>${plexus.compiler.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>${plexus.compiler.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
<version>${plexus.compiler.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,7 @@ public CompilerResult performCompile( CompilerConfiguration config )
return new CompilerResult();
}

System.out.println(
"Compiling " + sourceFiles.length + " " + "source file" + ( sourceFiles.length == 1 ? "" : "s" ) + " to "
+ destinationDir.getAbsolutePath() );
logCompiling( sourceFiles, config );

// String[] args = buildCompilerArguments( config, sourceFiles );
AjBuildConfig buildConfig = buildCompilerConfig( config );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public CompilerResult performCompile( CompilerConfiguration config )
return new CompilerResult().success( true );
}

System.out.println( "Compiling " + sourceFiles.length + " " + "source file" +
( sourceFiles.length == 1 ? "" : "s" ) + " to " + destinationDir.getAbsolutePath() );
logCompiling( sourceFiles, config );

String[] args = buildCompilerArguments( config, sourceFiles );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ public CompilerResult performCompile( CompilerConfiguration config )

allSources = resortSourcesToPutModuleInfoFirst( allSources );

logCompiling( null, config );

// Compile
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ public CompilerResult performCompile( CompilerConfiguration config )
return new CompilerResult().success( true );
}

System.out.println(
"Compiling " + sourceFiles.length + " " + "source file" + ( sourceFiles.length == 1 ? "" : "s" ) + " to "
+ destinationDir.getAbsolutePath() );
logCompiling( sourceFiles, config );

String[] args = buildCompilerArguments( config, sourceFiles );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ public CompilerResult performCompile( CompilerConfiguration config )
return new CompilerResult();
}

if ( ( getLogger() != null ) && getLogger().isInfoEnabled() )
{
getLogger().info( "Compiling " + sourceFiles.length + " " +
"source file" + ( sourceFiles.length == 1 ? "" : "s" ) +
" to " + destinationDir.getAbsolutePath() );
}
logCompiling( sourceFiles, config );

String[] args = buildCompilerArguments( config, sourceFiles );

Expand Down