Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2014-01-28 03:55:43 -0500
committerEike Stepper2014-01-28 03:55:43 -0500
commitb8954ab757457255c79d8f27d22c2dece3e87fd8 (patch)
tree76c2fc9b2e8514185170b188197cc69366a0d166
parenteee341797c6f3a54570a2b5595d86386ecf52abd (diff)
downloadcdo-committers/estepper/targlets.tar.gz
cdo-committers/estepper/targlets.tar.xz
cdo-committers/estepper/targlets.zip
Improve setup related models; add Targletscommitters/estepper/targlets
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.edit/src/org/eclipse/emf/cdo/releng/setup/provider/TargletImportTaskItemProvider.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/model/setup.ecore3
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletBundleContainer.java217
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletProfileManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TestAction.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/SetupFactory.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/TargletData.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupFactoryImpl.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupPackageImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletDataImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java45
-rw-r--r--plugins/org.eclipse.emf.cdo.releng/releng.setup21
12 files changed, 208 insertions, 125 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.edit/src/org/eclipse/emf/cdo/releng/setup/provider/TargletImportTaskItemProvider.java b/plugins/org.eclipse.emf.cdo.releng.setup.edit/src/org/eclipse/emf/cdo/releng/setup/provider/TargletImportTaskItemProvider.java
index 3a25a3318f..f2789a0a34 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.edit/src/org/eclipse/emf/cdo/releng/setup/provider/TargletImportTaskItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.edit/src/org/eclipse/emf/cdo/releng/setup/provider/TargletImportTaskItemProvider.java
@@ -26,6 +26,7 @@ import java.util.List;
* <!-- end-user-doc -->
* @generated
*/
+@SuppressWarnings("deprecation")
public class TargletImportTaskItemProvider extends SetupTaskItemProvider implements IEditingDomainItemProvider,
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/model/setup.ecore b/plugins/org.eclipse.emf.cdo.releng.setup/model/setup.ecore
index c8a1728de1..4160b9bd04 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/model/setup.ecore
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/model/setup.ecore
@@ -226,7 +226,8 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="activeP2Repositories" upperBound="-1"
eType="#//P2Repository" changeable="false" volatile="true" transient="true"
derived="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="includeSources" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="includeSources" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+ defaultValueLiteral="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="includeAllPlatforms" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RepositoryList">
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletBundleContainer.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletBundleContainer.java
index 13570bf492..b0fd012be7 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletBundleContainer.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletBundleContainer.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.releng.setup.P2Repository;
import org.eclipse.emf.cdo.releng.setup.RepositoryList;
import org.eclipse.emf.cdo.releng.setup.SetupFactory;
import org.eclipse.emf.cdo.releng.setup.Targlet;
+import org.eclipse.emf.cdo.releng.setup.TargletData;
import org.eclipse.emf.cdo.releng.setup.util.XMLUtil;
import org.eclipse.emf.cdo.releng.setup.util.XMLUtil.ElementHandler;
@@ -24,6 +25,9 @@ import org.eclipse.net4j.util.HexUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.io.IOUtil;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
@@ -36,7 +40,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.engine.Phase;
import org.eclipse.equinox.internal.p2.engine.PhaseSet;
import org.eclipse.equinox.internal.p2.engine.phases.Collect;
@@ -78,8 +81,6 @@ import org.eclipse.pde.internal.core.target.AbstractBundleContainer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -105,6 +106,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -143,7 +145,7 @@ public class TargletBundleContainer extends AbstractBundleContainer
private final AtomicBoolean profileNeedsUpdate = new AtomicBoolean();
- private List<Targlet> targlets = new ArrayList<Targlet>();
+ private EList<Targlet> targlets = new BasicEList<Targlet>();
private transient ITargetDefinition target;
@@ -155,6 +157,15 @@ public class TargletBundleContainer extends AbstractBundleContainer
{
}
+ /**
+ * Copies the passed targlets into this targlet container. Modifications of the passed targlets after the call
+ * to this constructor won't have an impact on this targlet container.
+ */
+ public TargletBundleContainer(Collection<? extends TargletData> targlets)
+ {
+ setTarglets(targlets);
+ }
+
@Override
public String getType()
{
@@ -166,47 +177,67 @@ public class TargletBundleContainer extends AbstractBundleContainer
return target;
}
- public List<Targlet> getTarglets()
+ /**
+ * Returns a copy of the targlet with the given name in this targlet container. This copy can be freely modified but the modifications won't have an impact
+ * on a targlet container unless the copy is set back into a container via {@link #setTarglets(Collection)}.
+ */
+ public Targlet getTarglet(String name)
{
- return Collections.unmodifiableList(targlets);
+ int index = getTargletIndex(name);
+ if (index != -1)
+ {
+ return SetupFactory.eINSTANCE.createTarglet(targlets.get(index));
+ }
+
+ return null;
}
- public Targlet getTarglet(String name)
+ public int getTargletIndex(String name)
{
- for (Targlet targlet : targlets)
+ for (int i = 0; i < targlets.size(); i++)
{
+ Targlet targlet = targlets.get(i);
if (ObjectUtil.equals(targlet.getName(), name))
{
- return targlet;
+ return i;
}
}
- return null;
+ return -1;
}
- public void addTarglet(Targlet targlet)
+ public boolean hasTarglet(String name)
{
- Targlet copy = SetupFactory.eINSTANCE.createTarglet(targlet);
+ return getTargletIndex(name) != -1;
+ }
- removeTarglet(copy.getName());
- targlets.add(copy);
- resetProfile();
+ /**
+ * Returns a copy of the targlets in this targlet container. This copy can be freely modified but the modifications won't have an impact
+ * on a targlet container unless the copy is set back into a container via {@link #setTarglets(Collection)}.
+ */
+ public EList<Targlet> getTarglets()
+ {
+ return SetupFactory.eINSTANCE.createTarglets(targlets);
}
- public Targlet removeTarglet(String name)
+ /**
+ * Copies the passed targlets into this targlet container. Modifications of the passed targlets after the call
+ * to this method won't have an impact on this targlet container.
+ */
+ public void setTarglets(Collection<? extends TargletData> targlets)
{
- for (Iterator<Targlet> it = targlets.iterator(); it.hasNext();)
+ Set<String> names = new HashSet<String>();
+ for (TargletData targlet : targlets)
{
- Targlet targlet = it.next();
- if (ObjectUtil.equals(targlet.getName(), name))
+ String name = targlet.getName();
+ if (!names.add(name))
{
- it.remove();
- resetProfile();
- return targlet;
+ throw new IllegalArgumentException("Duplicate targlet name: " + name);
}
}
- return null;
+ this.targlets = SetupFactory.eINSTANCE.createTarglets(targlets);
+ resetProfile();
}
@Override
@@ -423,7 +454,6 @@ public class TargletBundleContainer extends AbstractBundleContainer
{
super.associateWithTarget(target);
this.target = target;
-
}
public void updateProfile(IProgressMonitor monitor) throws ProvisionException
@@ -614,6 +644,7 @@ public class TargletBundleContainer extends AbstractBundleContainer
{
profileNeedsUpdate.set(true);
// TODO Handle update problems, e.g. "return" to last working profile
+ TargletProfileManager.throwProvisionException(t);
}
}
@@ -768,19 +799,6 @@ public class TargletBundleContainer extends AbstractBundleContainer
if (isOSGiBundle(unit))
{
generateBundle(unit, cache, bundles);
-
- // if (getIncludeSource())
- // {
- // // bit of a hack using the bundle naming convention for finding source bundles
- // // but this matches what we do when adding source to the profile so...
- // IQuery<IInstallableUnit> sourceQuery = QueryUtil.createIUQuery(unit.getId() + ".source",
- // unit.getVersion());
- // IQueryResult<IInstallableUnit> result = metadata.query(sourceQuery, null);
- // if (!result.isEmpty())
- // {
- // generateBundle(result.iterator().next(), artifacts, bundles);
- // }
- // }
}
else if (isFeatureJar(unit))
{
@@ -1044,95 +1062,82 @@ public class TargletBundleContainer extends AbstractBundleContainer
return null;
}
- public static TargletBundleContainer fromXML(String xml) throws CoreException
+ public static TargletBundleContainer fromXML(String xml) throws ProvisionException
{
- Element containerElement;
-
try
{
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = docBuilder.parse(new ByteArrayInputStream(xml.getBytes("UTF-8")));
- containerElement = document.getDocumentElement();
- }
- catch (Exception e)
- {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- }
- if (containerElement != null)
- {
- String locationType = containerElement.getAttribute(LOCATION_TYPE);
- if (locationType.equals(TYPE))
+ Element containerElement = document.getDocumentElement();
+ if (containerElement != null)
{
- TargletBundleContainer container = new TargletBundleContainer();
-
- NodeList targletNodes = containerElement.getChildNodes();
- for (int i = 0; i < targletNodes.getLength(); i++)
+ String locationType = containerElement.getAttribute(LOCATION_TYPE);
+ if (locationType.equals(TYPE))
{
- Node targletNode = targletNodes.item(i);
- if (targletNode instanceof Element)
+ final EList<Targlet> targlets = new BasicEList<Targlet>();
+
+ XMLUtil.handleChildElements(containerElement, new ElementHandler()
{
- Element targletElement = (Element)targletNode;
-
- Targlet targlet = SetupFactory.eINSTANCE.createTarglet();
- targlet.setName(targletElement.getAttribute(TARGLET_NAME));
- targlet.setActiveRepositoryList(targletElement.getAttribute(TARGLET_ACTIVE_REPOSITORY_LIST));
- targlet.setIncludeSources(Boolean.valueOf(targletElement.getAttribute(TARGLET_INCLUDE_SOURCES)));
- targlet.setIncludeAllPlatforms( //
- Boolean.valueOf(targletElement.getAttribute(TARGLET_INCLUDE_ALL_PLATFORMS)));
- container.addTarglet(targlet);
-
- NodeList childNodes = targletElement.getChildNodes();
- for (int j = 0; j < childNodes.getLength(); j++)
+ public void handleElement(Element targletElement) throws Exception
{
- Node childNode = childNodes.item(j);
- if (childNode instanceof Element)
+ final Targlet targlet = SetupFactory.eINSTANCE.createTarglet();
+ targlet.setName(targletElement.getAttribute(TARGLET_NAME));
+ targlet.setActiveRepositoryList(targletElement.getAttribute(TARGLET_ACTIVE_REPOSITORY_LIST));
+ targlet.setIncludeSources(Boolean.valueOf(targletElement.getAttribute(TARGLET_INCLUDE_SOURCES)));
+ targlet.setIncludeAllPlatforms( //
+ Boolean.valueOf(targletElement.getAttribute(TARGLET_INCLUDE_ALL_PLATFORMS)));
+ targlets.add(targlet);
+
+ XMLUtil.handleChildElements(targletElement, new ElementHandler()
{
- Element childElement = (Element)childNode;
- String tag = childElement.getTagName();
- if (ROOT.equals(tag))
- {
- InstallableUnit root = SetupFactory.eINSTANCE.createInstallableUnit();
- root.setID(childElement.getAttribute(ROOT_ID));
- root.setVersionRange(new VersionRange(childElement.getAttribute(ROOT_VERSION_RANGE)));
- targlet.getRoots().add(root);
- }
- else if (SOURCE_LOCATOR.equals(tag))
+ public void handleElement(Element childElement) throws Exception
{
- AutomaticSourceLocator sourceLocator = SetupFactory.eINSTANCE.createAutomaticSourceLocator();
- sourceLocator.setRootFolder(childElement.getAttribute(SOURCE_LOCATOR_ROOT_FOLDER));
- sourceLocator.setLocateNestedProjects(Boolean.valueOf(childElement
- .getAttribute(SOURCE_LOCATOR_LOCATE_NESTED_PROJECTS)));
- targlet.getSourceLocators().add(sourceLocator);
- }
- else if (REPOSITORY_LIST.equals(tag))
- {
- RepositoryList repositoryList = SetupFactory.eINSTANCE.createRepositoryList();
- repositoryList.setName(childElement.getAttribute(REPOSITORY_LIST_NAME));
- targlet.getRepositoryLists().add(repositoryList);
-
- NodeList repositoryNodes = childElement.getChildNodes();
- for (int k = 0; k < repositoryNodes.getLength(); k++)
+ String tag = childElement.getTagName();
+ if (ROOT.equals(tag))
{
- Node repositoryNode = repositoryNodes.item(k);
- if (repositoryNode instanceof Element)
- {
- Element repositoryElement = (Element)repositoryNode;
+ InstallableUnit root = SetupFactory.eINSTANCE.createInstallableUnit();
+ root.setID(childElement.getAttribute(ROOT_ID));
+ root.setVersionRange(new VersionRange(childElement.getAttribute(ROOT_VERSION_RANGE)));
+ targlet.getRoots().add(root);
+ }
+ else if (SOURCE_LOCATOR.equals(tag))
+ {
+ AutomaticSourceLocator sourceLocator = SetupFactory.eINSTANCE.createAutomaticSourceLocator();
+ sourceLocator.setRootFolder(childElement.getAttribute(SOURCE_LOCATOR_ROOT_FOLDER));
+ sourceLocator.setLocateNestedProjects(Boolean.valueOf(childElement
+ .getAttribute(SOURCE_LOCATOR_LOCATE_NESTED_PROJECTS)));
+ targlet.getSourceLocators().add(sourceLocator);
+ }
+ else if (REPOSITORY_LIST.equals(tag))
+ {
+ final RepositoryList repositoryList = SetupFactory.eINSTANCE.createRepositoryList();
+ repositoryList.setName(childElement.getAttribute(REPOSITORY_LIST_NAME));
+ targlet.getRepositoryLists().add(repositoryList);
- P2Repository p2Repository = SetupFactory.eINSTANCE.createP2Repository();
- p2Repository.setURL(repositoryElement.getAttribute(REPOSITORY_URL));
- repositoryList.getP2Repositories().add(p2Repository);
- }
+ XMLUtil.handleChildElements(childElement, new ElementHandler()
+ {
+ public void handleElement(Element repositoryElement) throws Exception
+ {
+ P2Repository p2Repository = SetupFactory.eINSTANCE.createP2Repository();
+ p2Repository.setURL(repositoryElement.getAttribute(REPOSITORY_URL));
+ repositoryList.getP2Repositories().add(p2Repository);
+ }
+ });
}
}
- }
+ });
}
- }
- }
+ });
- return container;
+ return new TargletBundleContainer(targlets);
+ }
}
}
+ catch (Exception ex)
+ {
+ TargletProfileManager.throwProvisionException(ex);
+ }
return null;
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletProfileManager.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletProfileManager.java
index 6ce31d8ee6..5f9bf21f48 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletProfileManager.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TargletProfileManager.java
@@ -183,7 +183,7 @@ public final class TargletProfileManager
profile = profileRegistry.addProfile(profileID, properties);
- initialize(monitor);
+ // initialize(monitor);
}
if (needsUpdate != null)
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TestAction.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TestAction.java
index d606102d57..70ad7082bc 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TestAction.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/targlets/TestAction.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.releng.setup.RepositoryList;
import org.eclipse.emf.cdo.releng.setup.SetupFactory;
import org.eclipse.emf.cdo.releng.setup.Targlet;
+import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -158,8 +159,7 @@ public class TestAction implements IWorkbenchWindowActionDelegate
targlet.getRepositoryLists().add(repositoryList);
targlet.setActiveRepositoryList(repositoryList.getName());
- TargletBundleContainer container = new TargletBundleContainer();
- container.addTarglet(targlet);
+ TargletBundleContainer container = new TargletBundleContainer(ECollections.singletonEList(targlet));
ITargetLocation[] locations = { container };
@SuppressWarnings("restriction")
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/SetupFactory.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/SetupFactory.java
index ab3c890922..bed55cc832 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/SetupFactory.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/SetupFactory.java
@@ -10,8 +10,10 @@
*/
package org.eclipse.emf.cdo.releng.setup;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EFactory;
+import java.util.Collection;
import java.util.Set;
/**
@@ -364,6 +366,8 @@ public interface SetupFactory extends EFactory
Targlet createTarglet(TargletData source);
+ EList<Targlet> createTarglets(Collection<? extends TargletData> targlets);
+
/**
* Returns a new object of class '<em>Repository List</em>'.
* <!-- begin-user-doc -->
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/TargletData.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/TargletData.java
index 16981ab5f3..f817260a53 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/TargletData.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/TargletData.java
@@ -148,6 +148,7 @@ public interface TargletData extends EObject
/**
* Returns the value of the '<em><b>Include Sources</b></em>' attribute.
+ * The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Include Sources</em>' attribute isn't clear,
@@ -157,7 +158,7 @@ public interface TargletData extends EObject
* @return the value of the '<em>Include Sources</em>' attribute.
* @see #setIncludeSources(boolean)
* @see org.eclipse.emf.cdo.releng.setup.SetupPackage#getTargletData_IncludeSources()
- * @model
+ * @model default="true"
* @generated
*/
boolean isIncludeSources();
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupFactoryImpl.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupFactoryImpl.java
index 777f02e822..afd120b5c2 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupFactoryImpl.java
@@ -69,6 +69,7 @@ import org.eclipse.emf.cdo.releng.setup.VariableChoice;
import org.eclipse.emf.cdo.releng.setup.VariableType;
import org.eclipse.emf.cdo.releng.setup.WorkingSetTask;
+import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
@@ -82,6 +83,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.metadata.VersionRange;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -761,9 +763,15 @@ public class SetupFactoryImpl extends EFactoryImpl implements SetupFactory
public Targlet createTarglet(TargletData source)
{
+ String activeRepositoryList = source.getActiveRepositoryList();
+ if (activeRepositoryList != null && activeRepositoryList.length() == 0)
+ {
+ activeRepositoryList = null;
+ }
+
Targlet targlet = SetupFactory.eINSTANCE.createTarglet();
targlet.setName(source.getName());
- targlet.setActiveRepositoryList(source.getActiveRepositoryList());
+ targlet.setActiveRepositoryList(activeRepositoryList);
targlet.setIncludeSources(source.isIncludeSources());
targlet.setIncludeAllPlatforms(source.isIncludeAllPlatforms());
@@ -785,6 +793,17 @@ public class SetupFactoryImpl extends EFactoryImpl implements SetupFactory
return targlet;
}
+ public EList<Targlet> createTarglets(Collection<? extends TargletData> targlets)
+ {
+ EList<Targlet> result = new BasicEList<Targlet>();
+ for (TargletData source : targlets)
+ {
+ result.add(createTarglet(source));
+ }
+
+ return result;
+ }
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupPackageImpl.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupPackageImpl.java
index f21b203207..cad4b11c3b 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupPackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/SetupPackageImpl.java
@@ -3380,7 +3380,7 @@ public class SetupPackageImpl extends EPackageImpl implements SetupPackage
initEReference(getTargletData_ActiveP2Repositories(), getP2Repository(), null, "activeP2Repositories", null, 0, -1,
TargletData.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES,
!IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getTargletData_IncludeSources(), ecorePackage.getEBoolean(), "includeSources", null, 0, 1,
+ initEAttribute(getTargletData_IncludeSources(), ecorePackage.getEBoolean(), "includeSources", "true", 0, 1,
TargletData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
initEAttribute(getTargletData_IncludeAllPlatforms(), ecorePackage.getEBoolean(), "includeAllPlatforms", null, 0, 1,
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletDataImpl.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletDataImpl.java
index 6994bef303..5b48b9d12b 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletDataImpl.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletDataImpl.java
@@ -122,7 +122,7 @@ public abstract class TargletDataImpl extends MinimalEObjectImpl.Container imple
* @generated
* @ordered
*/
- protected static final boolean INCLUDE_SOURCES_EDEFAULT = false;
+ protected static final boolean INCLUDE_SOURCES_EDEFAULT = true;
/**
* The cached value of the '{@link #isIncludeSources() <em>Include Sources</em>}' attribute.
@@ -281,10 +281,16 @@ public abstract class TargletDataImpl extends MinimalEObjectImpl.Container imple
EList<P2Repository> result = new EObjectEList<P2Repository>(P2Repository.class, this,
SetupPackage.TARGLET__ACTIVE_P2_REPOSITORIES);
+ EList<RepositoryList> repositoryLists = getRepositoryLists();
String name = getActiveRepositoryList();
+ if (name == null && !repositoryLists.isEmpty())
+ {
+ name = repositoryLists.get(0).getName();
+ }
+
if (name != null)
{
- for (RepositoryList repositoryList : getRepositoryLists())
+ for (RepositoryList repositoryList : repositoryLists)
{
if (name.equals(repositoryList.getName()))
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java
index c356a6c4b8..87191e96c4 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/TargletTaskImpl.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.releng.setup.util.ServiceUtil;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
@@ -137,7 +138,7 @@ public class TargletTaskImpl extends SetupTaskImpl implements TargletTask
* @generated
* @ordered
*/
- protected static final boolean INCLUDE_SOURCES_EDEFAULT = false;
+ protected static final boolean INCLUDE_SOURCES_EDEFAULT = true;
/**
* The cached value of the '{@link #isIncludeSources() <em>Include Sources</em>}' attribute.
@@ -304,10 +305,16 @@ public class TargletTaskImpl extends SetupTaskImpl implements TargletTask
EList<P2Repository> result = new EObjectEList<P2Repository>(P2Repository.class, this,
SetupPackage.TARGLET__ACTIVE_P2_REPOSITORIES);
+ EList<RepositoryList> repositoryLists = getRepositoryLists();
String name = getActiveRepositoryList();
+ if (name == null && !repositoryLists.isEmpty())
+ {
+ name = repositoryLists.get(0).getName();
+ }
+
if (name != null)
{
- for (RepositoryList repositoryList : getRepositoryLists())
+ for (RepositoryList repositoryList : repositoryLists)
{
if (name.equals(repositoryList.getName()))
{
@@ -641,7 +648,7 @@ public class TargletTaskImpl extends SetupTaskImpl implements TargletTask
}
boolean targetNeedsActivation = true;
- if (target.equals(activeTarget))
+ if (target.getHandle().equals(activeTarget.getHandle()))
{
targetNeedsActivation = false;
}
@@ -679,19 +686,43 @@ public class TargletTaskImpl extends SetupTaskImpl implements TargletTask
target.setName(TARGET_NAME);
}
+ EList<Targlet> targlets;
if (targletContainer == null)
{
targletContainer = new TargletBundleContainer();
+ ITargetLocation[] newLocations;
ITargetLocation[] oldLocations = target.getTargetLocations();
- ITargetLocation[] newLocations = new ITargetLocation[oldLocations.length + 1];
- System.arraycopy(oldLocations, 0, newLocations, 0, oldLocations.length);
- newLocations[oldLocations.length] = targletContainer;
+ if (oldLocations != null && oldLocations.length != 0)
+ {
+ newLocations = new ITargetLocation[oldLocations.length + 1];
+ System.arraycopy(oldLocations, 0, newLocations, 0, oldLocations.length);
+ newLocations[oldLocations.length] = targletContainer;
+ }
+ else
+ {
+ newLocations = new ITargetLocation[] { targletContainer };
+ }
target.setTargetLocations(newLocations);
+
+ targlets = ECollections.singletonEList(targlet);
+ }
+ else
+ {
+ targlets = targletContainer.getTarglets();
+ int index = targletContainer.getTargletIndex(targlet.getName());
+ if (index != -1)
+ {
+ targlets.set(index, targlet);
+ }
+ else
+ {
+ targlets.add(targlet);
+ }
}
- targletContainer.addTarglet(targlet);
+ targletContainer.setTarglets(targlets);
service.saveTargetDefinition(target);
target.resolve(new ProgressLogMonitor(context));
diff --git a/plugins/org.eclipse.emf.cdo.releng/releng.setup b/plugins/org.eclipse.emf.cdo.releng/releng.setup
index ebb5af6a92..1ca16cf706 100644
--- a/plugins/org.eclipse.emf.cdo.releng/releng.setup
+++ b/plugins/org.eclipse.emf.cdo.releng/releng.setup
@@ -25,8 +25,8 @@
<setupTasks xsi:type="setup:ContextVariableTask" documentation="The folder location of the shared target platform bundle pool used by Buckminster in the self hosting IDE." name="launcher.setup.ide.p2pool" value="${setup.install.dir/.p2pool-tp}" stringSubstitution="true"/>
<setupTasks xsi:type="setup:ApiBaselineTask" disabled="true" version="4.2" containerFolder="${setup.install.dir/cdo/.baselines}" zipLocation="http://sourceforge.net/projects/net4j/files/Baselines/emf-cdo-4.2-baseline.zip/download"/>
<setupTasks xsi:type="setup:GitCloneTask" location="${git.clone}" remoteURI="ssh://git.eclipse.org:29418/cdo/cdo" checkoutBranch="master"/>
- <setupTasks xsi:type="setup:ResourceCreationTask" content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;projectDescription>&#xD;&#xA;&#x9;&lt;name>.buckminster&lt;/name>&#xD;&#xA;&#x9;&lt;comment>&lt;/comment>&#xD;&#xA;&#x9;&lt;projects>&#xD;&#xA;&#x9;&lt;/projects>&#xD;&#xA;&#x9;&lt;buildSpec>&#xD;&#xA;&#x9;&lt;/buildSpec>&#xD;&#xA;&#x9;&lt;natures>&#xD;&#xA;&#x9;&lt;/natures>&#xD;&#xA;&lt;/projectDescription>&#xD;&#xA;" targetURL="${setup.ws.dir|uri}/.buckminster/.project"/>
- <setupTasks xsi:type="setup:MaterializationTask">
+ <setupTasks xsi:type="setup:ResourceCreationTask" disabled="true" content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;projectDescription>&#xD;&#xA;&#x9;&lt;name>.buckminster&lt;/name>&#xD;&#xA;&#x9;&lt;comment>&lt;/comment>&#xD;&#xA;&#x9;&lt;projects>&#xD;&#xA;&#x9;&lt;/projects>&#xD;&#xA;&#x9;&lt;buildSpec>&#xD;&#xA;&#x9;&lt;/buildSpec>&#xD;&#xA;&#x9;&lt;natures>&#xD;&#xA;&#x9;&lt;/natures>&#xD;&#xA;&lt;/projectDescription>&#xD;&#xA;" targetURL="${setup.ws.dir|uri}/.buckminster/.project"/>
+ <setupTasks xsi:type="setup:MaterializationTask" disabled="true">
<rootComponents name="org.eclipse.sdk"/>
<rootComponents name="org.eclipse.emf.cdo.releng.all"/>
<rootComponents name="org.eclipse.emf.cdo.releng.release" type="osgi.bundle"/>
@@ -50,6 +50,21 @@
<p2Repositories url="http://download.eclipse.org/technology/nebula/snapshot"/>
<p2Repositories url="http://download.eclipse.org/releases/luna"/>
</setupTasks>
+ <setupTasks xsi:type="setup:TargletTask" name="CDO Releng" activeRepositoryList="Milestones">
+ <roots id="org.eclipse.emf.cdo.releng.all.feature.group"/>
+ <roots id="org.eclipse.sdk.feature.group"/>
+ <sourceLocators rootFolder="${git.clone}"/>
+ <repositoryLists name="Milestones">
+ <p2Repositories url="http://download.eclipse.org/eclipse/updates/4.4milestones"/>
+ <p2Repositories url="http://download.eclipse.org/tools/orbit/downloads/drops/S20140116105218/repository"/>
+ <p2Repositories url="http://download.eclipse.org/tools/buckminster/updates-4.3"/>
+ <p2Repositories url="http://download.eclipse.org/tools/gef/updates/milestones"/>
+ <p2Repositories url="http://download.eclipse.org/modeling/emf/emf/updates/2.10milestones"/>
+ <p2Repositories url="http://download.eclipse.org/egit/updates-stable-nightly"/>
+ <p2Repositories url="http://download.eclipse.org/mylyn/snapshots/weekly"/>
+ <p2Repositories url="http://download.eclipse.org/technology/nebula/snapshot"/>
+ </repositoryLists>
+ </setupTasks>
<setupTasks xsi:type="setup:WorkingSetTask">
<workingSets name="Development Environment Setup">
<predicates xsi:type="predicates:NamePredicate" pattern=".*\.setup.*"/>
@@ -86,7 +101,7 @@
<workingSets name="Releng">
<predicates xsi:type="predicates:AndPredicate">
<operands xsi:type="predicates:RepositoryPredicate" project="org.eclipse.emf.cdo.releng.release"/>
- <operands xsi:type="workingsets:ExclusionPredicate" excludedWorkingSets="//@branches[name='master']/@setupTasks.12/@workingSets.0 //@branches[name='master']/@setupTasks.12/@workingSets.1 //@branches[name='master']/@setupTasks.12/@workingSets.2 //@branches[name='master']/@setupTasks.12/@workingSets.3 //@branches[name='master']/@setupTasks.12/@workingSets.4 //@branches[name='master']/@setupTasks.12/@workingSets.5 //@branches[name='master']/@setupTasks.12/@workingSets.6"/>
+ <operands xsi:type="workingsets:ExclusionPredicate" excludedWorkingSets="//@branches[name='master']/@setupTasks.13/@workingSets.0 //@branches[name='master']/@setupTasks.13/@workingSets.1 //@branches[name='master']/@setupTasks.13/@workingSets.2 //@branches[name='master']/@setupTasks.13/@workingSets.3 //@branches[name='master']/@setupTasks.13/@workingSets.4 //@branches[name='master']/@setupTasks.13/@workingSets.5 //@branches[name='master']/@setupTasks.13/@workingSets.6"/>
</predicates>
</workingSets>
</setupTasks>

Back to the top