Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-02-10 20:27:59 -0500
committerAndrew Niefer2010-02-10 20:27:59 -0500
commitb1643fb0dd4cc405c15575ca42415a27bfa710fd (patch)
tree4c7230fe7c2989a4df5c9c347f75bf6b1199450b /bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse
parent32c724f43579233028fc48080904606382a4318c (diff)
downloadrt.equinox.p2-b1643fb0dd4cc405c15575ca42415a27bfa710fd.tar.gz
rt.equinox.p2-b1643fb0dd4cc405c15575ca42415a27bfa710fd.tar.xz
rt.equinox.p2-b1643fb0dd4cc405c15575ca42415a27bfa710fd.zip
bug 302283 - exclude artifacts from compare
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ComparatorDescription.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java25
4 files changed, 143 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java
new file mode 100644
index 000000000..09d09b7e2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java
@@ -0,0 +1,77 @@
+package org.eclipse.equinox.p2.internal.repository.tools.tasks;
+
+import java.util.Properties;
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Parameter;
+import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.repository.artifact.*;
+
+public class ArtifactDescription extends DataType {
+
+ private String classifier = null;
+ private String id = null;
+ private String version = null;
+ private String range = null;
+ private Properties properties = null;
+
+ public void setClassifier(String classifier) {
+ this.classifier = classifier;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public void setRange(String range) {
+ this.range = range;
+ }
+
+ public void addConfiguredProperty(Parameter property) {
+ if (properties == null)
+ properties = new Properties();
+
+ properties.put(property.getName(), property.getValue());
+ }
+
+ public String getClassifier() {
+ return classifier;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public IQuery<IArtifactKey> createKeyQuery() {
+ VersionRange keyRange = null;
+ if (range != null)
+ keyRange = new VersionRange(range);
+ else if (version != null) {
+ Version keyVersion = Version.parseVersion(version);
+ keyRange = new VersionRange(keyVersion, true, keyVersion, true);
+ }
+ return new ArtifactKeyQuery(classifier, id, keyRange);
+ }
+
+ public IQuery<IArtifactDescriptor> createDescriptorQuery() {
+ VersionRange keyRange = null;
+ if (range != null)
+ keyRange = new VersionRange(range);
+ else if (version != null) {
+ Version keyVersion = Version.parseVersion(version);
+ keyRange = new VersionRange(keyVersion, true, keyVersion, true);
+ }
+
+ ArtifactDescriptorQuery query = new ArtifactDescriptorQuery(id, keyRange, null);
+ query.setProperties(properties);
+ return query;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ComparatorDescription.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ComparatorDescription.java
index 9ec3fc38b..437a6dd0b 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ComparatorDescription.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ComparatorDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,13 +11,15 @@
package org.eclipse.equinox.p2.internal.repository.tools.tasks;
import java.io.File;
+import java.util.List;
import org.apache.tools.ant.types.DataType;
public class ComparatorDescription extends DataType {
- DestinationRepository baseline;
- String comparatorId;
- File comparatorLog;
+ private DestinationRepository baseline;
+ private String comparatorId;
+ private File comparatorLog;
+ private List<ArtifactDescription> excludedArtifacts = null;
/*
* Set the baseline repository to compare to
@@ -26,6 +28,10 @@ public class ComparatorDescription extends DataType {
this.baseline = value;
}
+ public void addConfiguredExclude(ElementList<ArtifactDescription> excludeList) {
+ excludedArtifacts = excludeList.getElements();
+ }
+
/*
* Set the comparator to use
*/
@@ -51,4 +57,8 @@ public class ComparatorDescription extends DataType {
public File getComparatorLog() {
return comparatorLog;
}
+
+ public List<ArtifactDescription> getExcluded() {
+ return excludedArtifacts;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java
new file mode 100644
index 000000000..6968e4217
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.p2.internal.repository.tools.tasks;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.tools.ant.types.DataType;
+
+public class ElementList<T> extends DataType {
+
+ private List<T> elements = new ArrayList<T>();
+
+ public void addConfigured(T element) {
+ elements.add(element);
+ }
+
+ public List<T> getElements() {
+ return elements;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
index 71f2b8bda..cb4662088 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
@@ -10,15 +10,18 @@
*******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools.tasks;
-import org.eclipse.equinox.p2.core.ProvisionException;
-
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
import org.apache.tools.ant.BuildException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.internal.repository.tools.MirrorApplication;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.CompoundQuery;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
public class MirrorTask extends AbstractRepositoryTask {
@@ -48,6 +51,7 @@ public class MirrorTask extends AbstractRepositoryTask {
// Set comparator log
if (comparator.getComparatorLog() != null)
((MirrorApplication) application).setComparatorLog(comparator.getComparatorLog());
+ ((MirrorApplication) application).setComparatorExclusions(createCompareExclusions());
}
prepareSourceRepos();
@@ -65,6 +69,23 @@ public class MirrorTask extends AbstractRepositoryTask {
}
}
+ private IQuery<IArtifactDescriptor> createCompareExclusions() {
+ if (comparator == null || comparator.getExcluded() == null)
+ return null;
+
+ List<ArtifactDescription> artifacts = comparator.getExcluded();
+ List<IQuery<IArtifactDescriptor>> queries = new ArrayList<IQuery<IArtifactDescriptor>>();
+ for (ArtifactDescription artifactDescription : artifacts)
+ queries.add(artifactDescription.createDescriptorQuery());
+
+ if (queries.size() == 1)
+ return queries.get(0);
+
+ @SuppressWarnings("unchecked")
+ IQuery<IArtifactDescriptor>[] array = queries.toArray(new IQuery[queries.size()]);
+ return CompoundQuery.<IArtifactDescriptor> createCompoundQuery(array, false);
+ }
+
public SlicingOption createSlicingOptions() {
SlicingOption options = new SlicingOption();
((MirrorApplication) application).setSlicingOptions(options.getOptions());

Back to the top