click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r728326 - in /incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks: MakeTestCaseTask.java PackageTask.java
Date Sat, 20 Dec 2008 17:59:32 GMT
Author: sabob
Date: Sat Dec 20 09:59:31 2008
New Revision: 728326

URL: http://svn.apache.org/viewvc?rev=728326&view=rev
Log:
add package task

Added:
    incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks/PackageTask.java
Removed:
    incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks/MakeTestCaseTask.java

Added: incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks/PackageTask.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks/PackageTask.java?rev=728326&view=auto
==============================================================================
--- incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks/PackageTask.java
(added)
+++ incubator/click/trunk/tools/standalone/dev-tasks/src/org/apache/click/tools/devtasks/PackageTask.java
Sat Dec 20 09:59:31 2008
@@ -0,0 +1,55 @@
+package org.apache.click.tools.devtasks;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.tools.ant.*;
+
+public class PackageTask extends Task {
+
+    private String packageName;
+
+    private String projectName;
+
+    public PackageTask() {
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public void setPackageName(String value) {
+        packageName = value;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    public void execute() throws BuildException {
+        if (projectName == null && projectName.length() == 0) {
+            throw new BuildException("projectName property is not defined");
+        }
+        if (packageName == null && packageName.length() == 0) {
+            throw new BuildException("packageName property is not defined");
+        }
+        try {
+            File file = getProject().getBaseDir();
+            String path = file.getCanonicalPath() + File.separatorChar + ".." +
+                File.separatorChar + projectName + File.separatorChar + "src" +
+                File.separatorChar +
+                packageName.replace('.', File.separatorChar);
+            File packageFile = new File(path);
+            if (!packageFile.mkdirs()) {
+                throw new BuildException("Unable to create path: " + packageFile);
+            }
+            getProject().setProperty("package.path",
+                                     packageFile.getCanonicalPath());
+        } catch (IOException ioe) {
+            throw new BuildException(ioe);
+        }
+    }
+}



Mime
View raw message