From 7fd3706a18e4740a5fdae20c1bc05f10755e20c8 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 29 Sep 2021 18:50:55 +0200 Subject: [PATCH] Fix build script regarding tools.jar inclusion into testCompile configuration --- gradle/java-module.gradle | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/gradle/java-module.gradle b/gradle/java-module.gradle index f4c01a6b7f..bef4ad8c4a 100644 --- a/gradle/java-module.gradle +++ b/gradle/java-module.gradle @@ -122,12 +122,6 @@ dependencies { testRuntimeOnly libraries.hana } - // Mac-specific - project.ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") - if ( project.toolsJar.exists() ) { - testCompileOnly files( project.toolsJar ) - } - annotationProcessor libraries.logging_processor annotationProcessor libraries.logging annotationProcessor libraries.logging_annotations @@ -228,6 +222,16 @@ convention.findPlugin( JavaPluginConvention.class ).sourceSets.each { sourceSet ] } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Attach tools JAR to the classpath for byteman tests + +final File toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") +if ( toolsJar.exists() ) { + dependencies{ + testCompile files( toolsJar ) + } +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -324,7 +328,25 @@ sourceSets { processTestResources { inputs.property( "db", db ) - filter( ReplaceTokens, tokens: dbBundle[db] ) + doLast { + copy { + from( sourceSets.test.java.srcDirs ) { + include '**/*.properties' + include '**/*.xml' + } + into sourceSets.test.java.outputDir + } + copy { + from file( 'src/test/resources' ) + into file( "${buildDir}/resources/test" ) + exclude 'src/test/resources/hibernate.properties' + } + copy { + from file( 'src/test/resources/hibernate.properties' ) + into file( "${buildDir}/resources/test" ) + filter( ReplaceTokens, tokens: dbBundle[db] ) + } + } } // Keep system properties in sync with gradle.properties!