Skip to content

Commit 38653d6

Browse files
committed
HHH-14082 Apply version injection plugin
1 parent 0e5183e commit 38653d6

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ buildscript {
1919
plugins {
2020
id "local.module"
2121

22-
id "org.hibernate.build.version-injection" version "2.0.0" apply false
22+
id "org.hibernate.build.version-injection" version "2.1.0" apply false
2323
id 'org.hibernate.orm.database-service' apply false
2424
id 'biz.aQute.bnd' version '7.1.0' apply false
2525

hibernate-core/hibernate-core.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ plugins {
88
id "local.publishing-java-module"
99
id "local.publishing-group-relocation"
1010

11+
id "org.hibernate.build.version-injection" apply true
1112
id "org.hibernate.orm.antlr"
1213
id "local-xjc-plugin"
1314
}
@@ -127,6 +128,10 @@ xjc {
127128
}
128129
}
129130

131+
versionInjection {
132+
into( 'org.hibernate.Version', 'initVersion' )
133+
}
134+
130135
task copyBundleResourcesXml (type: Copy) {
131136
inputs.property( "db", db )
132137
inputs.property( "dbHost", dbHost )

tooling/metamodel-generator/hibernate-processor.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
plugins {
77
id "local.publishing-java-module"
88
id "local.publishing-group-relocation"
9-
id "org.hibernate.build.version-injection"
9+
id "org.hibernate.build.version-injection" apply true
1010
}
1111

1212
description = 'Hibernate compile-time tooling'
@@ -77,6 +77,10 @@ configurations {
7777
jakartaDataCompileOnly.extendsFrom(testCompileOnly)
7878
}
7979

80+
versionInjection {
81+
into( 'org.hibernate.processor.Version', 'initVersion' )
82+
}
83+
8084
def quarkusOrmPanacheTestTask = tasks.register( 'quarkusOrmPanacheTest', Test ) {
8185
description = 'Runs the Quarkus ORM Panache tests.'
8286
group = 'verification'

tooling/metamodel-generator/src/main/java/org/hibernate/processor/Version.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@
66

77
import org.hibernate.processor.util.NullnessUtil;
88

9-
import org.checkerframework.checker.nullness.qual.Nullable;
10-
119
/**
1210
* Information about the Meta Model Generator version.
1311
*
1412
* @author Hardy Ferentschik
1513
*/
1614
public final class Version {
17-
private static @Nullable String version;
15+
private static final String VERSION = initVersion();
16+
17+
private static String initVersion() {
18+
final String version = NullnessUtil.castNonNull( Version.class.getPackage() ).getImplementationVersion();
19+
return version != null ? version : "[WORKING]";
20+
}
1821

1922
private Version() {
2023
}
2124

2225
public static String getVersionString() {
23-
if ( version == null ) {
24-
version = NullnessUtil.castNonNull( Version.class.getPackage() ).getImplementationVersion();
25-
if ( version == null ) {
26-
version = "[WORKING]";
27-
}
28-
}
29-
return version;
26+
return VERSION;
3027
}
3128
}

0 commit comments

Comments
 (0)