Skip to content

Commit 9c33f81

Browse files
committed
HHH-14892 Don't register gradle service uses for H2 and HSQLDB since they are in-memory
1 parent 27a9d65 commit 9c33f81

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

local-build-plugins/src/main/groovy/local.java-module.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ processTestResources {
198198
tasks.withType( Test.class ).each { test ->
199199
test.useJUnitPlatform()
200200

201-
test.usesService( project.gradle.sharedServices.registrations.getByName( 'databaseService' ).service )
202-
203201
// Byteman needs this property to be set, https://developer.jboss.org/thread/274997
204202
test.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"]
205203

local-build-plugins/src/main/java/org/hibernate/orm/db/DatabaseServicePlugin.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ public void apply(Project project) {
2727
DatabaseService.class,
2828
spec -> spec.getMaxParallelUsages().set( 1 )
2929
);
30+
final String database = (String) project.getProperties().get( "db" );
3031

31-
project.getTasks().withType( Test.class ).forEach(
32-
test -> test.usesService( databaseServiceProvider )
33-
);
32+
// H2 and HSQLDB are in-memory, so there is no sharing that needs to be avoided
33+
if ( database != null && !"h2".equals( database ) && !"hsqldb".equals( database ) ) {
34+
project.getTasks().withType( Test.class ).forEach(
35+
test -> test.usesService( databaseServiceProvider )
36+
);
37+
}
3438
}
3539
}

0 commit comments

Comments
 (0)