cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [3/6] cayenne git commit: CAY-2301 + version compatibility with gradle-2.0
Date Mon, 29 May 2017 13:37:34 GMT
CAY-2301 + version compatibility with gradle-2.0


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/ecdaab45
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/ecdaab45
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/ecdaab45

Branch: refs/heads/master
Commit: ecdaab452576a420748e3e1618ab736a63ed21f9
Parents: 95f1199
Author: Maxim Petrusevich <maks1464@gmail.com>
Authored: Mon May 29 09:35:57 2017 +0300
Committer: Maxim Petrusevich <maks1464@gmail.com>
Committed: Mon May 29 09:35:57 2017 +0300

----------------------------------------------------------------------
 cayenne-gradle-plugin/build.gradle              |  2 +-
 .../java/org/apache/cayenne/tools/CgenTask.java | 76 ++++++++++++++++----
 .../org/apache/cayenne/tools/CgenTaskIT.java    |  5 +-
 .../apache/cayenne/tools/cdbgen_custom.gradle   | 12 ++--
 .../cayenne/tools/cgen_custom_config.gradle     |  6 +-
 .../cayenne/tools/cgen_default_config.gradle    |  4 +-
 6 files changed, 78 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/ecdaab45/cayenne-gradle-plugin/build.gradle
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/build.gradle b/cayenne-gradle-plugin/build.gradle
index 9eb2f73..15c0947 100644
--- a/cayenne-gradle-plugin/build.gradle
+++ b/cayenne-gradle-plugin/build.gradle
@@ -38,9 +38,9 @@ dependencies {
     compile gradleApi()
     compile localGroovy()
     compile group: 'org.apache.cayenne', name: 'cayenne-cgen', version: cayenneVersion
+    compile group: 'org.apache.derby', name: 'derby', version: '10.12.1.1'
     testCompile group: 'junit', name: 'junit', version: '4.11'
     testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
-    compile group: 'org.apache.derby', name: 'derby', version: '10.12.1.1'
     testCompile group: 'org.apache.cayenne.build-tools', name: 'cayenne-test-utilities',
version: cayenneVersion
 }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ecdaab45/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
----------------------------------------------------------------------
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 59cd930..6b4f4c4 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
@@ -31,7 +31,6 @@ import org.apache.cayenne.map.DataMap;
 import org.gradle.api.Action;
 import org.gradle.api.GradleException;
 import org.gradle.api.InvalidUserDataException;
-import org.gradle.api.file.FileCollection;
 import org.gradle.api.plugins.JavaPlugin;
 import org.gradle.api.tasks.Input;
 import org.gradle.api.tasks.InputDirectory;
@@ -191,8 +190,7 @@ public class CgenTask extends BaseCayenneTask {
                 public void execute(final JavaPlugin plugin) {
                     SourceSetContainer sourceSets = (SourceSetContainer)getProject().getProperties().get("sourceSets");
 
-                    final FileCollection directories = sourceSets.getByName("main").getJava().getSourceDirectories();
-                    Set<File> sourceDirs = (directories == null ? null : directories.getFiles());
+                    Set<File> sourceDirs = sourceSets.getByName("main").getJava().getSrcDirs();
                     if (sourceDirs != null && !sourceDirs.isEmpty()) {
                         // find java directory, if there is no such dir, take first
                         for(File dir : sourceDirs) {
@@ -240,6 +238,14 @@ public class CgenTask extends BaseCayenneTask {
         this.destDirName = destDir;
     }
 
+    public void destDir(String destDir) {
+        setDestDir(destDir);
+    }
+
+    public void destDir(File destDir) {
+        setDestDir(destDir);
+    }
+
     @Optional
     @InputDirectory
     public File getAdditionalMaps() {
@@ -250,8 +256,8 @@ public class CgenTask extends BaseCayenneTask {
         this.additionalMaps = additionalMaps;
     }
 
-    public boolean getClient() {
-        return client;
+    public void additionalMaps(File additionalMaps) {
+        setAdditionalMaps(additionalMaps);
     }
 
     public boolean isClient() {
@@ -262,6 +268,10 @@ public class CgenTask extends BaseCayenneTask {
         this.client = client;
     }
 
+    public void client(boolean client) {
+        setClient(client);
+    }
+
     public String getEncoding() {
         return encoding;
     }
@@ -270,6 +280,10 @@ public class CgenTask extends BaseCayenneTask {
         this.encoding = encoding;
     }
 
+    public void encoding(String encoding) {
+        setEncoding(encoding);
+    }
+
     public String getExcludeEntities() {
         return excludeEntities;
     }
@@ -278,6 +292,10 @@ public class CgenTask extends BaseCayenneTask {
         this.excludeEntities = excludeEntities;
     }
 
+    public void excludeEntities(String excludeEntities) {
+        setExcludeEntities(excludeEntities);
+    }
+
     public String getIncludeEntities() {
         return includeEntities;
     }
@@ -286,8 +304,8 @@ public class CgenTask extends BaseCayenneTask {
         this.includeEntities = includeEntities;
     }
 
-    public boolean getMakePairs() {
-        return makePairs;
+    public void includeEntities(String includeEntities) {
+        setIncludeEntities(includeEntities);
     }
 
     public boolean isMakePairs() {
@@ -298,6 +316,10 @@ public class CgenTask extends BaseCayenneTask {
         this.makePairs = makePairs;
     }
 
+    public void makePairs(boolean makePairs) {
+        setMakePairs(makePairs);
+    }
+
     public String getMode() {
         return mode;
     }
@@ -306,6 +328,10 @@ public class CgenTask extends BaseCayenneTask {
         this.mode = mode;
     }
 
+    public void mode(String mode) {
+        setMode(mode);
+    }
+
     public String getOutputPattern() {
         return outputPattern;
     }
@@ -314,8 +340,8 @@ public class CgenTask extends BaseCayenneTask {
         this.outputPattern = outputPattern;
     }
 
-    public boolean getOverwrite() {
-        return overwrite;
+    public void outputPattern(String outputPattern) {
+        setOutputPattern(outputPattern);
     }
 
     public boolean isOverwrite() {
@@ -326,6 +352,10 @@ public class CgenTask extends BaseCayenneTask {
         this.overwrite = overwrite;
     }
 
+    public void overwrite(boolean overwrite) {
+        setOverwrite(overwrite);
+    }
+
     public String getSuperPkg() {
         return superPkg;
     }
@@ -334,6 +364,10 @@ public class CgenTask extends BaseCayenneTask {
         this.superPkg = superPkg;
     }
 
+    public void superPkg(String superPkg) {
+        setSuperPkg(superPkg);
+    }
+
     public String getSuperTemplate() {
         return superTemplate;
     }
@@ -342,6 +376,10 @@ public class CgenTask extends BaseCayenneTask {
         this.superTemplate = superTemplate;
     }
 
+    public void superTemplate(String superTemplate) {
+        setSuperTemplate(superTemplate);
+    }
+
     public String getTemplate() {
         return template;
     }
@@ -350,6 +388,10 @@ public class CgenTask extends BaseCayenneTask {
         this.template = template;
     }
 
+    public void template(String template) {
+        setTemplate(template);
+    }
+
     public String getEmbeddableSuperTemplate() {
         return embeddableSuperTemplate;
     }
@@ -358,6 +400,10 @@ public class CgenTask extends BaseCayenneTask {
         this.embeddableSuperTemplate = embeddableSuperTemplate;
     }
 
+    public void embeddableSuperTemplate(String embeddableSuperTemplate) {
+        setEmbeddableSuperTemplate(embeddableSuperTemplate);
+    }
+
     public String getEmbeddableTemplate() {
         return embeddableTemplate;
     }
@@ -366,8 +412,8 @@ public class CgenTask extends BaseCayenneTask {
         this.embeddableTemplate = embeddableTemplate;
     }
 
-    public boolean getUsePkgPath() {
-        return usePkgPath;
+    public void embeddableTemplate(String embeddableTemplate) {
+        setEmbeddableTemplate(embeddableTemplate);
     }
 
     public boolean isUsePkgPath() {
@@ -378,8 +424,8 @@ public class CgenTask extends BaseCayenneTask {
         this.usePkgPath = usePkgPath;
     }
 
-    public boolean getCreatePropertyNames() {
-        return createPropertyNames;
+    public void usePkgPath(boolean usePkgPath) {
+        setUsePkgPath(usePkgPath);
     }
 
     public boolean isCreatePropertyNames() {
@@ -390,4 +436,8 @@ public class CgenTask extends BaseCayenneTask {
         this.createPropertyNames = createPropertyNames;
     }
 
+    public void createPropertyNames(boolean createPropertyNames) {
+        setCreatePropertyNames(createPropertyNames);
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ecdaab45/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
index 8f660ff..0210c3a 100644
--- a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
+++ b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
@@ -43,9 +43,10 @@ public class CgenTaskIT extends BaseTaskIT {
                 "cgen",
                 "-PdataMap=" + getClass().getResource("test_datamap.map.xml").getFile()
         );
-        BuildResult result = runner.build();
 
-        String generatedDirectoryPath = projectDir.getAbsolutePath() + "/org/example/cayenne/persistent/";
+        BuildResult result = runner.forwardOutput().build();
+
+        String generatedDirectoryPath = projectDir.getAbsolutePath() + "/src/main/java/org/example/cayenne/persistent/";
 
         String generatedClassPath = generatedDirectoryPath + "City.java";
         String generatedParentClassPath = generatedDirectoryPath + "auto/_City.java";

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ecdaab45/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
index 9cbe90d..aec7c25 100644
--- a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
+++ b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
@@ -22,15 +22,15 @@ plugins {
 }
 
 task customCdbgen(type: cayenne.cdbgen) {
-    map = dataMap
+    map dataMap
 
-    adapter = "org.apache.cayenne.dba.derby.DerbyAdapter"
+    adapter "org.apache.cayenne.dba.derby.DerbyAdapter"
 
     dataSource {
-        username = 'sa'
-        password = ''
-        url = 'jdbc:derby:build/testdb;create=true'
-        driver = 'org.apache.derby.jdbc.EmbeddedDriver'
+        username 'sa'
+        password ''
+        url 'jdbc:derby:build/testdb;create=true'
+        driver 'org.apache.derby.jdbc.EmbeddedDriver'
     }
 
     dropTables true

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ecdaab45/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
index 8cdd8f0..9eb93ca 100644
--- a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
+++ b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
@@ -22,10 +22,10 @@ plugins {
 }
 
 cgen {
-    map = dataMap
+    map dataMap
     destDir = './customDirectory'
-    makePairs = false
+    makePairs false
     outputPattern = '*.groovy'
-    excludeEntities = 'Artist'
+    excludeEntities 'Artist'
     overwrite = false
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ecdaab45/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
index 863e3e7..94de25f 100644
--- a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
+++ b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
@@ -19,9 +19,9 @@
 
 plugins {
     id 'org.apache.cayenne'
+    id 'java'
 }
 
 cgen {
-    map = dataMap
-    destDir = './'
+    map dataMap
 }
\ No newline at end of file


Mime
View raw message