Remove Version number from zips

Change-Id: Ifc9ba2e47a61f2d545b7c4b40c327b661b4f48ba
This commit is contained in:
Patrick Plenefisch
2014-08-29 13:58:17 -04:00
committed by Thomas Clark
parent da2ea9ea87
commit 77dac9bd77
21 changed files with 61 additions and 322 deletions

View File

@@ -133,7 +133,7 @@ public class WPILibCore extends AbstractUIPlugin {
}
public String getDefaultVersion() {
return "2013-test-0.4";
return "0.2";
}
public String getCurrentVersion() {

View File

@@ -22,12 +22,12 @@ import edu.wpi.first.wpilib.plugins.core.WPILibCore;
public abstract class AbstractInstaller {
protected File installLocation;
protected String version;
protected String version, installedVersion;
public AbstractInstaller(String version) {
this.installLocation = new File(WPILibCore.getDefault().getWPILibBaseDir()
+ File.separator + getFeatureName() + File.separator + version);
public AbstractInstaller(String version, String installedVersion, String path) {
this.installLocation = new File(path);
this.version = version;
this.installedVersion = installedVersion;
}
/**
@@ -55,7 +55,7 @@ public abstract class AbstractInstaller {
WPILibCore.logInfo("Installing "+getFeatureName()+" if necessary");
if (!isInstalled()) {
WPILibCore.logInfo("Install necessary");
WPILibCore.logInfo("Install necessary for " + getFeatureName());
try {
install();
} catch (InstallException e) {
@@ -64,9 +64,9 @@ public abstract class AbstractInstaller {
getErrorMessage(e));
}
}
updateInstalledVersion(version);
WPILibCore.logInfo("Installed");
WPILibCore.logInfo("Installed" + getFeatureName());
return Status.OK_STATUS;
}
@@ -105,7 +105,7 @@ public abstract class AbstractInstaller {
* @return True for is there and newer, false otherwise.
*/
protected boolean isInstalled() {
return installLocation.exists();
return installLocation.exists() && !version.contains("DEVELOPMENT") && version.equals(installedVersion);
}
/**
@@ -138,7 +138,7 @@ public abstract class AbstractInstaller {
}
// Call 'unzip'
final String[] cmd = {"unzip", tmpFile.getAbsolutePath(), "-d", installLocation.getAbsolutePath()};
final String[] cmd = {"unzip" , "-o", tmpFile.getAbsolutePath(), "-d", installLocation.getAbsolutePath()};
WPILibCore.logInfo("unzip "+tmpFile.getAbsolutePath()+" -d "+installLocation.getAbsolutePath());
final Process unzipProcess = DebugPlugin.exec(cmd, installLocation);
try (final InputStream is = unzipProcess.getInputStream()) {

View File

@@ -1,8 +1,6 @@
package edu.wpi.first.wpilib.plugins.core.installer;
import java.io.InputStream;
import java.util.Properties;
import org.eclipse.jface.preference.IPreferenceStore;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
@@ -11,7 +9,7 @@ import edu.wpi.first.wpilib.plugins.core.preferences.PreferenceConstants;
public class ToolsInstaller extends AbstractInstaller {
public ToolsInstaller(String version) {
super(version);
super(version, WPILibCore.getDefault().getPreferenceStore().getString(PreferenceConstants.TOOLS_VERSION), WPILibCore.getDefault().getWPILibBaseDir() + "/tools");
}
@Override
@@ -22,13 +20,8 @@ public class ToolsInstaller extends AbstractInstaller {
@Override
protected void updateInstalledVersion(String version) {
IPreferenceStore prefs = WPILibCore.getDefault().getPreferenceStore();
if (prefs.getBoolean(PreferenceConstants.UPDATE_TOOLS_VERSION)) {
WPILibCore.logInfo("Forcing library version to "+version);
Properties props = WPILibCore.getDefault().getProjectProperties(null);
props.setProperty("version", version);
WPILibCore.getDefault().saveGlobalProperties(props);
prefs.setValue(PreferenceConstants.TOOLS_VERSION, version);
}
prefs.setValue(PreferenceConstants.TOOLS_VERSION, version);
}
@Override

View File

@@ -19,7 +19,8 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
IPreferenceStore store = WPILibCore.getDefault().getPreferenceStore();
store.setDefault(PreferenceConstants.TEAM_NUMBER,
WPILibCore.getDefault().getProjectProperties(null).getProperty("team-number", "0"));
store.setDefault(PreferenceConstants.TOOLS_VERSION, WPILibCore.getDefault().getDefaultVersion());
store.setDefault(PreferenceConstants.UPDATE_TOOLS_VERSION, true);
String val = store.getString(PreferenceConstants.TOOLS_VERSION);
if (!store.contains(PreferenceConstants.TOOLS_VERSION) && val != null)
store.setValue(PreferenceConstants.TOOLS_VERSION, "none");
}
}