ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r988979 - in /ant/ivy/ivyde/trunk: ./ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspac...
Date Wed, 25 Aug 2010 10:21:00 GMT
Author: hibou
Date: Wed Aug 25 10:20:59 2010
New Revision: 988979

URL: http://svn.apache.org/viewvc?rev=988979&view=rev
Log:
IVYDE-234 : Add branch comparison to workspace resolver (thanks to Jeffrey M. Metcalf)

Modified:
    ant/ivy/ivyde/trunk/CHANGES.txt
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java

Modified: ant/ivy/ivyde/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/CHANGES.txt?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/CHANGES.txt Wed Aug 25 10:20:59 2010
@@ -7,6 +7,7 @@
 - NEW: Custom color in XML editors (IVYDE-73)
 - NEW: support for retrieve configuration in non Java project
 - NEW: an IvyDE classpath can now be retrieved (IVYDE-56)
+- NEW: Add branch comparison to workspace resolver (IVYDE-234) (thanks to Jeffrey M. Metcalf)
 
 - IMPROVE: let IvyDE refresh workspace after a resolve (IVYDE-27) (thanks to Clint Burghduff)
 - IMPROVE: IvyDE now resolve by batch, then preventing too many workspace build (IVYDE-177)

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
Wed Aug 25 10:20:59 2010
@@ -138,7 +138,9 @@ public class IvyPlugin extends AbstractU
                             || event.getProperty() == PreferenceConstants.RETRIEVE_PATTERN
                             || event.getProperty() == PreferenceConstants.RETRIEVE_SYNC
                             || event.getProperty() == PreferenceConstants.ALPHABETICAL_ORDER
-                            || event.getProperty() == PreferenceConstants.RESOLVE_IN_WORKSPACE)
{
+                            || event.getProperty() == PreferenceConstants.RESOLVE_IN_WORKSPACE
+                            || event.getProperty() == PreferenceConstants.IGNORE_BRANCH_ON_WORKSPACE_PROJECTS
+                            || event.getProperty() == PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS)
{
                         prefStoreChanged();
                     }
                 } catch (JavaModelException e) {

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
Wed Aug 25 10:20:59 2010
@@ -179,6 +179,15 @@ public class IvyDEPreferenceStoreHelper 
         prefStore.setValue(PreferenceConstants.IVY_CONSOLE_LOG_LEVEL, logLevel);
     }
 
+    public boolean getIgnoreBranchOnWorkspaceProjects() {
+        return prefStore.getBoolean(PreferenceConstants.IGNORE_BRANCH_ON_WORKSPACE_PROJECTS);
+    }
+
+    public void setIgnoreBranchOnWorkspaceProjects(boolean ignoreBranchOnWorkspaceProjects)
{
+        prefStore.setValue(PreferenceConstants.IGNORE_BRANCH_ON_WORKSPACE_PROJECTS,
+            ignoreBranchOnWorkspaceProjects);
+    }
+
     public boolean getIgnoreVersionOnWorkspaceProjects() {
         return prefStore.getBoolean(PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS);
     }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
Wed Aug 25 10:20:59 2010
@@ -82,6 +82,9 @@ public final class PreferenceConstants {
 
     public static final String IVY_CONSOLE_LOG_LEVEL = "ivyConsole.logLevel";
 
+    public static final String IGNORE_BRANCH_ON_WORKSPACE_PROJECTS
+        = "workspaceResolver.ignoreBranch";
+
     public static final String IGNORE_VERSION_ON_WORKSPACE_PROJECTS
         = "workspaceResolver.ignoreVersion";
 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
Wed Aug 25 10:20:59 2010
@@ -98,7 +98,9 @@ public class PreferenceInitializer exten
     public static final boolean DEFAULT_AUTO_RESOLVE_ON_OPEN = false;
 
     public static final boolean DEFAULT_AUTO_RESOLVE_ON_CHANGE = true;
-    
+
+    public static final boolean DEFAULT_IGNORE_BRANCH_ON_WORKSPACE_PROJECTS = false;
+
     public static final boolean DEFAULT_IGNORE_VERSION_ON_WORKSPACE_PROJECTS = false;
 
     public static final boolean DEFAULT_RETRIEVED_CLASSPATH = false;
@@ -151,6 +153,9 @@ public class PreferenceInitializer exten
         store.setDefault(PreferenceConstants.IVY_CONSOLE_LOG_LEVEL,
             DEFAULT_IVY_CONSOLE_LOG_MESSAGE);
 
+        store.setDefault(PreferenceConstants.IGNORE_BRANCH_ON_WORKSPACE_PROJECTS,
+            DEFAULT_IGNORE_BRANCH_ON_WORKSPACE_PROJECTS);
+
         store.setDefault(PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS,
             DEFAULT_IGNORE_VERSION_ON_WORKSPACE_PROJECTS);
 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/WorkspaceResolverPreferencePage.java
Wed Aug 25 10:20:59 2010
@@ -69,6 +69,19 @@ public class WorkspaceResolverPreference
             }
         };
         addField(autoResolveOnOpen);
+        
+        BooleanFieldEditor ignoreBranchOnWorkspaceProjects = new BooleanFieldEditor(
+                PreferenceConstants.IGNORE_BRANCH_ON_WORKSPACE_PROJECTS,
+                "Ignore branch when resolving workspace projects", fieldParent) {
+            protected Label getLabelControl() {
+                Label label = super.getLabelControl();
+                label.setToolTipText("Will ignore the artifact branch when resolving "
+                        + "against workspace projects");
+                return label;
+            }
+        };
+
+        addField(ignoreBranchOnWorkspaceProjects);
 
         BooleanFieldEditor ignoreVersionOnWorkspaceProjects = new BooleanFieldEditor(
                 PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS,
@@ -84,9 +97,10 @@ public class WorkspaceResolverPreference
         addField(ignoreVersionOnWorkspaceProjects);
 
         Label warning = new Label(fieldParent, SWT.NONE);
-        warning.setText("WARNING: you should use this only if you are sure the projets opened\n"
-                + "in your workspace can actually work with each other, be carefull with\n"
-                + "branch management for instance)");
+        warning.setText("WARNING: you should ignore branch and/or revision only\n" +
+        		        "if you are sure that all the project revisions that are\n" +
+        		        "open in your workspace can actually work together\n" +
+                        "(be careful with branch management for instance)");
         GridData gridData = new GridData();
         gridData.horizontalIndent = HORIZ_INDENT;
         warning.setLayoutData(gridData);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java?rev=988979&r1=988978&r2=988979&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
Wed Aug 25 10:20:59 2010
@@ -34,6 +34,7 @@ import org.apache.ivy.core.module.descri
 import org.apache.ivy.core.module.descriptor.ExcludeRule;
 import org.apache.ivy.core.module.descriptor.License;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.DownloadReport;
@@ -106,6 +107,8 @@ public class WorkspaceResolver extends A
 
     private IJavaProject[] projects;
 
+    private boolean ignoreBranchOnWorkspaceProjects;
+
     private boolean ignoreVersionOnWorkspaceProjects;
 
     public WorkspaceResolver(IJavaProject javaProject, IvySettings ivySettings) {
@@ -121,6 +124,9 @@ public class WorkspaceResolver extends A
                     + resolvingJavaProject.getElementName(), e);
         }
 
+        ignoreBranchOnWorkspaceProjects = IvyPlugin.getPreferenceStoreHelper()
+                .getIgnoreBranchOnWorkspaceProjects();
+
         ignoreVersionOnWorkspaceProjects = IvyPlugin.getPreferenceStoreHelper()
                 .getIgnoreVersionOnWorkspaceProjects();
     }
@@ -175,10 +181,36 @@ public class WorkspaceResolver extends A
                     continue;
                 }
 
-                if (!md.getModuleRevisionId().getModuleId().equals(dependencyMrid.getModuleId()))
{
+                ModuleRevisionId candidateMrid = md.getModuleRevisionId();
+
+                if (!candidateMrid.getModuleId().equals(dependencyMrid.getModuleId())) {
                     // it doesn't match org#module
                     continue;
                 }
+                
+                if (!ignoreBranchOnWorkspaceProjects) {
+                    ModuleId mid = dependencyMrid.getModuleId();
+                    String defaultBranch = getSettings().getDefaultBranch(mid);
+                    String dependencyBranch = dependencyMrid.getBranch();
+                    String candidateBranch = candidateMrid.getBranch();
+                    if (dependencyBranch == null) {
+                        dependencyBranch = defaultBranch;
+                    }
+                    if (candidateBranch == null) {
+                        candidateBranch = defaultBranch;
+                    }
+                    if (dependencyBranch != candidateBranch) {
+                        // Both cannot be null
+                        if (dependencyBranch == null || candidateBranch == null) {
+                            // One set, the other isn't, so no match
+                            continue;
+                        }
+                        if (!dependencyBranch.equals(candidateBranch)) {
+                            // Both set but to different branches, so no match
+                            continue;
+                        }
+                    }
+                }
 
                 // Found one; check if it is for the module we need
                 if (ignoreVersionOnWorkspaceProjects



Mime
View raw message