Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-11-07 13:38:11 -0500
committerDoug Schaefer2017-11-07 13:57:03 -0500
commitffdb004e6711ddffc0174341f97dfc44d8619246 (patch)
treefd7582d6153f1f9ff4c8732d0a3f5baaeb46dbf0 /toolchains
parentb495a5faae5749e0bc117717ac2f4f41aa211d89 (diff)
downloadorg.eclipse.cdt-ffdb004e6711ddffc0174341f97dfc44d8619246.tar.gz
org.eclipse.cdt-ffdb004e6711ddffc0174341f97dfc44d8619246.tar.xz
org.eclipse.cdt-ffdb004e6711ddffc0174341f97dfc44d8619246.zip
Adjust Arduino to new GCCToolChain API and add type and id/name.
Diffstat (limited to 'toolchains')
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml4
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Messages.java1
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java2
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfigurationProvider.java18
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChain.java33
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChainProvider.java7
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/messages.properties1
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile2
8 files changed, 44 insertions, 24 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml b/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
index c7abbdbe8e..545d5fcb72 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
@@ -99,5 +99,9 @@
class="org.eclipse.cdt.arduino.core.internal.build.ArduinoToolChainProvider"
id="org.eclipse.cdt.arduino.core.toolChainProvider">
</provider>
+ <type
+ id="org.eclipse.cdt.arduino"
+ name="Arduino">
+ </type>
</extension>
</plugin>
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Messages.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Messages.java
index c80f87c608..664bd40bc8 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Messages.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Messages.java
@@ -16,6 +16,7 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.arduino.core.internal.messages"; //$NON-NLS-1$
public static String ArduinoBoardManager_0;
public static String ArduinoBoardManager_1;
+ public static String ArduinoBuildConfigurationProvider_UnknownConnection;
public static String ArduinoLaunchConfigurationDelegate_0;
public static String ArduinoLaunchConfigurationDelegate_1;
public static String ArduinoLaunchConfigurationDelegate_2;
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java
index 5005862906..c460d19550 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java
@@ -201,7 +201,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
// Menus
HierarchicalProperties menus = board.getMenus();
- if (menus != null) {
+ if (menus != null && target != null) {
for (Entry<String, HierarchicalProperties> menuEntry : menus.getChildren().entrySet()) {
String key = menuEntry.getKey();
String value = target.getMenuValue(key);
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfigurationProvider.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfigurationProvider.java
index 94599855ca..fb14645188 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfigurationProvider.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfigurationProvider.java
@@ -10,6 +10,7 @@ package org.eclipse.cdt.arduino.core.internal.build;
import java.util.Collection;
import org.eclipse.cdt.arduino.core.internal.Activator;
+import org.eclipse.cdt.arduino.core.internal.Messages;
import org.eclipse.cdt.arduino.core.internal.board.ArduinoBoard;
import org.eclipse.cdt.arduino.core.internal.board.ArduinoManager;
import org.eclipse.cdt.arduino.core.internal.remote.ArduinoRemoteConnection;
@@ -52,7 +53,7 @@ public class ArduinoBuildConfigurationProvider implements ICBuildConfigurationPr
}
}
if (board != null) {
- IToolChain toolChain = createToolChain(config);
+ IToolChain toolChain = createToolChain("default"); //$NON-NLS-1$
return new ArduinoBuildConfiguration(config, name, "run", board, toolChain); //$NON-NLS-1$
}
} else {
@@ -60,12 +61,12 @@ public class ArduinoBuildConfigurationProvider implements ICBuildConfigurationPr
IRemoteConnectionType connectionType = remoteManager.getConnectionType(ArduinoRemoteConnection.TYPE_ID);
IRemoteConnection connection = connectionType.getConnection(name);
if (connection == null) {
- throw Activator.coreException(String.format("Unknown connection: %s", name), null);
+ throw Activator.coreException(String.format(Messages.ArduinoBuildConfigurationProvider_UnknownConnection, name), null);
}
ArduinoRemoteConnection target = connection.getService(ArduinoRemoteConnection.class);
if (target != null) {
- IToolChain toolChain = createToolChain(config);
+ IToolChain toolChain = createToolChain(connection.getName());
return new ArduinoBuildConfiguration(config, name, "run", target, toolChain); //$NON-NLS-1$
}
}
@@ -88,17 +89,22 @@ public class ArduinoBuildConfigurationProvider implements ICBuildConfigurationPr
// Make a new one
String configName = target.getRemoteConnection().getName();
IBuildConfiguration config = configManager.createBuildConfiguration(this, project, configName, monitor);
- IToolChain toolChain = createToolChain(config);
+ IToolChain toolChain = createToolChain(configName);
ArduinoBuildConfiguration arduinoConfig = new ArduinoBuildConfiguration(config, configName, "run", target, //$NON-NLS-1$
toolChain);
configManager.addBuildConfiguration(config, arduinoConfig);
return arduinoConfig;
}
- private IToolChain createToolChain(IBuildConfiguration config) throws CoreException {
+ private IToolChain createToolChain(String id) throws CoreException {
IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class);
+ IToolChain toolChain = toolChainManager.getToolChain(ArduinoToolChain.TYPE_ID, id);
+ if (toolChain != null) {
+ return toolChain;
+ }
+
IToolChainProvider provider = toolChainManager.getProvider(ArduinoToolChainProvider.ID);
- IToolChain toolChain = new ArduinoToolChain(provider, config);
+ toolChain = new ArduinoToolChain(provider, id);
toolChainManager.addToolChain(toolChain);
return toolChain;
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChain.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChain.java
index 44bb51d7a3..05bcfaad12 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChain.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChain.java
@@ -1,28 +1,43 @@
package org.eclipse.cdt.arduino.core.internal.build;
+import java.nio.file.Path;
+
import org.eclipse.cdt.build.gcc.core.GCCToolChain;
import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.build.IToolChainProvider;
-import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.runtime.CoreException;
public class ArduinoToolChain extends GCCToolChain {
- ArduinoToolChain(IToolChainProvider provider, IBuildConfiguration config) throws CoreException {
- super(provider, config.getProject().getName() + '#' + config.getName(), ""); //$NON-NLS-1$
+ public static final String TYPE_ID = "org.eclipse.cdt.arduino"; //$NON-NLS-1$
+ private final String id;
+
+ public ArduinoToolChain(IToolChainProvider provider, String id) {
+ super(provider, (Path) null, "arduino", null); //$NON-NLS-1$
+ this.id = id;
}
-
- public ArduinoToolChain(IToolChainProvider provider, String id, String version) {
- super(provider, id, version);
+
+ @Override
+ public String getTypeId() {
+ return TYPE_ID;
}
-
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public String getName() {
+ return id;
+ }
+
@Override
public String getProperty(String key) {
// TODO architecture if I need it
if (key.equals(IToolChain.ATTR_OS)) {
return "arduino"; //$NON-NLS-1$
} else {
- return null;
+ return super.getProperty(key);
}
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChainProvider.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChainProvider.java
index 63ce954228..a8d51bce60 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChainProvider.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoToolChainProvider.java
@@ -1,8 +1,6 @@
package org.eclipse.cdt.arduino.core.internal.build;
-import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.build.IToolChainProvider;
-import org.eclipse.core.runtime.CoreException;
public class ArduinoToolChainProvider implements IToolChainProvider {
@@ -13,9 +11,4 @@ public class ArduinoToolChainProvider implements IToolChainProvider {
return ID;
}
- @Override
- public IToolChain getToolChain(String id, String version) throws CoreException {
- return new ArduinoToolChain(this, id, version);
- }
-
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/messages.properties b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/messages.properties
index 758925d16a..1daa065ff1 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/messages.properties
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/messages.properties
@@ -7,6 +7,7 @@
################################################################################
ArduinoBoardManager_0=Fetching package index
ArduinoBoardManager_1=Package index missing from response
+ArduinoBuildConfigurationProvider_UnknownConnection=Unknown connection: %s
ArduinoLaunchConfigurationDelegate_1=No active Arduino remote connection.
ArduinoLaunchConfigurationDelegate_0=Arduino Launch
ArduinoLaunchConfigurationDelegate_2=Target has not been selected for Launch Configuration
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile b/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile
index fc81e8086e..ad8a231212 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/templates/Makefile
@@ -1,5 +1,5 @@
ifeq ($(OS),Windows_NT)
-SHELL = $(ComSpec)
+SHELL = cmd
RMDIR = rmdir /s /q
RM = del /q
mymkdir = if not exist "$1" mkdir "$1"

Back to the top