Skip to content

Commit 1917776

Browse files
fanstekoentsje
authored andcommitted
HBX-3155: Gradle: Add support for template path
1 parent eede222 commit 1917776

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public class Extension {
1212
public String revengFile = null;
1313
public Boolean generateAnnotations = true;
1414
public Boolean useGenerics = true;
15-
15+
public String templatePath = null;
16+
1617
public Extension(Project project) {}
1718

1819
}

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
@@ -21,6 +21,11 @@ void doWork() {
2121
File outputFolder = getOutputFolder();
2222
hbmExporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, createJdbcDescriptor());
2323
hbmExporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputFolder);
24+
String templatePath = getExtension().templatePath;
25+
if (templatePath != null) {
26+
getLogger().lifecycle("Setting template path to: " + templatePath);
27+
hbmExporter.getProperties().put(ExporterConstants.TEMPLATE_PATH, new String[] { templatePath });
28+
}
2429
getLogger().lifecycle("Starting DAO export to directory: " + outputFolder + "...");
2530
hbmExporter.start();
2631
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
@@ -21,6 +21,11 @@ void doWork() {
2121
File outputFolder = getOutputFolder();
2222
hbmExporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, createJdbcDescriptor());
2323
hbmExporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputFolder);
24+
String templatePath = getExtension().templatePath;
25+
if (templatePath != null) {
26+
getLogger().lifecycle("Setting template path to: " + templatePath);
27+
hbmExporter.getProperties().put(ExporterConstants.TEMPLATE_PATH, new String[] { templatePath });
28+
}
2429
getLogger().lifecycle("Starting HBM export to directory: " + outputFolder + "...");
2530
hbmExporter.start();
2631
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
@@ -23,6 +23,11 @@ void doWork() {
2323
File outputFolder = getOutputFolder();
2424
pojoExporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, createJdbcDescriptor());
2525
pojoExporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputFolder);
26+
String templatePath = getExtension().templatePath;
27+
if (templatePath != null) {
28+
getLogger().lifecycle("Setting template path to: " + templatePath);
29+
pojoExporter.getProperties().put(ExporterConstants.TEMPLATE_PATH, new String[] { templatePath });
30+
}
2631
getLogger().lifecycle("Starting Java export to directory: " + outputFolder + "...");
2732
pojoExporter.start();
2833
getLogger().lifecycle("Java export finished");

0 commit comments

Comments
 (0)