ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1585649 - in /ant/easyant/core/trunk/src/main/java/org/apache/easyant: core/EasyAntMagicNames.java core/services/impl/DefaultPluginServiceImpl.java tasks/AbstractImport.java tasks/ImportDeferred.java tasks/ImportTestModule.java
Date Tue, 08 Apr 2014 07:09:44 GMT
Author: jlboudart
Date: Tue Apr  8 07:09:44 2014
New Revision: 1585649

URL: http://svn.apache.org/r1585649
Log:
Allow ivy types that need to be appended to import classpath configurable (if not specified
'jar' and 'bundle' types are used by default)

Modified:
    ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java
    ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
    ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java
    ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportDeferred.java
    ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportTestModule.java

Modified: ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java
URL: http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java?rev=1585649&r1=1585648&r2=1585649&view=diff
==============================================================================
--- ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java (original)
+++ ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java Tue
Apr  8 07:09:44 2014
@@ -209,4 +209,9 @@ public interface EasyAntMagicNames {
      */
     String MULTIMODULE_LOGGER = "multimodule.logger";
 
+    /**
+     * Name of the property containing a comma separated list of ivy type that must be appended
to immort classpath
+     */
+    String IMPORT_CLASSPATH_TYPES = "import.classpath.types";
+
 }

Modified: ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
URL: http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java?rev=1585649&r1=1585648&r2=1585649&view=diff
==============================================================================
--- ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
(original)
+++ ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
Tue Apr  8 07:09:44 2014
@@ -190,7 +190,7 @@ public class DefaultPluginServiceImpl im
 
                         if ("ant".equals(artifact.getType())) {
                             antFile = artifact.getLocalFile();
-                        } else if ("jar".equals(artifact.getType())) {
+                        } else if (shouldBeAddedToClasspath(artifact)) {
                             path.createPathElement().setLocation(artifact.getLocalFile());
                         } else {
                             handleOtherResourceFile(moduleRevisionId, artifact.getName(),
artifact.getExt(),

Modified: ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java
URL: http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java?rev=1585649&r1=1585648&r2=1585649&view=diff
==============================================================================
--- ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java (original)
+++ ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java Tue
Apr  8 07:09:44 2014
@@ -78,7 +78,7 @@ public abstract class AbstractImport ext
             ArtifactDownloadReport artifact = report.getConfigurationReport(mainConf).getAllArtifactsReports()[j];
             if ("ant".equals(artifact.getType())) {
                 antFile = artifact.getLocalFile();
-            } else if ("jar".equals(artifact.getType())) {
+            } else if (shouldBeAddedToClasspath(artifact)) {
                 path.createPathElement().setLocation(artifact.getLocalFile());
             } else {
                 handleOtherResourceFile(moduleRevisionId, artifact.getName(), artifact.getExt(),
@@ -91,6 +91,21 @@ public abstract class AbstractImport ext
         }
     }
 
+    public boolean shouldBeAddedToClasspath(ArtifactDownloadReport artifact) {
+        String[] types = null;
+        if (getProject().getProperty(EasyAntMagicNames.IMPORT_CLASSPATH_TYPES) != null) {
+            types = getProject().getProperty(EasyAntMagicNames.IMPORT_CLASSPATH_TYPES).split(",");
+        } else {
+            types = new String[] { "jar", "bundle" };
+        }
+        for (int i = 0; i < types.length; i++) {
+            if (artifact.getType().equals(types[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     /**
      * Do effective import of a given ant file
      * 

Modified: ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportDeferred.java
URL: http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportDeferred.java?rev=1585649&r1=1585648&r2=1585649&view=diff
==============================================================================
--- ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportDeferred.java (original)
+++ ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportDeferred.java Tue
Apr  8 07:09:44 2014
@@ -107,7 +107,7 @@ public class ImportDeferred extends Abst
                 Path path = createModulePath(moduleId);
                 for (int i = 0; i < confReport.getAllArtifactsReports().length; i++) {
                     ArtifactDownloadReport artifactReport = confReport.getAllArtifactsReports()[i];
-                    if ("jar".equals(artifactReport.getType())) {
+                    if (shouldBeAddedToClasspath(artifactReport)) {
                         path.createPathElement().setLocation(artifactReport.getLocalFile());
                     }
                 }

Modified: ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportTestModule.java
URL: http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportTestModule.java?rev=1585649&r1=1585648&r2=1585649&view=diff
==============================================================================
--- ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportTestModule.java (original)
+++ ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ImportTestModule.java Tue
Apr  8 07:09:44 2014
@@ -92,7 +92,7 @@ public class ImportTestModule extends Ab
         for (int j = 0; j < report.getConfigurationReport(getMainConf()).getAllArtifactsReports().length;
j++) {
             ArtifactDownloadReport artifact = report.getConfigurationReport(getMainConf()).getAllArtifactsReports()[j];
 
-            if ("jar".equals(artifact.getType())) {
+            if (shouldBeAddedToClasspath(artifact)) {
                 path.createPathElement().setLocation(artifact.getLocalFile());
             }
         }



Mime
View raw message