Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2015-11-24 19:56:37 +0000
committerDoug Schaefer2015-11-25 03:11:33 +0000
commite3496e12466391b28cb2c1202bd68c0b23a00318 (patch)
treef2c17c34c0d5b6789db1cd8eb4edab4673f1fe54 /toolchains
parentef76cdac14d5f37c3fe3adde5dd3c04d31668857 (diff)
downloadorg.eclipse.cdt-e3496e12466391b28cb2c1202bd68c0b23a00318.tar.gz
org.eclipse.cdt-e3496e12466391b28cb2c1202bd68c0b23a00318.tar.xz
org.eclipse.cdt-e3496e12466391b28cb2c1202bd68c0b23a00318.zip
Bug 481978 - Big overhaul of new build system to work with Qt.
Moved new build system to it's own plug-ins. Cleaned up the root build configuration and toolchain classes and use them for Qt local run builds. Also hooks Qt local run launch delegate to launch target manager and associated delegate interface. Change-Id: I0c0f711ee53005edd399f6d24ba96658d606e1e5
Diffstat (limited to 'toolchains')
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/META-INF/MANIFEST.MF4
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml7
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoProjectGenerator.java12
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoScannerInfoProvider.java4
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java107
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuilder.java9
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoGCCToolChain.java64
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/launch/ArduinoLaunchConfigurationDelegate.java2
8 files changed, 65 insertions, 144 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/META-INF/MANIFEST.MF b/toolchains/arduino/org.eclipse.cdt.arduino.core/META-INF/MANIFEST.MF
index 454e80cf257..49a4ec7fab5 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/META-INF/MANIFEST.MF
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/META-INF/MANIFEST.MF
@@ -14,7 +14,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.native.serial;bundle-version="1.0.0",
org.eclipse.remote.serial.core;bundle-version="1.0.0",
com.google.gson;bundle-version="2.2.4",
- org.apache.commons.compress;bundle-version="1.6.0"
+ org.apache.commons.compress;bundle-version="1.6.0",
+ org.eclipse.cdt.build.core;bundle-version="1.0.0",
+ org.eclipse.cdt.build.gcc.core;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: libs/freemarker-2.3.22.jar,
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml b/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
index 198bb473d45..989488795e8 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
@@ -116,13 +116,6 @@
</factory>
</extension>
<extension
- point="org.eclipse.cdt.core.ToolChainFactory">
- <factory
- class="org.eclipse.cdt.arduino.core.internal.build.ArduinoGCCToolChain$ArduinoFactory"
- family="Arduino GCC">
- </factory>
- </extension>
- <extension
point="org.eclipse.launchbar.core.launchTargetTypes">
<launchTargetType
id="org.eclipse.cdt.arduino.core.connectionType"
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoProjectGenerator.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoProjectGenerator.java
index ccf734665c8..9b12dbb1de3 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoProjectGenerator.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoProjectGenerator.java
@@ -13,15 +13,11 @@ package org.eclipse.cdt.arduino.core.internal;
import java.util.HashMap;
import java.util.Map;
-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.build.ArduinoBuildConfiguration;
import org.eclipse.cdt.arduino.core.internal.build.ArduinoBuilder;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -57,16 +53,8 @@ public class ArduinoProjectGenerator {
command.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
projDesc.setBuildSpec(new ICommand[] { command });
- // Create the default config - uno
- projDesc.setBuildConfigs(new String[] { "uno" }); //$NON-NLS-1$
-
project.setDescription(projDesc, monitor);
- IBuildConfiguration config = project.getBuildConfig("uno"); //$NON-NLS-1$
- ArduinoBuildConfiguration arduinoConfig = config.getAdapter(ArduinoBuildConfiguration.class);
- ArduinoBoard board = ArduinoManager.instance.getBoard("Arduino Uno", "Arduino AVR Boards", "arduino"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- arduinoConfig.setBoard(board);
-
// Generate files
ArduinoTemplateGenerator templateGen = new ArduinoTemplateGenerator();
Map<String, Object> fmModel = new HashMap<>();
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoScannerInfoProvider.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoScannerInfoProvider.java
index 648a20c77d0..c5db121cbb8 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoScannerInfoProvider.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/ArduinoScannerInfoProvider.java
@@ -7,6 +7,8 @@
*******************************************************************************/
package org.eclipse.cdt.arduino.core.internal;
+import java.io.IOException;
+
import org.eclipse.cdt.arduino.core.internal.build.ArduinoBuildConfiguration;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
@@ -28,7 +30,7 @@ public class ArduinoScannerInfoProvider implements IScannerInfoProvider {
IBuildConfiguration config = project.getActiveBuildConfig();
ArduinoBuildConfiguration arduinoConfig = config.getAdapter(ArduinoBuildConfiguration.class);
return arduinoConfig.getScannerInfo(resource);
- } catch (CoreException e) {
+ } catch (IOException | CoreException e) {
Activator.log(e);
return null;
}
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 7a2a1eb861e..7f1dc360eb6 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
@@ -9,6 +9,7 @@ package org.eclipse.cdt.arduino.core.internal.build;
import java.io.File;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -31,10 +32,10 @@ import org.eclipse.cdt.arduino.core.internal.board.ArduinoPackage;
import org.eclipse.cdt.arduino.core.internal.board.ArduinoPlatform;
import org.eclipse.cdt.arduino.core.internal.board.ArduinoTool;
import org.eclipse.cdt.arduino.core.internal.board.ToolDependency;
+import org.eclipse.cdt.build.core.CBuildConfiguration;
+import org.eclipse.cdt.build.core.IToolChain;
+import org.eclipse.cdt.build.core.IToolChainManager;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.build.CBuildConfiguration;
-import org.eclipse.cdt.core.build.CToolChain;
-import org.eclipse.cdt.core.build.CToolChainManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IOutputEntry;
@@ -55,8 +56,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
public class ArduinoBuildConfiguration extends CBuildConfiguration {
@@ -138,7 +139,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration {
ArduinoPlatform platform = board.getPlatform();
ArduinoPackage pkg = platform.getPackage();
- IEclipsePreferences settings = getSettings();
+ Preferences settings = getSettings();
settings.put(PACKAGE_NAME, pkg.getName());
settings.put(PLATFORM_NAME, platform.getName());
settings.put(BOARD_NAME, board.getName());
@@ -151,7 +152,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration {
public ArduinoBoard getBoard() throws CoreException {
if (board == null) {
- IEclipsePreferences settings = getSettings();
+ Preferences settings = getSettings();
String packageName = settings.get(PACKAGE_NAME, ""); //$NON-NLS-1$
String platformName = settings.get(PLATFORM_NAME, ""); //$NON-NLS-1$
String boardName = settings.get(BOARD_NAME, ""); //$NON-NLS-1$
@@ -424,48 +425,39 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration {
String command = resolveProperty("tools." + toolName + ".upload.pattern", properties); //$NON-NLS-1$ //$NON-NLS-2$
if (isWindows) {
- return CToolChain.splitCommand(command);
+ return command.split(" "); //$NON-NLS-1$
} else {
return new String[] { "sh", "-c", command }; //$NON-NLS-1$ //$NON-NLS-2$
}
}
- @Override
- public CToolChain getToolChain() throws CoreException {
- CToolChain toolChain = super.getToolChain();
- if (toolChain == null) {
- // figure out which one it is
- ArduinoPlatform platform = board.getPlatform();
- String compilerPath = resolveProperty("compiler.path", platform.getPlatformProperties()); //$NON-NLS-1$
- if (compilerPath != null) {
- // TODO what if it is null?
- Path path = Paths.get(compilerPath);
- for (ToolDependency toolDep : platform.getToolsDependencies()) {
- ArduinoTool tool = toolDep.getTool();
- if (path.startsWith(tool.getInstallPath())) {
- // this is it, find the matching
- for (CToolChain tc : CToolChainManager.instance.getToolChains()) {
- if (tc instanceof ArduinoGCCToolChain) {
- if (((ArduinoGCCToolChain) tc).getTool().equals(tool)) {
- setToolChain(tc);
- toolChain = tc;
- break;
- }
- }
+ public IToolChain getToolChainx() {
+ try {
+ IToolChain toolChain = super.getToolChain();
+ if (toolChain == null) {
+ // figure out which one it is
+ IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class);
+ ArduinoPlatform platform = board.getPlatform();
+ String compilerPath = resolveProperty("compiler.path", platform.getPlatformProperties()); //$NON-NLS-1$
+ if (compilerPath != null) {
+ // TODO what if it is null?
+ Path path = Paths.get(compilerPath);
+ for (ToolDependency toolDep : platform.getToolsDependencies()) {
+ ArduinoTool tool = toolDep.getTool();
+ if (path.startsWith(tool.getInstallPath())) {
}
- // not found, create
- toolChain = new ArduinoGCCToolChain(tool);
- CToolChainManager.instance.addToolChain(toolChain);
- setToolChain(toolChain);
- break;
}
}
}
+ return toolChain;
+ } catch (CoreException e) {
+ Activator.log(e);
+ return null;
}
- return toolChain;
}
- public IScannerInfo getScannerInfo(IResource resource) throws CoreException {
+ @Override
+ public IScannerInfo getScannerInfo(IResource resource) throws IOException {
IScannerInfo info = super.getScannerInfo(resource);
if (info == null) {
// what language is this resource and pick the right recipe
@@ -479,29 +471,34 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration {
recipe = "recipe.c.o.pattern"; //$NON-NLS-1$
}
- ArduinoPlatform platform = getBoard().getPlatform();
- Properties properties = new Properties();
- properties.putAll(getProperties());
+ try {
+ ArduinoPlatform platform = getBoard().getPlatform();
+ Properties properties = new Properties();
+ properties.putAll(getProperties());
- Path resourcePath = new File(resource.getLocationURI()).toPath();
- Path sourcePath = getBuildDirectory().toPath().relativize(resourcePath);
- properties.put("source_file", pathString(sourcePath)); //$NON-NLS-1$
- properties.put("object_file", "-"); //$NON-NLS-1$ //$NON-NLS-2$
+ Path resourcePath = new File(resource.getLocationURI()).toPath();
+ Path sourcePath = getBuildDirectory().toPath().relativize(resourcePath);
+ properties.put("source_file", pathString(sourcePath)); //$NON-NLS-1$
+ properties.put("object_file", "-"); //$NON-NLS-1$ //$NON-NLS-2$
- String includes = ""; //$NON-NLS-1$
- for (Path include : platform.getIncludePath()) {
- includes += " -I\"" + pathString(include) + '"'; //$NON-NLS-1$
- }
- Collection<ArduinoLibrary> libs = ArduinoManager.instance.getLibraries(getProject());
- for (ArduinoLibrary lib : libs) {
- for (Path path : lib.getIncludePath()) {
- includes += " -I\"" + pathString(path) + '"'; //$NON-NLS-1$
+ String includes = ""; //$NON-NLS-1$
+ for (Path include : platform.getIncludePath()) {
+ includes += " -I\"" + pathString(include) + '"'; //$NON-NLS-1$
}
- }
- properties.put("includes", includes); //$NON-NLS-1$
+ Collection<ArduinoLibrary> libs = ArduinoManager.instance.getLibraries(getProject());
+ for (ArduinoLibrary lib : libs) {
+ for (Path path : lib.getIncludePath()) {
+ includes += " -I\"" + pathString(path) + '"'; //$NON-NLS-1$
+ }
+ }
+ properties.put("includes", includes); //$NON-NLS-1$
- List<String> cmd = Arrays.asList(resolveProperty(recipe, properties).split(" ")); //$NON-NLS-1$
- info = getToolChain().getScannerInfo(getBuildFolder(), cmd);
+ List<String> cmd = Arrays.asList(resolveProperty(recipe, properties).split(" ")); //$NON-NLS-1$
+ // TODO for reals
+ info = getToolChain().getScannerInfo(cmd.get(0), cmd.subList(1, cmd.size()), null, resource, null);
+ } catch (CoreException e) {
+ throw new IOException(e);
+ }
}
return info;
}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuilder.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuilder.java
index 0275c0c4a26..a3a907ed17c 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuilder.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuilder.java
@@ -15,7 +15,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.arduino.core.internal.Activator;
-import org.eclipse.cdt.core.build.IConsoleService;
+import org.eclipse.cdt.build.core.CConsoleParser;
+import org.eclipse.cdt.build.core.IConsoleService;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -50,7 +51,8 @@ public class ArduinoBuilder extends IncrementalProjectBuilder {
config.setEnvironment(processBuilder.environment());
Process process = processBuilder.start();
- consoleService.monitor(process, config.getConsoleParsers(), config.getBuildFolder());
+ consoleService.monitor(process, config.getConsoleParsers().toArray(new CConsoleParser[0]),
+ config.getBuildDirectory().toPath());
if (process.exitValue() == 0) {
showSizes(config, consoleService);
@@ -82,7 +84,8 @@ public class ArduinoBuilder extends IncrementalProjectBuilder {
config.setEnvironment(processBuilder.environment());
Process process = processBuilder.start();
- consoleService.monitor(process, config.getConsoleParsers(), config.getBuildFolder());
+ consoleService.monitor(process, config.getConsoleParsers().toArray(new CConsoleParser[0]),
+ config.getBuildDirectory().toPath());
config.getBuildFolder().refreshLocal(IResource.DEPTH_INFINITE, monitor);
consoleService.writeOutput("\n"); //$NON-NLS-1$
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoGCCToolChain.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoGCCToolChain.java
deleted file mode 100644
index 7670e100830..00000000000
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoGCCToolChain.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 QNX Software Systems 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
- *******************************************************************************/
-package org.eclipse.cdt.arduino.core.internal.build;
-
-import org.eclipse.cdt.arduino.core.internal.board.ArduinoManager;
-import org.eclipse.cdt.arduino.core.internal.board.ArduinoPackage;
-import org.eclipse.cdt.arduino.core.internal.board.ArduinoTool;
-import org.eclipse.cdt.core.build.CToolChain;
-import org.eclipse.cdt.core.build.IToolChainFactory;
-import org.eclipse.cdt.core.build.gcc.GCCToolChain;
-import org.osgi.service.prefs.Preferences;
-
-public class ArduinoGCCToolChain extends GCCToolChain {
-
- private static final String PACKAGE = "arduinoPackage"; //$NON-NLS-1$
- private static final String TOOL = "arduinoTool"; //$NON-NLS-1$
-
- private final ArduinoTool tool;
-
- public ArduinoGCCToolChain(String id, Preferences settings) {
- super(id, settings);
- ArduinoPackage pkg = ArduinoManager.instance.getPackage(settings.get(PACKAGE, "")); //$NON-NLS-1$
- if (pkg != null) {
- this.tool = pkg.getLatestTool(settings.get(TOOL, "")); //$NON-NLS-1$
- } else {
- // TODO where did it go?
- this.tool = null;
- }
- }
-
- public ArduinoGCCToolChain(ArduinoTool tool) {
- super(tool.getName());
- this.tool = tool;
- }
-
- public static class ArduinoFactory implements IToolChainFactory {
- @Override
- public CToolChain createToolChain(String id, Preferences settings) {
- return new ArduinoGCCToolChain(id, settings);
- }
- }
-
- @Override
- public String getFamily() {
- return "Arduino GCC"; //$NON-NLS-1$
- }
-
- public ArduinoTool getTool() {
- return tool;
- }
-
- @Override
- public void save(Preferences settings) {
- super.save(settings);
- settings.put(TOOL, tool.getName());
- settings.put(PACKAGE, tool.getPackage().getName());
- }
-
-}
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/launch/ArduinoLaunchConfigurationDelegate.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/launch/ArduinoLaunchConfigurationDelegate.java
index e6dc733cd0b..10df23e55ad 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/launch/ArduinoLaunchConfigurationDelegate.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/launch/ArduinoLaunchConfigurationDelegate.java
@@ -17,7 +17,7 @@ import org.eclipse.cdt.arduino.core.internal.Messages;
import org.eclipse.cdt.arduino.core.internal.board.ArduinoBoard;
import org.eclipse.cdt.arduino.core.internal.build.ArduinoBuildConfiguration;
import org.eclipse.cdt.arduino.core.internal.remote.ArduinoRemoteConnection;
-import org.eclipse.cdt.core.build.IConsoleService;
+import org.eclipse.cdt.build.core.IConsoleService;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

Back to the top