Merge "Removed simluation eclipse plugin"

This commit is contained in:
Brad Miller (WPI)
2015-10-16 09:25:18 -07:00
committed by Gerrit Code Review
18 changed files with 0 additions and 539 deletions

View File

@@ -1 +0,0 @@
bin.includes = feature.xml

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="edu.wpi.first.wpilib.plugins.simulation.feature"
label="Feature"
version="1.0.0.qualifier">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<plugin
id="edu.wpi.first.wpilib.plugins.simulation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="edu.wpi.first.wpilib.plugins.simulation.feature"
label="Robot Simulation Development"
version="0.1.0.qualifier"
provider-name="Worcester Polytechnic Institute">
<description>
FRC Robot Simulation Program Development Environment.
</description>
<copyright>
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
</copyright>
<license>
* Copyright (c) 2015 FIRST and WPI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution. Neither the name of the FIRST nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS&apos;&apos;
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</license>
<includes
id="edu.wpi.first.wpilib.plugins.core.feature"
version="0.0.0"/>
<plugin
id="edu.wpi.first.wpilib.plugins.simulation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>edu.wpi.first.wpilib.plugins.simulation.feature</artifactId>
<packaging>eclipse-feature</packaging>
<parent>
<groupId>edu.wpi.first.wpilib.plugins</groupId>
<artifactId>edu.wpi.first.wpilib.plugins</artifactId>
<version>0.1.0.qualifier</version>
<relativePath>..</relativePath>
</parent>
</project>

View File

@@ -1,2 +0,0 @@
#ignore libraries. They will be copied from frc_gazebo_plugins/build/plugins
*.so

View File

@@ -1,13 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WPILib_Robot_Simulation
Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.simulation;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: edu.wpi.first.wpilib.plugins.simulation.WPILibSimulationPlugin
Require-Bundle: org.eclipse.core.runtime,
edu.wpi.first.wpilib.plugins.core;bundle-version="0.1.0",
org.eclipse.jface;bundle-version="3.10.2",
org.eclipse.ui;bundle-version="3.106.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Worcester Polytechnic Institute

View File

@@ -1,10 +0,0 @@
#Notes on the simulation eclipse plugin
Should download models when installed
build with the rest of the eclipse plugins using:
//if you're in the eclipse-plugins directory
mvn package
//otherwise in the base dir
./gradlew eclipsePlugins //no colons here!

View File

@@ -1,8 +0,0 @@
source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
plugin.xml,\
resources/
src.include = src/,\
resources/

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.startup">
<startup
class="edu.wpi.first.wpilib.plugins.simulation.WPILibSimulationPlugin">
</startup>
</extension>
</plugin>

View File

@@ -1,158 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>edu.wpi.first.wpilib.plugins.simulation</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>edu.wpi.first.wpilib.plugins</groupId>
<artifactId>edu.wpi.first.wpilib.plugins</artifactId>
<version>0.1.0.qualifier</version>
<relativePath>..</relativePath>
</parent>
<properties>
<build-number>DEVELOPMENT</build-number>
<simulation-zip>${project.build.directory}/simulation-zip</simulation-zip>
</properties>
<repositories>
<repository>
<id>WPILib Maven Repository</id>
<url>http://first.wpi.edu/FRC/roborio/maven/</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>resources/configuration.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-plugins-to-simulation-zip</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${simulation-zip}</outputDirectory>
<resources>
<resource>
<directory>../../build/simulation/frc_gazebo_plugins/</directory><!-- TODO do this with variables -->
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<!-- Set time stamp and version properties. -->
<execution>
<id>set-version-info</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<target>
<tstamp>
<format property="timestamp" pattern="yyyy/MM/dd HH:mm:ss z"/>
</tstamp>
<tstamp>
<format property="version-info" pattern="yyyy.MM.dd.HH.mm.ss"/>
</tstamp>
<property name="version" value="${version-info}.${build-number}"/>
</target>
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
<!-- Generate zip file to unzip for the user. -->
<execution>
<id>generate-simulation-zip</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<zip destfile="${project.build.directory}/classes/resources/simulation.zip"
basedir="${simulation-zip}"
update="true"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>[2.8,)</versionRange>
<goals>
<goal>copy</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Add fake dependencies to inform Maven of the correct
order it should build projects in during a multi-module build.
This list should match the list in the invocation of
maven-dependency-plugin:copy above.
It may be possible to avoid this duplication by using the
maven-assembly-plugin instead.-->
<!-- Library sources for debugging WPILib on the Athena -->
<dependency>
<groupId>edu.wpi.first.wpilib</groupId>
<artifactId>sfx</artifactId>
<type>zip</type>
<version>LATEST</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,2 +0,0 @@
timestamp=${timestamp}
version=${version}

View File

@@ -1,104 +0,0 @@
package edu.wpi.first.wpilib.plugins.simulation;
/**
* @author peter mitrano <pdmitrano@wpi.edu>
*/
import java.io.File;
import java.util.Properties;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.ant.AntPropertiesParser;
import edu.wpi.first.wpilib.plugins.simulation.installer.SimulationInstaller;
public class WPILibSimulationPlugin extends AbstractUIPlugin implements IStartup{
// The plug-in ID
public static final String PLUGIN_ID = "WPILib_Java_Robot_Development"; //$NON-NLS-1$
// The shared instance
private static WPILibSimulationPlugin plugin;
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
plugin = null;
super.stop(bundleContext);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static WPILibSimulationPlugin getDefault() {
return plugin;
}
public String getCurrentVersion() {
try {
Properties props = new AntPropertiesParser(
WPILibSimulationPlugin.class.getResourceAsStream("/resources/configuration.properties")).
getProperties();
if (props.getProperty("version").startsWith("$")) {
return "DEVELOPMENT";
} else {
return props.getProperty("version");
}
} catch (CoreException e) {
WPILibSimulationPlugin.logError("Error getting properties.", e);
return "DEVELOPMENT";
}
}
public String getSimulationDir() {
return WPILibCore.getDefault().getWPILibBaseDir()
+ File.separator + "simulation";
}
public String getPluginsDir() {
return getSimulationDir() + File.separator + "plugins";
}
public static void logInfo(String msg) {
getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null));
}
private static void logError(String msg, CoreException e) {
getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, msg, e));
}
public String getJavaPath() {
return WPILibCore.getDefault().getWPILibBaseDir()
+ File.separator + "java" + File.separator + "current";
}
@Override
public void earlyStartup() {
SimulationInstaller simulationInstaller = new SimulationInstaller(getCurrentVersion());
//downloads and copies the models from collabnet and unzips to
//wpilib/simulation/models and wpilib/simulation/worlds
simulationInstaller.installModels();
//extracts and copies the gazebo plugins from simulation.zip to wpilib/simulation/plugins
simulationInstaller.installPlugins();
}
}

View File

@@ -1,89 +0,0 @@
package edu.wpi.first.wpilib.plugins.simulation.installer;
/**
* @author peter mitrano <pdmitrano@wpi.edu>
*/
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.net.ssl.HttpsURLConnection;
import org.eclipse.jface.preference.IPreferenceStore;
import org.osgi.service.log.LogEntry;
import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller;
import edu.wpi.first.wpilib.plugins.simulation.WPILibSimulationPlugin;
import edu.wpi.first.wpilib.plugins.simulation.preferences.PreferenceConstants;
public class SimulationInstaller extends AbstractInstaller {
public SimulationInstaller(String version) {
// copy gazebo plugins wpilib/simulation/plugins
super(version, WPILibSimulationPlugin.getDefault().getPreferenceStore()
.getString(PreferenceConstants.LIBRARY_INSTALLED),
WPILibSimulationPlugin.getDefault().getPluginsDir());
}
public void installModels() {
// download models
// temporarily hardcoding link, but should be smarter
String inputFilePath = WPILibSimulationPlugin.getDefault()
.getSimulationDir() + File.separator + "models.zip";
File inputFile = new File(inputFilePath);
try {
if (inputFile.exists()) {
WPILibSimulationPlugin.logInfo("models doesn't need to be downloaded again");
} else {
URL url = new URL("https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1162?dl=1");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
try (InputStream stream = con.getInputStream()) {
WPILibSimulationPlugin.logInfo("downloading models zip");
Files.copy(stream, Paths.get(inputFilePath));
}
}
// unzip
WPILibSimulationPlugin.logInfo("unzipping to "+ WPILibSimulationPlugin.getDefault().getSimulationDir());
super.installIfNecessary(inputFilePath, WPILibSimulationPlugin.getDefault().getSimulationDir());
} catch (MalformedURLException mue) {
WPILibSimulationPlugin
.logInfo("Malformed URL Exception when downloading models");
WPILibSimulationPlugin.logInfo(mue.getLocalizedMessage());
} catch (IOException ioe) {
WPILibSimulationPlugin
.logInfo("IO Exception when downloading models");
WPILibSimulationPlugin.logInfo(ioe.getLocalizedMessage());
}
}
public void installPlugins() {
super.installIfNecessary();
}
@Override
protected String getFeatureName() {
return "simulation";
}
@Override
protected void updateInstalledVersion(String version) {
IPreferenceStore prefs = WPILibSimulationPlugin.getDefault()
.getPreferenceStore();
prefs.setValue(PreferenceConstants.LIBRARY_INSTALLED, version);
}
@Override
protected InputStream getInstallResourceStream() {
return SimulationInstaller.class
.getResourceAsStream("/resources/simulation.zip");
}
}

View File

@@ -1,10 +0,0 @@
package edu.wpi.first.wpilib.plugins.simulation.preferences;
/**
* @author peter mitrano <pdmitrano@wpi.edu>
*
* Constant definitions for plug-in preferences
*/
public class PreferenceConstants {
public static final String LIBRARY_INSTALLED = "libraryVersion_current";
}

View File

@@ -1,25 +0,0 @@
package edu.wpi.first.wpilib.plugins.simulation.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
/**
* @author peter mitrano <pdmitrano@wpi.edu>
*
* Class used to initialize default preference values.
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() {
IPreferenceStore store = WPILibCore.getDefault().getPreferenceStore();
if (!store.contains(PreferenceConstants.LIBRARY_INSTALLED))
store.setValue(PreferenceConstants.LIBRARY_INSTALLED, "none");
}
}

View File

@@ -6,9 +6,6 @@
<feature url="features/edu.wpi.first.wpilib.plugins.java.feature_0.1.0.qualifier.jar" id="edu.wpi.first.wpilib.plugins.java.feature" version="0.1.0.qualifier">
<category name="edu.wpi.first.wpilib.plugins"/>
</feature>
<feature url="features/edu.wpi.first.wpilib.plugins.simulation.feature_0.1.0.qualifier.jar" id="edu.wpi.first.wpilib.plugins.simulation.feature" version="0.1.0.qualifier">
<category name="edu.wpi.first.wpilib.plugins"/>
</feature>
<category-def name="edu.wpi.first.wpilib.plugins" label="WPILib Robot Development">
<description>
Core WPILib Robot Development Tools.

View File

@@ -11,8 +11,6 @@
<modules>
<module>edu.wpi.first.wpilib.plugins.core</module>
<module>edu.wpi.first.wpilib.plugins.core.feature</module>
<module>edu.wpi.first.wpilib.plugins.simulation</module>
<module>edu.wpi.first.wpilib.plugins.simulation.feature</module>
<module>edu.wpi.first.wpilib.plugins.cpp</module>
<module>edu.wpi.first.wpilib.plugins.cpp.feature</module>
<module>edu.wpi.first.wpilib.plugins.java</module>