incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1365696 - in /incubator/easyant/core/trunk/src/main: java/org/apache/easyant/tasks/ConfigureEasyAntIvyInstance.java resources/org/apache/easyant/antlib.xml
Date Wed, 25 Jul 2012 19:02:38 GMT
Author: jlboudart
Date: Wed Jul 25 19:02:38 2012
New Revision: 1365696

URL: http://svn.apache.org/viewvc?rev=1365696&view=rev
Log:
Introduces a new task to configure easyant ivy instance

Added:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureEasyAntIvyInstance.java
Modified:
    incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureEasyAntIvyInstance.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureEasyAntIvyInstance.java?rev=1365696&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureEasyAntIvyInstance.java
(added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureEasyAntIvyInstance.java
Wed Jul 25 19:02:38 2012
@@ -0,0 +1,73 @@
+package org.apache.easyant.tasks;
+
+import java.io.File;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.easyant.core.EasyAntConfiguration;
+import org.apache.easyant.core.EasyAntEngine;
+import org.apache.easyant.core.factory.EasyantConfigurationFactory;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Configure easyant ivy instance in current project
+ *
+ */
+public class ConfigureEasyAntIvyInstance extends Task {
+    private EasyAntConfiguration easyantConfiguration = new EasyAntConfiguration();
+
+    @Override
+    public void execute() throws BuildException {
+        EasyAntEngine eaEngine = new EasyAntEngine(getEasyantConfiguration());
+        eaEngine.configureEasyAntIvyInstance(getProject());
+    }
+
+    public void setConfigurationFile(String configurationFile) {
+        File f = new File(configurationFile);
+        try {
+            EasyantConfigurationFactory.getInstance()
+                    .createConfigurationFromFile(getEasyantConfiguration(),
+                            f.toURL());
+        } catch (Exception e) {
+            throw new BuildException(
+                    "Can't create easyantConfiguration from File "
+                            + configurationFile, e);
+        }
+    }
+
+    public void setConfigurationUrl(String configurationUrl) {
+        try {
+            URL url = new URL(configurationUrl);
+            EasyantConfigurationFactory
+                    .getInstance()
+                    .createConfigurationFromFile(getEasyantConfiguration(), url);
+
+        } catch (Exception e) {
+            throw new BuildException(
+                    "Can't create easyantConfiguration from URL "
+                            + configurationUrl, e);
+        }
+    }
+
+    public void setBuildConfiguration(String buildConfiguration) {
+        String[] buildConfs = buildConfiguration.split(",");
+        Set<String> buildConfigurations = new HashSet<String>();
+        for (String conf : buildConfs) {
+            buildConfigurations.add(conf);
+        }
+        getEasyantConfiguration().setActiveBuildConfigurations(
+                buildConfigurations);
+    }
+
+    public EasyAntConfiguration getEasyantConfiguration() {
+        return easyantConfiguration;
+    }
+
+    public void setEasyantConfiguration(
+            EasyAntConfiguration easyantConfiguration) {
+        this.easyantConfiguration = easyantConfiguration;
+    }
+
+}

Modified: incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml?rev=1365696&r1=1365695&r2=1365696&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml (original)
+++ incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml Wed Jul
25 19:02:38 2012
@@ -21,6 +21,7 @@
     
     <taskdef name="import" classname="org.apache.easyant.tasks.Import"/>
     <taskdef name="import-test-module" classname="org.apache.easyant.tasks.ImportTestModule"/>
+    <taskdef name="configure-easyant-ivy-instance" classname="org.apache.easyant.tasks.ConfigureEasyAntIvyInstance"/>
     <taskdef name="loadmodule" classname="org.apache.easyant.tasks.LoadModule"/>
     <taskdef name="submodule" classname="org.apache.easyant.tasks.SubModule"/>
     <taskdef name="core-version" classname="org.apache.easyant.tasks.CoreRevisionCheckerTask"/>



Mime
View raw message