HHH-13071 Use SourceSetOutput.getClassesDirs to prevent deprecation warnings during build when using the gradle plugin

This commit is contained in:
Henning Rohlfs 2018-11-01 12:46:12 +01:00 committed by Guillaume Smet
parent 71af989f60
commit aa441ddb12
1 changed files with 14 additions and 12 deletions

View File

@ -122,19 +122,21 @@ public class HibernatePlugin implements Plugin<Project> {
final Enhancer enhancer = Environment.getBytecodeProvider().getEnhancer( enhancementContext );
final FileTree fileTree = project.fileTree( sourceSet.getOutput().getClassesDir() );
for ( File file : fileTree ) {
if ( !file.getName().endsWith( ".class" ) ) {
continue;
}
for ( File classesDir: sourceSet.getOutput().getClassesDirs() ) {
final FileTree fileTree = project.fileTree( classesDir );
for ( File file : fileTree ) {
if ( !file.getName().endsWith( ".class" ) ) {
continue;
}
final byte[] enhancedBytecode = doEnhancement( sourceSet.getOutput().getClassesDir(), file, enhancer );
if ( enhancedBytecode != null ) {
writeOutEnhancedClass( enhancedBytecode, file );
logger.info( "Successfully enhanced class [" + file + "]" );
}
else {
logger.info( "Skipping class [" + file.getAbsolutePath() + "], not an entity nor embeddable" );
final byte[] enhancedBytecode = doEnhancement( classesDir, file, enhancer );
if ( enhancedBytecode != null ) {
writeOutEnhancedClass( enhancedBytecode, file );
logger.info( "Successfully enhanced class [" + file + "]" );
}
else {
logger.info( "Skipping class [" + file.getAbsolutePath() + "], not an entity nor embeddable" );
}
}
}
}