Skip to content

Commit 3a2d25f

Browse files
fanstekoentsje
authored andcommitted
HBX-3155: Gradle: Add support for template path
1 parent 5ffe33b commit 3a2d25f

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

gradle/plugin/src/main/java/org/hibernate/tool/gradle/Extension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class Extension {
2929
public String revengFile = null;
3030
public Boolean generateAnnotations = true;
3131
public Boolean useGenerics = true;
32+
public String templatePath = null;
3233

3334
public Extension(Project project) {}
3435

gradle/plugin/src/main/java/org/hibernate/tool/gradle/task/GenerateDaoTask.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ void doWork() {
3838
File outputFolder = getOutputFolder();
3939
hbmExporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, createJdbcDescriptor());
4040
hbmExporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputFolder);
41+
String templatePath = getExtension().templatePath;
42+
if (templatePath != null) {
43+
getLogger().lifecycle("Setting template path to: " + templatePath);
44+
hbmExporter.getProperties().put(ExporterConstants.TEMPLATE_PATH, new String[] { templatePath });
45+
}
4146
getLogger().lifecycle("Starting DAO export to directory: " + outputFolder + "...");
4247
hbmExporter.start();
4348
getLogger().lifecycle("DAO export finished");

gradle/plugin/src/main/java/org/hibernate/tool/gradle/task/GenerateHbmTask.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ void doWork() {
3838
File outputFolder = getOutputFolder();
3939
hbmExporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, createJdbcDescriptor());
4040
hbmExporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputFolder);
41+
String templatePath = getExtension().templatePath;
42+
if (templatePath != null) {
43+
getLogger().lifecycle("Setting template path to: " + templatePath);
44+
hbmExporter.getProperties().put(ExporterConstants.TEMPLATE_PATH, new String[] { templatePath });
45+
}
4146
getLogger().lifecycle("Starting HBM export to directory: " + outputFolder + "...");
4247
hbmExporter.start();
4348
getLogger().lifecycle("HBM export finished");

gradle/plugin/src/main/java/org/hibernate/tool/gradle/task/GenerateJavaTask.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ void doWork() {
4040
File outputFolder = getOutputFolder();
4141
pojoExporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, createJdbcDescriptor());
4242
pojoExporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputFolder);
43+
String templatePath = getExtension().templatePath;
44+
if (templatePath != null) {
45+
getLogger().lifecycle("Setting template path to: " + templatePath);
46+
pojoExporter.getProperties().put(ExporterConstants.TEMPLATE_PATH, new String[] { templatePath });
47+
}
4348
getLogger().lifecycle("Starting Java export to directory: " + outputFolder + "...");
4449
pojoExporter.start();
4550
getLogger().lifecycle("Java export finished");

0 commit comments

Comments
 (0)