From aa441ddb12ce04ff5355987b880e6aafaac3294f Mon Sep 17 00:00:00 2001 From: Henning Rohlfs Date: Thu, 1 Nov 2018 12:46:12 +0100 Subject: [PATCH] HHH-13071 Use SourceSetOutput.getClassesDirs to prevent deprecation warnings during build when using the gradle plugin --- .../orm/tooling/gradle/HibernatePlugin.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/HibernatePlugin.java b/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/HibernatePlugin.java index cb56a91453..e4a7f0d3f6 100644 --- a/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/HibernatePlugin.java +++ b/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/HibernatePlugin.java @@ -122,19 +122,21 @@ public class HibernatePlugin implements Plugin { 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" ); + } } } }