cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [cayenne] 02/05: Changed gradle plugin to utilize new ClassGenerationAction constructor
Date Tue, 12 May 2020 10:48:37 GMT
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 75407e69e586964b8392dd295924d0fc503df709
Author: Faizel Dakri <faizel@me.com>
AuthorDate: Mon May 11 13:38:00 2020 -0500

    Changed gradle plugin to utilize new ClassGenerationAction constructor
---
 .../main/java/org/apache/cayenne/tools/CgenTask.java   | 18 +++++++++++++++++-
 .../java/org/apache/cayenne/tools/CgenTaskTest.java    |  3 +--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java b/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
index a0842b3..d3eee61 100644
--- a/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
+++ b/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
@@ -142,6 +142,14 @@ public class CgenTask extends BaseCayenneTask {
     @Optional
     private Boolean createPKProperties;
 
+    /**
+     * Optional path (classpath or filesystem) to external velocity tool configuration file
+     * @since 4.2
+     */
+    @Input
+    @Optional
+    private String externalToolConfig;
+
     private String destDirName;
 
     private DataChannelMetaData metaData;
@@ -253,6 +261,7 @@ public class CgenTask extends BaseCayenneTask {
         cgenConfiguration.setQueryTemplate(queryTemplate != null ? queryTemplate : cgenConfiguration.getQueryTemplate());
         cgenConfiguration.setQuerySuperTemplate(querySuperTemplate != null ? querySuperTemplate
: cgenConfiguration.getQuerySuperTemplate());
         cgenConfiguration.setCreatePKProperties(createPKProperties != null ? createPKProperties
: cgenConfiguration.isCreatePKProperties());
+        cgenConfiguration.setExternalToolConfig(externalToolConfig != null ? externalToolConfig
: cgenConfiguration.getExternalToolConfig());
         if(!cgenConfiguration.isMakePairs()) {
             if(template == null) {
                 cgenConfiguration.setTemplate(cgenConfiguration.isClient() ? ClientClassGenerationAction.SINGLE_CLASS_TEMPLATE
: ClassGenerationAction.SINGLE_CLASS_TEMPLATE);
@@ -279,7 +288,7 @@ public class CgenTask extends BaseCayenneTask {
                 makePairs != null || mode != null || outputPattern != null || overwrite !=
null || superPkg != null ||
                 superTemplate != null || template != null || embeddableTemplate != null ||
embeddableSuperTemplate != null ||
                 usePkgPath != null || createPropertyNames != null || force || queryTemplate
!= null ||
-                querySuperTemplate != null || createPKProperties != null;
+                querySuperTemplate != null || createPKProperties != null || externalToolConfig
!= null;
     }
 
     @OutputDirectory
@@ -581,5 +590,12 @@ public class CgenTask extends BaseCayenneTask {
     public void createPKProperties(boolean createPKProperties) {
         setCreatePKProperties(createPKProperties);
     }
+    
+    public void setExternalToolConfig(String externalToolConfig) {
+    	this.externalToolConfig = externalToolConfig;
+    }
 
+    public void externalToolConfig(String externalToolConfig) {
+    	setExternalToolConfig(externalToolConfig);
+    }
 }
\ No newline at end of file
diff --git a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
index 00b1484..9269a65 100644
--- a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
+++ b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
@@ -88,8 +88,7 @@ public class CgenTaskTest {
         task.setUsePkgPath(true);
 
         CgenConfiguration configuration = task.buildConfiguration(dataMap);
-        ClassGenerationAction createdAction = new ClassGenerationAction();
-        createdAction.setCgenConfiguration(configuration);
+        ClassGenerationAction createdAction = new ClassGenerationAction(configuration);
 
         CgenConfiguration cgenConfiguration = createdAction.getCgenConfiguration();
         assertEquals(cgenConfiguration.getEmbeddableSuperTemplate(), "superTemplate");


Mime
View raw message