ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1407310 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse: CachedIvy.java cpcontainer/IvyClasspathContainerMapper.java resolve/IvyResolveJob.java resolve/IvyResolver.java
Date Thu, 08 Nov 2012 23:02:51 GMT
Author: hibou
Date: Thu Nov  8 23:02:50 2012
New Revision: 1407310

URL: http://svn.apache.org/viewvc?rev=1407310&view=rev
Log:
- improving IvyDE logs
- if a resolve failed, do not try to build a classpath

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolveJob.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolver.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java?rev=1407310&r1=1407309&r2=1407310&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
Thu Nov  8 23:02:50 2012
@@ -246,8 +246,10 @@ public abstract class CachedIvy {
             ivySettings.setDefaultIvyUserDir(ivyUserDir.getFile());
         }
         Collection propFiles = getPropertyFiles();
-        if (propFiles != null) {
-            IvyDEMessage.verbose("Loading property files");
+        if (propFiles == null || propFiles.isEmpty()) { 
+            IvyDEMessage.verbose("No property files to load");
+        } else {
+            IvyDEMessage.verbose(propFiles.size() + " property file(s) to load");
             Iterator iter = propFiles.iterator();
             while (iter.hasNext()) {
                 String file = (String) iter.next();

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java?rev=1407310&r1=1407309&r2=1407310&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
Thu Nov  8 23:02:50 2012
@@ -102,7 +102,7 @@ public class IvyClasspathContainerMapper
         IClasspathEntry[] classpathEntries;
         Collection paths = new LinkedHashSet();
 
-        IvyDEMessage.verbose("Building classpath...");
+        IvyDEMessage.verbose("Building classpath from " + all.size() + " resolved artifacts");
 
         for (Iterator iter = all.iterator(); iter.hasNext();) {
             ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolveJob.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolveJob.java?rev=1407310&r1=1407309&r2=1407310&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolveJob.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolveJob.java
Thu Nov  8 23:02:50 2012
@@ -83,12 +83,15 @@ public class IvyResolveJob extends Job {
     protected IStatus run(IProgressMonitor monitor) {
         try {
             return doRun(monitor);
-        } finally {
-            IvyDEMessage.sumupProblems();
+        } catch (RuntimeException e) {
+            IvyDEMessage.error("Resolve job failed with an unexpected exception", e);
+            throw e;
         }
     }
 
     private IStatus doRun(IProgressMonitor monitor) {
+        IvyDEMessage.info("Resolve job starting...");
+
         List toResolve;
         synchronized (resolveQueue) {
             toResolve = new ArrayList(resolveQueue);
@@ -96,9 +99,12 @@ public class IvyResolveJob extends Job {
         }
 
         if (toResolve.isEmpty()) {
+            IvyDEMessage.info("Nothing to resolve");
             return Status.OK_STATUS;
         }
 
+        IvyDEMessage.verbose(toResolve.size() + " container(s) to resolve");
+
         monitor.beginTask("Loading ivy descriptors", MONITOR_LENGTH);
 
         Map/* <ModuleDescriptor, ResolveRequest> */inworkspaceModules = new LinkedHashMap();
@@ -136,7 +142,8 @@ public class IvyResolveJob extends Job {
                     ivy = cachedIvy.getIvy();
                 } catch (IvyDEException e) {
                     cachedIvy.setErrorMarker(e);
-                    IvyDEMessage.error("Failed to configure Ivy for " + request + ": " +
e.getMessage());
+                    IvyDEMessage.error("Failed to configure Ivy for " + request + ": "
+                            + e.getMessage());
                     errorsStatus.add(e.asStatus(IStatus.ERROR, "Failed to configure Ivy for
"
                             + request));
                     monitor.worked(step);
@@ -152,7 +159,8 @@ public class IvyResolveJob extends Job {
                     md = cachedIvy.getModuleDescriptor(ivy);
                 } catch (IvyDEException e) {
                     cachedIvy.setErrorMarker(e);
-                    IvyDEMessage.error("Failed to load the descriptor for " + request + ":
" + e.getMessage());
+                    IvyDEMessage.error("Failed to load the descriptor for " + request + ":
"
+                            + e.getMessage());
                     errorsStatus.add(e.asStatus(IStatus.ERROR, "Failed to load the descriptor
for "
                             + request));
                     monitor.worked(step);
@@ -175,7 +183,10 @@ public class IvyResolveJob extends Job {
 
         step = (MONITOR_LENGTH - IVY_LOAD_LENGTH - POST_RESOLVE_LENGTH) / toResolve.size();
 
-        if (!inworkspaceModules.isEmpty()) {
+        if (inworkspaceModules.isEmpty()) {
+            IvyDEMessage.verbose("No modules to resolve in workspace");
+        } else {
+            IvyDEMessage.info(inworkspaceModules.size() + " modules to resolve in workspace");
             // for the modules which are using the workspace resolver, make sure
             // we resolve them in the correct order
 
@@ -205,7 +216,11 @@ public class IvyResolveJob extends Job {
             }
         }
 
-        if (!otherModules.isEmpty()) {
+        if (otherModules.isEmpty()) {
+            IvyDEMessage.verbose("No modules to resolve outside the workspace");
+        } else {
+            IvyDEMessage.info(otherModules.size() + " modules to resolve outside the workspace");
+
             Iterator it = otherModules.iterator();
             while (it.hasNext()) {
                 ResolveRequest request = (ResolveRequest) it.next();
@@ -275,8 +290,7 @@ public class IvyResolveJob extends Job {
                 IvyDEMessage.info("Successuful resolve of " + request);
                 break;
             case IStatus.ERROR:
-                IvyDEMessage.warn("Error on resolve of " + request + ": "
-                        + status[0].getMessage());
+                IvyDEMessage.warn("Error on resolve of " + request + ": " + status[0].getMessage());
                 request.setResolveFailed(true);
                 errorsStatus.add(status[0]);
                 break;

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolver.java?rev=1407310&r1=1407309&r2=1407310&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolver.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/resolve/IvyResolver.java
Thu Nov  8 23:02:50 2012
@@ -137,12 +137,16 @@ public class IvyResolver {
                     result = doResolve(ivy, md);
                 }
 
-                IStatus retrieveStatus = maybeRetrieve(ivy, md, result, monitor);
-                if (!retrieveStatus.isOK()) {
-                    return retrieveStatus;
-                }
+                if (result.getProblemMessages().isEmpty()) {
+                    // only continue if we resolved correctly
 
-                postResolveOrRefresh(ivy, md, result, monitor);
+                    IStatus retrieveStatus = maybeRetrieve(ivy, md, result, monitor);
+                    if (!retrieveStatus.isOK()) {
+                        return retrieveStatus;
+                    }
+    
+                    postResolveOrRefresh(ivy, md, result, monitor);
+                }
             } catch (ParseException e) {
                 String errorMsg = "Error while parsing the ivy file from " + this.toString()
+ "\n"
                         + e.getMessage();
@@ -226,6 +230,7 @@ public class IvyResolver {
 
     private ResolveResult doResolve(Ivy ivy, ModuleDescriptor md) throws ParseException,
             IOException {
+        IvyDEMessage.debug("Doing a full resolve...");
         ResolveOptions resolveOption = new ResolveOptions();
         resolveOption.setConfs(confs);
         resolveOption.setValidate(ivy.getSettings().doValidate());
@@ -233,6 +238,12 @@ public class IvyResolver {
         resolveOption.setResolveId(IvyClasspathUtil.buildResolveId(useExtendedResolveId,
md));
         ResolveReport report = ivy.getResolveEngine().resolve(md, resolveOption);
 
+        if (report.hasError()) {
+            IvyDEMessage.verbose("Resolve ended with errors");
+        } else {
+            IvyDEMessage.verbose("Resolve successfull");
+        }
+
         ResolveResult result = new ResolveResult(report);
 
         ArtifactDownloadReport[] artifactReports = report.getArtifactsReports(null, false);
@@ -297,6 +308,7 @@ public class IvyResolver {
     private IStatus maybeRetrieve(Ivy ivy, ModuleDescriptor md, ResolveResult result,
             IProgressMonitor monitor) throws IOException {
         if (retrievePattern == null || project == null) {
+            IvyDEMessage.debug("No file retrieving configured");
             return Status.OK_STATUS;
         }
 
@@ -331,9 +343,13 @@ public class IvyResolver {
         // FIXME here we will parse a report we already have
         // with a better Java API, we could do probably better
         int numberOfItemsRetrieved = ivy.retrieve(md.getModuleRevisionId(), pattern, options);
+
+        IvyDEMessage.info(numberOfItemsRetrieved + " retrieved file(s)");
+
         if (numberOfItemsRetrieved > 0) {
             // Only refresh if we actually retrieved a file.
             IFolder retrieveFolder = project.getFolder(refreshPath);
+            IvyDEMessage.verbose("Refreshing Eclipse folder " + retrieveFolder);
             RefreshFolderJob refreshFolderJob = new RefreshFolderJob(retrieveFolder);
             refreshFolderJob.schedule();
         }



Mime
View raw message