summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2013-08-10 02:44:56 (EDT)
committer Ed Merks2013-08-10 02:44:56 (EDT)
commitff80020bdcfafd5ed221e40826a5e5d63bc25928 (patch)
tree91e96a9eab40797f9f7aa533491cbbcc7fdf8402
parent02defe32410e41b300dac05f8835bb4307645c10 (diff)
downloadcdo-ff80020bdcfafd5ed221e40826a5e5d63bc25928.zip
cdo-ff80020bdcfafd5ed221e40826a5e5d63bc25928.tar.gz
cdo-ff80020bdcfafd5ed221e40826a5e5d63bc25928.tar.bz2
Reset profile when installing the Eclipse IDErefs/changes/09/15309/1
Change-Id: I432eb615002766e565de53cf423cb261aae17612 Signed-off-by: Ed Merks <ed.merks@gmail.com>
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Buckminster.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Files.java136
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/Director.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/model/Configuration.xmi18
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Activator.java93
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Files.java136
8 files changed, 268 insertions, 155 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Buckminster.java b/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Buckminster.java
index aac8e13..c1ec16a 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Buckminster.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Buckminster.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.releng.setup.GitClone;
import org.eclipse.emf.cdo.releng.setup.Project;
import org.eclipse.emf.cdo.releng.setup.Setup;
import org.eclipse.emf.cdo.releng.setup.helper.Downloads;
+import org.eclipse.emf.cdo.releng.setup.helper.Files;
import org.eclipse.emf.cdo.releng.setup.helper.OS;
import org.eclipse.emf.cdo.releng.setup.helper.Progress;
import org.eclipse.emf.cdo.releng.setup.helper.ProgressLogProvider;
@@ -232,7 +233,7 @@ public final class Buckminster
Files.rename(tpOld, tp);
}
- Files.delete(tpBroken);
+ Files.deleteAsync(tpBroken);
throw ex;
}
finally
@@ -252,7 +253,7 @@ public final class Buckminster
if (tpOld != null)
{
- Files.delete(tpOld);
+ Files.deleteAsync(tpOld);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Files.java b/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Files.java
deleted file mode 100644
index d55b459..0000000
--- a/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/Files.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2004-2013 Eike Stepper (Berlin, Germany) 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.releng.setup.ide;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public final class Files
-{
- public static void rename(File from, File to) throws IOException, InterruptedException
- {
- for (int i = 0; i < 1000; i++)
- {
- if (from.renameTo(to))
- {
- return;
- }
-
- Thread.sleep(5);
- }
-
- throw new IOException("Could not rename '" + from.getAbsolutePath() + "' to '" + to.getAbsolutePath() + "'");
- }
-
- public static void delete(final File file) throws IOException, InterruptedException
- {
- new Job("Deleting old files")
- {
- @Override
- protected IStatus run(IProgressMonitor monitor)
- {
- try
- {
- doDelete(file, monitor);
- return Status.OK_STATUS;
- }
- catch (Exception ex)
- {
- Activator.log(ex);
- return Activator.getStatus(ex);
- }
- }
-
- private void doDelete(File file, IProgressMonitor monitor) throws IOException, InterruptedException
- {
- List<File> files = listAllFiles(file);
- if (files.isEmpty())
- {
- return;
- }
-
- monitor.beginTask("Deleting files in " + file.getAbsolutePath(), files.size());
-
- try
- {
- Collections.reverse(files);
- for (File child : files)
- {
- String childPath = child.getAbsolutePath();
- monitor.setTaskName("Deleting file " + childPath);
-
- doDelete(child);
-
- monitor.worked(1);
- if (monitor.isCanceled())
- {
- throw new OperationCanceledException();
- }
- }
- }
- finally
- {
- monitor.done();
- }
- }
-
- private void doDelete(File file) throws IOException, InterruptedException
- {
- for (int i = 0; i < 1000; i++)
- {
- if (file.delete())
- {
- return;
- }
-
- Thread.sleep(5);
- }
-
- throw new IOException("Could not delete '" + file.getAbsolutePath() + "'");
- }
-
- private List<File> listAllFiles(File file)
- {
- List<File> result = new ArrayList<File>();
- if (file != null && file.exists())
- {
- listAllFiles(file, result);
- }
-
- return result;
- }
-
- private void listAllFiles(File file, List<File> result)
- {
- result.add(file);
- if (file.isDirectory())
- {
- for (File child : file.listFiles())
- {
- listAllFiles(child, result);
- }
- }
- }
- }.schedule();
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/Director.java b/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/Director.java
index 81a2f05..7fbf725 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/Director.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/Director.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.releng.setup.InstallableUnit;
import org.eclipse.emf.cdo.releng.setup.P2Repository;
import org.eclipse.emf.cdo.releng.setup.SetupFactory;
import org.eclipse.emf.cdo.releng.setup.SetupPackage;
+import org.eclipse.emf.cdo.releng.setup.helper.Files;
import org.eclipse.emf.cdo.releng.setup.helper.Progress;
import org.eclipse.emf.cdo.releng.setup.helper.ProgressLog;
@@ -23,6 +24,7 @@ import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.internal.p2.director.app.DirectorApplication;
@@ -39,6 +41,8 @@ public final class Director
private String bundlePool;
+ private boolean resetProfile;
+
private Director(DirectorCall directorCall, String bundlePool)
{
this.directorCall = directorCall;
@@ -68,6 +72,12 @@ public final class Director
return iu(id + ".feature.group");
}
+ public Director resetProfile()
+ {
+ resetProfile = true;
+ return this;
+ }
+
public Director repository(String url)
{
P2Repository p2Repository = SetupFactory.eINSTANCE.createP2Repository();
@@ -76,7 +86,7 @@ public final class Director
return this;
}
- public void install(String destination)
+ public void install(String destination) throws Exception
{
File eclipseFolder = new File(destination);
eclipseFolder.mkdirs();
@@ -105,6 +115,11 @@ public final class Director
String arch = Platform.getOSArch();
String bundleAgent = new File(bundlePool, "p2").getAbsolutePath();
+ if (resetProfile)
+ {
+ Files.delete(new File(bundleAgent, "org.eclipse.equinox.p2.engine/profileRegistry/" + profileName + ".profile"),
+ new NullProgressMonitor());
+ }
String[] args = { "-destination", destination, "-repository", repositories, "-installIU", ius, "-profile",
profileName, "-profileProperties", "org.eclipse.update.install.features=true", "-bundlepool", bundlePool,
@@ -159,9 +174,15 @@ public final class Director
return new Director(bundlePool);
}
- public static void install(String bundlePool, DirectorCall directorCall, String destination)
+ public static void install(String bundlePool, DirectorCall directorCall, String destination, boolean resetProfile)
+ throws Exception
{
Director director = new Director(directorCall, bundlePool);
+ if (resetProfile)
+ {
+ director.resetProfile();
+ }
+
director.install(destination);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java b/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java
index 8a812a0..b1e7a51 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java
@@ -692,7 +692,7 @@ public class SetupDialog extends TitleAreaDialog
String bundlePool = new File(installFolder, ".p2pool-ide").getAbsolutePath();
- install(bundlePool, destination, updateLocations, setup.getEclipseVersion().getDirectorCall());
+ install(bundlePool, destination, updateLocations, setup.getEclipseVersion().getDirectorCall(), true);
Director.from(bundlePool) //
.feature("org.eclipse.egit") //
@@ -737,13 +737,14 @@ public class SetupDialog extends TitleAreaDialog
{
for (DirectorCall directorCall : installation.getDirectorCalls())
{
- install(bundlePool, destination, updateLocations, directorCall);
+ install(bundlePool, destination, updateLocations, directorCall, false);
}
}
- private void install(String bundlePool, String destination, Set<String> updateLocations, DirectorCall directorCall)
+ private void install(String bundlePool, String destination, Set<String> updateLocations, DirectorCall directorCall,
+ boolean resetProfile) throws Exception
{
- Director.install(bundlePool, directorCall, destination);
+ Director.install(bundlePool, directorCall, destination, resetProfile);
for (P2Repository p2Repository : directorCall.getP2Repositories())
{
updateLocations.add(p2Repository.getUrl());
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.releng.setup/META-INF/MANIFEST.MF
index 07a0248..b683de8 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/META-INF/MANIFEST.MF
@@ -15,3 +15,4 @@ Export-Package: org.eclipse.emf.cdo.releng.setup;version="1.0.0",
org.eclipse.emf.cdo.releng.setup.helper;x-friends:="org.eclipse.emf.cdo.releng.setup.ide,org.eclipse.emf.cdo.releng.setup.product,org.eclipse.emf.cdo.releng.setup.ui";version="1.0.0",
org.eclipse.emf.cdo.releng.setup.impl;version="1.0.0",
org.eclipse.emf.cdo.releng.setup.util;version="1.0.0"
+Bundle-Activator: org.eclipse.emf.cdo.releng.setup.helper.Activator
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/model/Configuration.xmi b/plugins/org.eclipse.emf.cdo.releng.setup/model/Configuration.xmi
index f77e345..8570d0c 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/model/Configuration.xmi
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/model/Configuration.xmi
@@ -1,21 +1,17 @@
<?xml version="1.0" encoding="ASCII"?>
<setup:Configuration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:setup="http://www.eclipse.org/CDO/releng/setup/1.0">
<projects name="EMF">
- <branches name="master" mspecFilePath="git-emf/releng/org.eclipse.emf.releng.buckminster/releng/emf-all.mspec">
+ <branches name="master" mspecFilePath="emf/releng/org.eclipse.emf.releng.setup.core/buckminster.mspec">
<directorCalls>
<installableUnits id="org.eclipse.emf.sdk.feature.group"/>
+ <installableUnits id="org.eclipse.xsd.sdk.feature.group"/>
+ <installableUnits id="org.eclipse.emf.cdo.releng.version.feature.group"/>
+ <installableUnits id="org.eclipse.emf.ecoretools.sdk.feature.group"/>
<p2Repositories url="http://download.eclipse.org/releases/kepler"/>
+ <p2Repositories url="http://download.eclipse.org/modeling/emf/cdo/updates/integration"/>
</directorCalls>
- <gitClones name="git-emf" remoteURI="ssh://git.eclipse.org:29418/emf/org.eclipse.emf" checkoutBranch="master"/>
- <gitClones name="git-xsd" remoteURI="ssh://git.eclipse.org/gitroot/xsd/org.eclipse.xsd.git" checkoutBranch="master"/>
- </branches>
- <branches name="2.9" mspecFilePath="git-emf/releng/org.eclipse.emf.releng.buckminster/releng/emf-all.mspec">
- <directorCalls>
- <installableUnits id="org.eclipse.emf.sdk.feature.group"/>
- <p2Repositories url="http://download.eclipse.org/releases/juno"/>
- </directorCalls>
- <gitClones name="git-emf" remoteURI="ssh://git.eclipse.org:29418/emf/org.eclipse.emf" checkoutBranch="R2_9_maintenance"/>
- <gitClones name="git-xsd" remoteURI="ssh://git.eclipse.org/gitroot/xsd/org.eclipse.xsd.git" checkoutBranch="R2_9_maintenance"/>
+ <gitClones name="emf" remoteURI="ssh://git.eclipse.org:29418/emf/org.eclipse.emf" checkoutBranch="master"/>
+ <gitClones name="xsd" remoteURI="ssh://git.eclipse.org/gitroot/xsd/org.eclipse.xsd.git" checkoutBranch="master"/>
</branches>
</projects>
<projects name="CDO">
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Activator.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Activator.java
new file mode 100644
index 0000000..49daa4e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Activator.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.setup.helper;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Eike Stepper
+ */
+public class Activator extends Plugin
+{
+ public static final String PLUGIN_ID = "org.eclipse.emf.cdo.releng.setup";
+
+ private static Activator plugin;
+
+ static BundleContext bundleContext;
+
+ public Activator()
+ {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ bundleContext = context;
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static void log(String message)
+ {
+ log(message, IStatus.INFO);
+ }
+
+ protected static void log(String message, int severity)
+ {
+ plugin.getLog().log(new Status(severity, PLUGIN_ID, message));
+ }
+
+ public static void log(IStatus status)
+ {
+ plugin.getLog().log(status);
+ }
+
+ public static String log(Throwable t)
+ {
+ IStatus status = getStatus(t);
+ log(status);
+ return status.getMessage();
+ }
+
+ public static IStatus getStatus(Throwable t)
+ {
+ if (t instanceof CoreException)
+ {
+ CoreException coreException = (CoreException)t;
+ return coreException.getStatus();
+ }
+
+ String msg = t.getLocalizedMessage();
+ if (msg == null || msg.length() == 0)
+ {
+ msg = t.getClass().getName();
+ }
+
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Files.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Files.java
new file mode 100644
index 0000000..0f0a57a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/helper/Files.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004-2013 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.setup.helper;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public final class Files
+{
+ public static void rename(File from, File to) throws IOException, InterruptedException
+ {
+ for (int i = 0; i < 1000; i++)
+ {
+ if (from.renameTo(to))
+ {
+ return;
+ }
+
+ Thread.sleep(5);
+ }
+
+ throw new IOException("Could not rename '" + from.getAbsolutePath() + "' to '" + to.getAbsolutePath() + "'");
+ }
+
+ public static void deleteAsync(final File file) throws IOException, InterruptedException
+ {
+ new Job("Deleting old files")
+ {
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ try
+ {
+ delete(file, monitor);
+ return Status.OK_STATUS;
+ }
+ catch (Exception ex)
+ {
+ Activator.log(ex);
+ return Activator.getStatus(ex);
+ }
+ }
+ }.schedule();
+ }
+
+ public static void delete(File file, IProgressMonitor monitor) throws IOException, InterruptedException
+ {
+ List<File> files = listAllFiles(file);
+ if (files.isEmpty())
+ {
+ return;
+ }
+
+ monitor.beginTask("Deleting files in " + file.getAbsolutePath(), files.size());
+
+ try
+ {
+ Collections.reverse(files);
+ for (File child : files)
+ {
+ String childPath = child.getAbsolutePath();
+ monitor.setTaskName("Deleting file " + childPath);
+
+ doDelete(child);
+
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ {
+ throw new OperationCanceledException();
+ }
+ }
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
+
+ private static void doDelete(File file) throws IOException, InterruptedException
+ {
+ for (int i = 0; i < 1000; i++)
+ {
+ if (file.delete())
+ {
+ return;
+ }
+
+ Thread.sleep(5);
+ }
+
+ throw new IOException("Could not delete '" + file.getAbsolutePath() + "'");
+ }
+
+ private static List<File> listAllFiles(File file)
+ {
+ List<File> result = new ArrayList<File>();
+ if (file != null && file.exists())
+ {
+ listAllFiles(file, result);
+ }
+
+ return result;
+ }
+
+ private static void listAllFiles(File file, List<File> result)
+ {
+ result.add(file);
+ if (file.isDirectory())
+ {
+ for (File child : file.listFiles())
+ {
+ listAllFiles(child, result);
+ }
+ }
+ }
+}