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