Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBX-2951: Backport automated releases to branch 6.6 #4973

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions orm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,26 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-injection-plugin</artifactId>
<configuration>
<bytecodeInjections>
<bytecodeInjection>
<expression>${project.version}</expression>
<targetMembers>
<methodBodyReturn>
<className>org.hibernate.tool.api.version.Version</className>
<methodName>versionString</methodName>
</methodBodyReturn>
</targetMembers>
</bytecodeInjection>
</bytecodeInjections>
</configuration>
</plugin>
</plugins>
</build>

</project>
13 changes: 11 additions & 2 deletions orm/src/main/java/org/hibernate/tool/api/version/Version.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package org.hibernate.tool.api.version;

public interface Version {

final static String CURRENT_VERSION = "6.6.3-SNAPSHOT";

/**
* @deprecated Use {@link #versionString()} instead.
*/
@Deprecated
final static String CURRENT_VERSION = versionString();

static String versionString() {
// This implementation is replaced during the build with another one that returns the correct value.
return "UNKNOWN";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void processString(String template, Writer output) {
}

public void setupContext() {
getContext().put("version", Version.CURRENT_VERSION);
getContext().put("version", Version.versionString());
getContext().put("ctx", getContext() ); //TODO: I would like to remove this, but don't know another way to actually get the list possible "root" keys for debugging.
getContext().put("templates", new Templates());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class TestCase {
@Test
public void testVersion() throws Exception {
assertEquals(
org.hibernate.tool.api.version.Version.CURRENT_VERSION,
org.hibernate.tool.api.version.Version.versionString(),
extractVersion(getPomXml()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testSingleFileGeneration() {
null,
FileUtil.findFirstString("$", new File(outputDir, "artifacts.txt")));
assertEquals(
"File for artifacts in " + Version.CURRENT_VERSION,
"File for artifacts in " + Version.versionString(),
FileUtil.findFirstString("artifacts", new File( outputDir, "artifacts.txt")));
}

Expand Down
Loading