Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-09-27 23:35:36 -0400
committerGerrit Code Review @ Eclipse.org2016-10-12 19:19:19 -0400
commite371ba0919f68b50543500521c4d0d111e0e2650 (patch)
tree7b48265fc5504f1c7d02cbc616f71a0ce571e9d7
parent23f68c6c3518f558d0c484b96df54ad5e85ffb23 (diff)
downloadorg.eclipse.cdt-e371ba0919f68b50543500521c4d0d111e0e2650.tar.gz
org.eclipse.cdt-e371ba0919f68b50543500521c4d0d111e0e2650.tar.xz
org.eclipse.cdt-e371ba0919f68b50543500521c4d0d111e0e2650.zip
Updates for Core Build.
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java77
-rw-r--r--build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF4
-rw-r--r--build/org.eclipse.cdt.cmake.ui/plugin.xml8
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java167
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java26
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java88
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java136
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java1
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.xml3
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java5
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml8
-rw-r--r--launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF2
-rw-r--r--launch/org.eclipse.cdt.launch/plugin.xml9
-rw-r--r--launch/org.eclipse.cdt.launch/pom.xml2
-rw-r--r--launch/org.eclipse.cdt.launch/schema/coreBuildTab.exsd117
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/LocalLaunchConfigurationTabGroup.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LocalLaunchConfigurationTabGroup.java)13
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildMainTab.java79
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildTab.java141
-rw-r--r--qt/org.eclipse.cdt.qt.core/plugin.xml45
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java6
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java42
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptor.java50
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptorType.java41
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalLaunchConfigationProvider.java36
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalRunLaunchConfigDelegate.java66
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java23
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java4
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtLaunchConfigurationProvider.java98
-rw-r--r--qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp2
-rw-r--r--qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro2
-rw-r--r--qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc2
-rw-r--r--qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml5
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml3
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java54
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java2
36 files changed, 943 insertions, 426 deletions
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index 1b684999da..c7ea5cdaca 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -14,7 +14,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -32,7 +31,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -40,6 +38,11 @@ import com.google.gson.Gson;
public class CMakeBuildConfiguration extends CBuildConfiguration {
+ public static final String CMAKE_GENERATOR = "cmake.generator"; //$NON-NLS-1$
+ public static final String CMAKE_ARGUMENTS = "cmake.arguments"; //$NON-NLS-1$
+ public static final String BUILD_COMMAND = "cmake.command.build"; //$NON-NLS-1$
+ public static final String CLEAN_COMMAND = "cmake.command.clean"; //$NON-NLS-1$
+
private static final String TOOLCHAIN_FILE = "cdt.cmake.toolchainfile"; //$NON-NLS-1$
private ICMakeToolChainFile toolChainFile;
@@ -85,6 +88,12 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
throws CoreException {
IProject project = getProject();
try {
+ Map<String, String> properties = getProperties();
+ String generator = properties.get(CMAKE_GENERATOR);
+ if (generator == null) {
+ generator = "Unix Makefiles"; //$NON-NLS-1$
+ }
+
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
ConsoleOutputStream outStream = console.getOutputStream();
@@ -93,24 +102,19 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
outStream.write(String.format("Building in: %s\n", buildDir.toString()));
- if (!Files.exists(buildDir.resolve("Makefile"))) { //$NON-NLS-1$
+ if (!Files.exists(buildDir.resolve("CMakeFiles"))) { //$NON-NLS-1$
List<String> command = new ArrayList<>();
- // TODO assuming cmake is in the path here, probably need a
- // preference in case it isn't.
- Path cmakePath = CBuildConfiguration.getCommandFromPath(Paths.get("cmake")); //$NON-NLS-1$
- if (cmakePath == null) {
- if (!Platform.getOS().equals(Platform.OS_WIN32)) {
- cmakePath = Paths.get("/usr/local/bin/cmake"); //$NON-NLS-1$
- } else {
- cmakePath = Paths.get("cmake"); //$NON-NLS-1$
- }
+ // TODO location of CMake out of preferences if not found here
+ Path cmakePath = findCommand("cmake"); //$NON-NLS-1$
+ if (cmakePath != null) {
+ command.add(cmakePath.toString());
+ } else {
+ command.add("cmake"); //$NON-NLS-1$
}
- command.add(cmakePath.toString());
command.add("-G"); //$NON-NLS-1$
- // TODO ninja?
- command.add("Unix Makefiles"); //$NON-NLS-1$
+ command.add(generator);
if (toolChainFile != null) {
command.add("-DCMAKE_TOOLCHAIN_FILE=" + toolChainFile.getPath().toString()); //$NON-NLS-1$
@@ -128,9 +132,21 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
getToolChain().getErrorParserIds())) {
- // TODO need to figure out which builder to call. Hardcoding to
- // make for now.
- List<String> command = Arrays.asList("make"); //$NON-NLS-1$
+ String buildCommand = properties.get(BUILD_COMMAND);
+ if (buildCommand == null) {
+ if (generator.equals("Ninja")) { //$NON-NLS-1$
+ buildCommand = "ninja"; //$NON-NLS-1$
+ } else {
+ buildCommand = "make"; //$NON-NLS-1$
+ }
+ }
+ String[] command = buildCommand.split(" "); //$NON-NLS-1$
+
+ Path cmdPath = findCommand(command[0]);
+ if (cmdPath != null) {
+ command[0] = cmdPath.toString();
+ }
+
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
setBuildEnvironment(processBuilder.environment());
Process process = processBuilder.start();
@@ -153,20 +169,35 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
try {
+ Map<String, String> properties = getProperties();
+ String generator = properties.get(CMAKE_GENERATOR);
+
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
ConsoleOutputStream outStream = console.getOutputStream();
Path buildDir = getBuildDirectory();
- if (!Files.exists(buildDir.resolve("Makefile"))) { //$NON-NLS-1$
- outStream.write("Makefile not found. Assuming clean.");
+ if (!Files.exists(buildDir.resolve("CMakeFiles"))) { //$NON-NLS-1$
+ outStream.write("CMakeFiles not found. Assuming clean.");
return;
}
- // TODO need to figure out which builder to call. Hardcoding to make
- // for now.
- List<String> command = Arrays.asList("make", "clean"); //$NON-NLS-1$
+ String cleanCommand = properties.get(CLEAN_COMMAND);
+ if (cleanCommand == null) {
+ if (generator.equals("Ninja")) { //$NON-NLS-1$
+ cleanCommand = "ninja clean"; //$NON-NLS-1$
+ } else {
+ cleanCommand = "make clean"; //$NON-NLS-1$
+ }
+ }
+ String[] command = cleanCommand.split(" "); //$NON-NLS-1$
+
+ Path cmdPath = findCommand(command[0]);
+ if (cmdPath != null) {
+ command[0] = cmdPath.toString();
+ }
+
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
Process process = processBuilder.start();
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
index 20ba12ee10..1b5caf16d0 100644
--- a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
@@ -11,7 +11,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.ide,
org.eclipse.cdt.cmake.core,
org.eclipse.tools.templates.ui;bundle-version="1.1.0",
- org.eclipse.cdt.core;bundle-version="6.1.0"
+ org.eclipse.cdt.core;bundle-version="6.1.0",
+ org.eclipse.debug.ui;bundle-version="3.11.200",
+ org.eclipse.cdt.launch;bundle-version="9.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.cmake.ui/plugin.xml b/build/org.eclipse.cdt.cmake.ui/plugin.xml
index 09a01d710f..b0483065a3 100644
--- a/build/org.eclipse.cdt.cmake.ui/plugin.xml
+++ b/build/org.eclipse.cdt.cmake.ui/plugin.xml
@@ -51,5 +51,13 @@
</tagReference>
</template>
</extension>
+ <extension
+ point="org.eclipse.cdt.launch.coreBuildTab">
+ <provider
+ nature="org.eclipse.cdt.cmake.core.cmakeNature"
+ priority="10"
+ tabClass="org.eclipse.cdt.cmake.ui.internal.CMakeBuildTab">
+ </provider>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
new file mode 100644
index 0000000000..200550cb61
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
@@ -0,0 +1,167 @@
+package org.eclipse.cdt.cmake.ui.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
+
+ private Button unixGenButton;
+ private Button ninjaGenButton;
+ private Text cmakeArgsText;
+ private Text buildCommandText;
+ private Text cleanCommandText;
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout());
+ setControl(comp);
+
+ Label label = new Label(comp, SWT.NONE);
+ label.setText("Generator");
+
+ Composite genComp = new Composite(comp, SWT.BORDER);
+ genComp.setLayout(new GridLayout(2, true));
+
+ unixGenButton = new Button(genComp, SWT.RADIO);
+ unixGenButton.setText("Unix Makefiles");
+ unixGenButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ ninjaGenButton = new Button(genComp, SWT.RADIO);
+ ninjaGenButton.setText("Ninja");
+ ninjaGenButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ label = new Label(comp, SWT.NONE);
+ label.setText("Additional CMake arguments:");
+
+ cmakeArgsText = new Text(comp, SWT.BORDER);
+ cmakeArgsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ cmakeArgsText.addModifyListener(e -> updateLaunchConfigurationDialog());
+
+ label = new Label(comp, SWT.NONE);
+ label.setText("Build command");
+
+ buildCommandText = new Text(comp, SWT.BORDER);
+ buildCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ buildCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
+
+ label = new Label(comp, SWT.NONE);
+ label.setText("Clean command");
+
+ cleanCommandText = new Text(comp, SWT.BORDER);
+ cleanCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ cleanCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ String mode = getLaunchConfigurationDialog().getMode();
+ configuration.removeAttribute("COREBUILD_" + mode); //$NON-NLS-1$
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ try {
+ String mode = getLaunchConfigurationDialog().getMode();
+ // TODO find a home for the attribute name
+ Map<String, String> properties = configuration.getAttribute("COREBUILD_" + mode, //$NON-NLS-1$
+ new HashMap<>());
+
+ String generator = properties.get(CMakeBuildConfiguration.CMAKE_GENERATOR);
+ updateGeneratorButtons(generator);
+
+ String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
+ if (cmakeArgs != null) {
+ cmakeArgsText.setText(cmakeArgs);
+ } else {
+ cmakeArgsText.setText(""); //$NON-NLS-1$
+ }
+
+ String buildCommand = properties.get(CMakeBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null) {
+ buildCommandText.setText(buildCommand);
+ } else {
+ buildCommandText.setText(""); //$NON-NLS-1$
+ }
+
+ String cleanCommand = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null) {
+ cleanCommandText.setText(buildCommand);
+ } else {
+ cleanCommandText.setText(""); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+
+ private void updateGeneratorButtons(String generator) {
+ if (generator != null && generator.equals("Ninja")) { //$NON-NLS-1$
+ ninjaGenButton.setSelection(true);
+ } else {
+ unixGenButton.setSelection(true);
+ }
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ Map<String, String> properties = new HashMap<>();
+
+ if (ninjaGenButton.getSelection()) {
+ properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR, "Ninja"); //$NON-NLS-1$
+ }
+
+ String cmakeArgs = cmakeArgsText.getText().trim();
+ if (!cmakeArgs.isEmpty()) {
+ properties.put(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgs);
+ }
+
+ String buildCommand = buildCommandText.getText().trim();
+ if (!buildCommand.isEmpty()) {
+ properties.put(CMakeBuildConfiguration.BUILD_COMMAND, buildCommand);
+ }
+
+ String cleanCommand = cleanCommandText.getText().trim();
+ if (!cleanCommand.isEmpty()) {
+ properties.put(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ }
+
+ String mode = getLaunchConfigurationDialog().getMode();
+ if (!properties.isEmpty()) {
+ configuration.setAttribute("COREBUILD_" + mode, properties); //$NON-NLS-1$
+ } else {
+ configuration.removeAttribute("COREBUILD_" + mode); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "CMake";
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index 360aa7c913..53adab3ce6 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -102,6 +102,8 @@ public abstract class CBuildConfiguration extends PlatformObject
private final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
private ScannerInfoCache scannerInfoCache;
+ private Map<String, String> properties;
+
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
this.config = config;
this.name = name;
@@ -169,13 +171,15 @@ public abstract class CBuildConfiguration extends PlatformObject
// TODO should really be passing a monitor in here or create this in
// a better spot. should also throw the core exception
// TODO make the name of this folder a project property
- IFolder buildRootFolder = getProject().getFolder("build"); //$NON-NLS-1$
+ IProgressMonitor monitor = new NullProgressMonitor();
+ IProject project = getProject();
+ IFolder buildRootFolder = project.getFolder("build"); //$NON-NLS-1$
if (!buildRootFolder.exists()) {
- buildRootFolder.create(IResource.FORCE | IResource.DERIVED, true, new NullProgressMonitor());
+ buildRootFolder.create(IResource.FORCE | IResource.DERIVED, true, monitor);
}
IFolder buildFolder = buildRootFolder.getFolder(name);
if (!buildFolder.exists()) {
- buildFolder.create(IResource.FORCE | IResource.DERIVED, true, new NullProgressMonitor());
+ buildFolder.create(IResource.FORCE | IResource.DERIVED, true, monitor);
}
return buildFolder;
@@ -662,4 +666,20 @@ public abstract class CBuildConfiguration extends PlatformObject
return null;
}
+ /**
+ * @since 6.2
+ */
+ @Override
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * @since 6.2
+ */
+ @Override
+ public Map<String, String> getProperties() {
+ return properties != null ? properties : new HashMap<>();
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
index dc622120fe..a48143fac1 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
@@ -7,6 +7,7 @@
*******************************************************************************/
package org.eclipse.cdt.core.build;
+import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
@@ -50,18 +51,65 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
*/
IToolChain getToolChain() throws CoreException;
+ /**
+ * Ids for the Binary Parsers to use when checking whether a file is a
+ * binary that can be launched.
+ *
+ * @return binary parser ids
+ * @throws CoreException
+ */
String getBinaryParserId() throws CoreException;
+ /**
+ * Return a build environment variable with a given name.
+ *
+ * @param name
+ * build environment variable name
+ * @return value of the build environment variable.
+ * @throws CoreException
+ */
IEnvironmentVariable getVariable(String name) throws CoreException;
+ /**
+ * Return all of the build environment variables for this configuration.
+ *
+ * @return
+ * @throws CoreException
+ */
IEnvironmentVariable[] getVariables() throws CoreException;
+ /**
+ * Perform the build.
+ *
+ * @param kind
+ * build type
+ * @param args
+ * build arguments
+ * @param console
+ * console to show build output
+ * @param monitor
+ * progress monitor
+ * @return the list of projects for which this builder would like deltas the
+ * next time it is run or <code>null</code> if none
+ * @throws CoreException
+ */
IProject[] build(int kind, Map<String, String> args, IConsole console, IProgressMonitor monitor) throws CoreException;
+ /**
+ * Perform clean.
+ *
+ * @param console
+ * console to show clean output
+ * @param monitor
+ * progress monitor
+ * @throws CoreException
+ */
void clean(IConsole console, IProgressMonitor monitor) throws CoreException;
/**
- * @return build output IContainer
+ * The binaries produced by the build.
+ *
+ * @return binaries produced by the build.
* @throws CoreException
* @since 6.1
*/
@@ -70,10 +118,48 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
}
/**
+ * Set the environment for the builds. Generally the environment from a
+ * ProcessBuilder would be passed here.
*
* @param env
+ * build environment
* @since 6.1
*/
default void setBuildEnvironment(Map<String, String> env) {
}
+
+ /**
+ * Set the properties for this build configuration. These will often come
+ * from launch configurations which have build settings as attributes.
+ *
+ * @param properties
+ * build properties
+ * @since 6.2
+ */
+ default void setProperties(Map<String, String> properties) {
+ }
+
+ /**
+ * Return the properties for this build configuration.
+ *
+ * @return default properties
+ * @since 6.2
+ */
+ default Map<String, String> getProperties() {
+ return new HashMap<>();
+ }
+
+ /**
+ * Returns whether this build configuration supports the given build
+ * properties.
+ *
+ * @param properties
+ * build properties
+ * @return whether this build configuration supports those properties
+ * @since 6.2
+ */
+ default boolean supportsProperties(Map<String, String> properties) {
+ return false;
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
new file mode 100644
index 0000000000..ceeb95c499
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.core.build;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Map;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ConsoleOutputStream;
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IConsoleParser;
+import org.eclipse.cdt.core.model.ICModelMarker;
+import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A Standard Build Configuration that simply calls a specified command for
+ * build and clean. By default, it calls 'make all' and 'make clean'.
+ *
+ * @since 6.2
+ */
+public class StandardBuildConfiguration extends CBuildConfiguration {
+
+ private String[] buildCommand = { "make", "all" }; //$NON-NLS-1$ //$NON-NLS-2$
+ private String[] cleanCommand = { "make", "clean" }; //$NON-NLS-1$ //$NON-NLS-2$
+ private IContainer buildContainer;
+
+ public StandardBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
+ super(config, name);
+ }
+
+ public StandardBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain,
+ String launchMode) {
+ super(config, name, toolChain);
+ }
+
+ public void setBuildContainer(IContainer buildContainer) {
+ this.buildContainer = buildContainer;
+ }
+
+ public void setBuildCommand(String[] buildCommand) {
+ this.buildCommand = buildCommand;
+ }
+
+ public void setCleanCommand(String[] cleanCommand) {
+ this.cleanCommand = cleanCommand;
+ }
+
+ @Override
+ public IContainer getBuildContainer() throws CoreException {
+ // If a container isn't set, assume build bits can go anywhere in the
+ // project
+ return buildContainer != null ? buildContainer : getProject();
+ }
+
+ @Override
+ public IProject[] build(int kind, Map<String, String> args, IConsole console, IProgressMonitor monitor)
+ throws CoreException {
+ IProject project = getProject();
+ try {
+ project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
+
+ ConsoleOutputStream outStream = console.getOutputStream();
+
+ Path buildDir = getBuildDirectory();
+
+ outStream.write(String.format("Building in: %s\n", buildDir.toString()));
+
+ String[] command = new String[buildCommand.length];
+ Path make = findCommand(buildCommand[0]);
+ command[0] = make.toString();
+ System.arraycopy(buildCommand, 1, command, 1, buildCommand.length - 1);
+
+ try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
+ getToolChain().getErrorParserIds())) {
+ // run make
+ console.getOutputStream().write(String.format("%s\n", String.join(" ", command))); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessBuilder processBuilder = new ProcessBuilder(command)
+ .directory(getBuildDirectory().toFile());
+ setBuildEnvironment(processBuilder.environment());
+ Process process = processBuilder.start();
+ IConsoleParser[] consoleParsers = new IConsoleParser[] { epm, this };
+ watchProcess(process, consoleParsers, console);
+ }
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ return new IProject[] { project };
+ } catch (IOException e) {
+ throw new CoreException(
+ new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Building " + project.getName(), e)); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
+ IProject project = getProject();
+ try {
+ project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
+
+ ConsoleOutputStream outStream = console.getOutputStream();
+
+ String[] command = new String[cleanCommand.length];
+ Path make = findCommand(cleanCommand[0]);
+ command[0] = make.toString();
+ System.arraycopy(cleanCommand, 1, command, 1, cleanCommand.length - 1);
+
+ // run make
+ outStream.write(String.format("%s\n", String.join(" ", command))); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessBuilder processBuilder = new ProcessBuilder(command)
+ .directory(getBuildDirectory().toFile());
+ setBuildEnvironment(processBuilder.environment());
+ Process process = processBuilder.start();
+ watchProcess(process, new IConsoleParser[0], console);
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (IOException e) {
+ throw new CoreException(
+ new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Building " + project.getName(), e)); //$NON-NLS-1$
+ }
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java
index 1e74e5c610..17c23314c6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/project/NewCDTProjectWizard.java
@@ -15,6 +15,7 @@ public class NewCDTProjectWizard extends NewWizard {
public NewCDTProjectWizard() {
super(cdtTag);
+ setWindowTitle("New C/C++ Project");
setTemplateSelectionPageTitle("Templates for New C/C++ Project");
}
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.properties b/debug/org.eclipse.cdt.debug.core/plugin.properties
index 13fc4ebc6e..6c5079cacb 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.core/plugin.properties
@@ -24,7 +24,7 @@ AttachLaunch.name=C/C++ Attach to Application
PostMortemLaunch.name=C/C++ Postmortem Debugger
RemoteApplicationLaunch.name=C/C++ Remote Application
-localApplicationLaunch.name=C/C++ Local Application (auto)
+localApplicationLaunch.name=Auto C/C++ Local Application
CDebugger.name=C/C++ Development Tools Core Debugger Extension
BreakpointAction.name=Breakpoint Action Extension
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml
index 65b5feba7f..51fa9e3f41 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.core/plugin.xml
@@ -467,7 +467,8 @@
delegate="org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalRunLaunchDelegate"
id="org.eclipse.cdt.debug.core.localLaunchConfigurationType"
modes="run"
- name="%localApplicationLaunch.name">
+ name="%localApplicationLaunch.name"
+ public="false">
</launchConfigurationType>
</extension>
<extension
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
index e26692aa13..51d53494c2 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
@@ -64,6 +64,11 @@ public class CoreBuildLocalRunLaunchDelegate extends LaunchConfigurationTargeted
IProjectDescription desc = project.getDescription();
desc.setActiveBuildConfig(config.getBuildConfiguration().getName());
project.setDescription(desc, monitor);
+
+ Map<String, String> buildProps = configuration.getAttribute("COREBUILD_" + mode, new HashMap<>()); //$NON-NLS-1$
+ if (!buildProps.isEmpty()) {
+ config.setProperties(buildProps);
+ }
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 3da4f2088e..f01dee13ba 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -2575,13 +2575,5 @@
id="org.eclipse.cdt.debug.ui.localLaunchConfigurationTypeImage">
</launchConfigurationTypeImage>
</extension>
- <extension
- point="org.eclipse.debug.ui.launchConfigurationTabGroups">
- <launchConfigurationTabGroup
- class="org.eclipse.cdt.debug.internal.ui.launch.LocalLaunchConfigurationTabGroup"
- id="org.eclipse.cdt.debug.ui.launchConfigurationTabGroup1"
- type="org.eclipse.cdt.debug.core.localLaunchConfigurationType">
- </launchConfigurationTabGroup>
- </extension>
</plugin>
diff --git a/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF b/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
index 496f56b6b6..a3661afac9 100644
--- a/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
+++ b/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.launch; singleton:=true
-Bundle-Version: 9.0.1.qualifier
+Bundle-Version: 9.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/launch/org.eclipse.cdt.launch/plugin.xml b/launch/org.eclipse.cdt.launch/plugin.xml
index 49427d1bce..fb521cdfd4 100644
--- a/launch/org.eclipse.cdt.launch/plugin.xml
+++ b/launch/org.eclipse.cdt.launch/plugin.xml
@@ -2,6 +2,7 @@
<?eclipse version="3.0"?>
<plugin>
<extension-point id="launchConfigAffinity" name="%launchConfigAffinity.name" schema="schema/launchConfigAffinity.exsd"/>
+ <extension-point id="coreBuildTab" name="Core Build Tab" schema="schema/coreBuildTab.exsd"/>
<extension
point="org.eclipse.debug.core.launchDelegates">
@@ -141,4 +142,12 @@
</enablement>
</renameParticipant>
</extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.eclipse.cdt.launch.internal.corebuild.LocalLaunchConfigurationTabGroup"
+ id="org.eclipse.cdt.launch.launchConfigurationTabGroup.local"
+ type="org.eclipse.cdt.debug.core.localLaunchConfigurationType">
+ </launchConfigurationTabGroup>
+ </extension>
</plugin>
diff --git a/launch/org.eclipse.cdt.launch/pom.xml b/launch/org.eclipse.cdt.launch/pom.xml
index 2500d51799..b9832703da 100644
--- a/launch/org.eclipse.cdt.launch/pom.xml
+++ b/launch/org.eclipse.cdt.launch/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>9.0.1-SNAPSHOT</version>
+ <version>9.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.launch</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/launch/org.eclipse.cdt.launch/schema/coreBuildTab.exsd b/launch/org.eclipse.cdt.launch/schema/coreBuildTab.exsd
new file mode 100644
index 0000000000..783f9cc11f
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/schema/coreBuildTab.exsd
@@ -0,0 +1,117 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.launch" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.launch" id="coreBuildTab" name="Core Build Tab"/>
+ </appInfo>
+ <documentation>
+ Allows Core Build Providers to provide content for the Build tab in Launch Configurations
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="provider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <annotation>
+ <documentation>
+ A provider of content for the Build tab with Core Build launches.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="tabClass" type="string" use="required">
+ <annotation>
+ <documentation>
+ The tab implementation class. The class is instantiation and rendered in the Build tab.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.debug.ui.ILaunchConfigurationTab"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="nature" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project nature of build system for which this tab applies.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.core.resources.natures/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LocalLaunchConfigurationTabGroup.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/LocalLaunchConfigurationTabGroup.java
index f202e165b3..f71ada7cd7 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LocalLaunchConfigurationTabGroup.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/LocalLaunchConfigurationTabGroup.java
@@ -5,8 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.launch;
+package org.eclipse.cdt.launch.internal.corebuild;
+import org.eclipse.cdt.launch.ui.corebuild.CoreBuildMainTab;
+import org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
@@ -15,8 +17,13 @@ public class LocalLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- // empty for now
- setTabs(new ILaunchConfigurationTab[0]);
+ ILaunchConfigurationTab mainTab = new CoreBuildMainTab();
+ ILaunchConfigurationTab buildTab = new CoreBuildTab();
+
+ setTabs(new ILaunchConfigurationTab[] {
+ mainTab,
+ buildTab
+ });
}
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildMainTab.java
new file mode 100644
index 0000000000..e913e2d05e
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildMainTab.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.launch.ui.corebuild;
+
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @since 9.1
+ */
+public class CoreBuildMainTab extends AbstractLaunchConfigurationTab {
+
+ private Text projectName;
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout());
+
+ Label label = new Label(comp, SWT.NONE);
+ label.setText("This launch configuration was automatically created.");
+ label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ label = new Label(comp, SWT.NONE);
+ label.setText("Project:");
+
+ projectName = new Text(comp, SWT.READ_ONLY | SWT.BORDER);
+ projectName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ setControl(comp);
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // none
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ try {
+ for (IResource resource : configuration.getMappedResources()) {
+ if (resource instanceof IProject) {
+ projectName.setText(resource.getName());
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ LaunchUIPlugin.log(e.getStatus());
+ }
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getName() {
+ return "Main";
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildTab.java
new file mode 100644
index 0000000000..2607c6e773
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CoreBuildTab.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.launch.ui.corebuild;
+
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+public class CoreBuildTab extends AbstractLaunchConfigurationTab {
+
+ private Composite container;
+ private IProject activeProject;
+ private ILaunchConfigurationTab activeTab;
+
+ @Override
+ public void createControl(Composite parent) {
+ container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ container.setLayout(layout);
+ setControl(container);
+ defaultTab();
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ if (activeTab != null) {
+ activeTab.setDefaults(configuration);
+ }
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ IProject project = getProject(configuration);
+ if (project == null) {
+ defaultTab();
+ } else if (!project.equals(activeProject)) {
+ activeProject = project;
+ activeTab = getTab(project);
+ if (activeTab == null) {
+ defaultTab();
+ } else {
+ for (Control child : container.getChildren()) {
+ child.dispose();
+ }
+
+ activeTab.createControl(container);
+ activeTab.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ }
+ }
+
+ if (activeTab != null) {
+ activeTab.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+ activeTab.initializeFrom(configuration);
+ }
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (activeTab != null) {
+ activeTab.performApply(configuration);
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "Build";
+ }
+
+ private IProject getProject(ILaunchConfiguration configuration) {
+ try {
+ for (IResource resource : configuration.getMappedResources()) {
+ if (resource instanceof IProject) {
+ return (IProject) resource;
+ }
+ }
+ } catch (CoreException e) {
+ LaunchUIPlugin.log(e.getStatus());
+ }
+
+ return null;
+ }
+
+ private void defaultTab() {
+ // Clear out old contents
+ for (Control child : container.getChildren()) {
+ child.dispose();
+ }
+
+ Composite comp = new Composite(container, SWT.NONE);
+ comp.setLayout(new GridLayout());
+
+ Label label = new Label(comp, SWT.NONE);
+ label.setText("No build options required.");
+
+ activeTab = null;
+ }
+
+ private ILaunchConfigurationTab getTab(IProject project) {
+ try {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint point = registry.getExtensionPoint(LaunchUIPlugin.PLUGIN_ID, "coreBuildTab"); //$NON-NLS-1$
+ String[] natures = project.getDescription().getNatureIds();
+ for (IConfigurationElement element : point.getConfigurationElements()) {
+ String nature = element.getAttribute("nature"); //$NON-NLS-1$
+ if (nature != null) {
+ for (String n : natures) {
+ if (n.equals(nature)) {
+ return (ILaunchConfigurationTab) element.createExecutableExtension("tabClass"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ LaunchUIPlugin.log(e.getStatus());
+ }
+
+ return null;
+ }
+
+}
diff --git a/qt/org.eclipse.cdt.qt.core/plugin.xml b/qt/org.eclipse.cdt.qt.core/plugin.xml
index 56a4eb9ca0..e55bf9b4b4 100644
--- a/qt/org.eclipse.cdt.qt.core/plugin.xml
+++ b/qt/org.eclipse.cdt.qt.core/plugin.xml
@@ -115,51 +115,6 @@
<persistent value="true"/>
</extension>
<extension
- point="org.eclipse.launchbar.core.launchBarContributions">
- <descriptorType
- class="org.eclipse.cdt.internal.qt.core.launch.QtLaunchDescriptorType"
- id="org.eclipse.cdt.qt.core.launchDescriptorType"
- priority="10">
- <enablement>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- <test
- forcePluginActivation="true"
- property="org.eclipse.core.resources.projectNature"
- value="org.eclipse.cdt.qt.core.qtNature">
- </test>
- </enablement>
- </descriptorType>
- <configProvider
- class="org.eclipse.cdt.internal.qt.core.launch.QtLocalLaunchConfigationProvider"
- descriptorType="org.eclipse.cdt.qt.core.launchDescriptorType"
- priority="10">
- </configProvider>
- </extension>
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- delegate="org.eclipse.cdt.internal.qt.core.launch.QtLocalRunLaunchConfigDelegate"
- id="org.eclipse.cdt.qt.core.launchConfigurationType"
- modes="run"
- name="Qt Local Application"
- public="true"
- sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
- </launchConfigurationType>
- </extension>
- <extension
- point="org.eclipse.debug.core.launchDelegates">
- <launchDelegate
- delegate="org.eclipse.cdt.internal.qt.core.launch.QtLocalDebugLaunchConfigDelegate"
- id="org.eclipse.cdt.qt.core.launchDelegate.debug.local"
- modes="debug"
- name="Qt Local Debug launcher"
- type="org.eclipse.cdt.qt.core.launchConfigurationType">
- </launchDelegate>
- </extension>
- <extension
point="org.eclipse.cdt.core.buildConfigProvider">
<provider
class="org.eclipse.cdt.internal.qt.core.build.QtBuildConfigurationProvider"
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
index 8b19c1b317..460531accd 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
@@ -115,11 +115,6 @@ public class QtBuildConfiguration extends CBuildConfiguration
}
}
- @Override
- public <T> T getAdapter(Class<T> adapter) {
- return super.getAdapter(adapter);
- }
-
public IQtInstall getQtInstall() {
if (qtInstall == null && !qtInstallSpec.isEmpty()) {
// find one that matches the spec
@@ -176,6 +171,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
}
}
+ @Deprecated
@Override
public Path getProgramPath() throws CoreException {
// TODO get the app name from the .pro file.
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java
index 019c1c29eb..c442de5da8 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java
@@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.qt.core.Activator;
import org.eclipse.cdt.qt.core.IQtBuildConfiguration;
import org.eclipse.cdt.qt.core.IQtInstall;
import org.eclipse.cdt.qt.core.IQtInstallManager;
-import org.eclipse.cdt.qt.core.QtMinGWToolChainProvider;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -78,6 +77,47 @@ public class QtBuildConfigurationProvider implements ICBuildConfigurationProvide
}
}
+ @Override
+ public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
+ IProgressMonitor monitor) throws CoreException {
+ IQtInstall qtInstall = getQtInstall(toolChain);
+ if (qtInstall != null) {
+ // See if one exists
+ for (IBuildConfiguration config : project.getBuildConfigs()) {
+ ICBuildConfiguration cconfig = config.getAdapter(ICBuildConfiguration.class);
+ if (cconfig != null) {
+ IQtBuildConfiguration qtConfig = cconfig.getAdapter(IQtBuildConfiguration.class);
+ if (qtConfig != null && launchMode.equals(qtConfig.getLaunchMode()) &&
+ qtConfig.getToolChain().equals(toolChain)) {
+ return qtConfig;
+ }
+ }
+ }
+
+ // TODO what if multiple matches, this returns first match
+ String configName = "qt." + qtInstall.getSpec() + "." + launchMode; //$NON-NLS-1$ //$NON-NLS-2$
+ IBuildConfiguration config = configManager.createBuildConfiguration(this, project, configName,
+ monitor);
+ QtBuildConfiguration qtConfig = new QtBuildConfiguration(config, configName, toolChain, qtInstall,
+ launchMode);
+ configManager.addBuildConfiguration(config, qtConfig);
+ return qtConfig;
+ }
+
+ return null;
+ }
+
+ private IQtInstall getQtInstall(IToolChain toolChain) {
+ for (IQtInstall qtInstall : qtInstallManager.getInstalls()) {
+ if (qtInstallManager.supports(qtInstall, toolChain)) {
+ return qtInstall;
+ }
+ }
+
+ return null;
+ }
+
+ // TODO this goes when the launch delegate goes
public IQtBuildConfiguration getConfiguration(IProject project, Map<String, String> properties, String launchMode,
IProgressMonitor monitor) throws CoreException {
Collection<IToolChain> toolChains = toolChainManager.getToolChainsMatching(properties);
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptor.java
deleted file mode 100644
index 73c5851521..0000000000
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptor.java
+++ /dev/null
@@ -1,50 +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.internal.qt.core.launch;
-
-import org.eclipse.cdt.qt.core.IQtLaunchDescriptor;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.launchbar.core.ILaunchDescriptorType;
-
-public class QtLaunchDescriptor extends PlatformObject implements IQtLaunchDescriptor {
-
- private final QtLaunchDescriptorType type;
- private final IProject project;
-
- public QtLaunchDescriptor(QtLaunchDescriptorType type, IProject project) {
- this.type = type;
- this.project = project;
- }
-
- @Override
- public String getName() {
- return project.getName();
- }
-
- @Override
- public ILaunchDescriptorType getType() {
- return type;
- }
-
- @Override
- public IProject getProject() {
- return project;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter.equals(IProject.class)) {
- return (T) project;
- } else {
- return super.getAdapter(adapter);
- }
- }
-
-}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptorType.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptorType.java
deleted file mode 100644
index 41f8cbdbe1..0000000000
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLaunchDescriptorType.java
+++ /dev/null
@@ -1,41 +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.internal.qt.core.launch;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.internal.qt.core.QtNature;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.launchbar.core.ILaunchDescriptor;
-import org.eclipse.launchbar.core.ILaunchDescriptorType;
-
-public class QtLaunchDescriptorType implements ILaunchDescriptorType {
-
- private Map<IProject, QtLaunchDescriptor> descriptors = new HashMap<>();
-
- @Override
- public ILaunchDescriptor getDescriptor(Object launchObject) throws CoreException {
- // TODO also check to make sure it's an application project and not a library.
- // qmake -E will give the TEMPLATE variable
- if (launchObject instanceof IProject) {
- IProject project = (IProject) launchObject;
- if (QtNature.hasNature(project)) {
- QtLaunchDescriptor desc = descriptors.get(project);
- if (desc == null) {
- desc = new QtLaunchDescriptor(this, project);
- descriptors.put(project, desc);
- }
- return desc;
- }
- }
- return null;
- }
-
-}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalLaunchConfigationProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalLaunchConfigationProvider.java
deleted file mode 100644
index f985c07209..0000000000
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalLaunchConfigationProvider.java
+++ /dev/null
@@ -1,36 +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.internal.qt.core.launch;
-
-import org.eclipse.cdt.qt.core.QtLaunchConfigurationProvider;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.launchbar.core.ILaunchDescriptor;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-import org.eclipse.launchbar.core.target.ILaunchTargetManager;
-
-/**
- * Launch config provider for Qt projects running on the Local connection.
- * Simply uses the C++ Application launch config type.
- */
-public class QtLocalLaunchConfigationProvider extends QtLaunchConfigurationProvider {
-
- @Override
- public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
- return ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId());
- }
-
- @Override
- public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target)
- throws CoreException {
- return DebugPlugin.getDefault().getLaunchManager()
- .getLaunchConfigurationType(QtLocalRunLaunchConfigDelegate.TYPE_ID);
- }
-
-}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalRunLaunchConfigDelegate.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalRunLaunchConfigDelegate.java
deleted file mode 100644
index c300c209f8..0000000000
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/launch/QtLocalRunLaunchConfigDelegate.java
+++ /dev/null
@@ -1,66 +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.internal.qt.core.launch;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.internal.qt.core.Activator;
-import org.eclipse.cdt.qt.core.IQtBuildConfiguration;
-import org.eclipse.cdt.qt.core.QtLaunchConfigurationDelegate;
-import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
-
-public class QtLocalRunLaunchConfigDelegate extends QtLaunchConfigurationDelegate {
-
- public static final String TYPE_ID = Activator.ID + ".launchConfigurationType"; //$NON-NLS-1$
-
- @Override
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
- throws CoreException {
- ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
- IQtBuildConfiguration qtBuildConfig = getQtBuildConfiguration(configuration, mode, target, monitor);
-
- IBuildConfiguration buildConfig = qtBuildConfig.getBuildConfiguration();
- ProcessBuilder processBuilder = new ProcessBuilder(qtBuildConfig.getProgramPath().toString())
- .directory(buildConfig.getProject().getLocation().toFile());
-
- Map<String, String> env = processBuilder.environment();
- for (IEnvironmentVariable var : CCorePlugin.getDefault().getBuildEnvironmentManager()
- .getVariables(qtBuildConfig.getBuildConfiguration(), true)) {
- env.put(var.getName(), var.getValue());
- }
-
- Map<String, String> configEnv = configuration.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
- (Map<String, String>) null);
- if (configEnv != null) {
- for (Map.Entry<String, String> entry : configEnv.entrySet()) {
- env.put(entry.getKey(), entry.getValue());
- }
- }
-
- try {
- Process process = processBuilder.start();
- DebugPlugin.newProcess(launch, process, qtBuildConfig.getProgramPath().toString());
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Launching", e));
- }
- }
-
-}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java
index f1726f09bb..1345c8f922 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java
@@ -48,17 +48,26 @@ public class QtProjectGenerator extends FMProjectGenerator {
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
super.generate(model, monitor);
- // Create the sourcefolders
+ // Create the source folders
IProject project = getProject();
List<IPathEntry> entries = new ArrayList<>();
- for (SourceRoot srcRoot : getManifest().getSrcRoots()) {
- IFolder sourceFolder = project.getFolder(srcRoot.getDir());
- if (!sourceFolder.exists()) {
- sourceFolder.create(true, true, monitor);
- }
+ List<SourceRoot> srcRoots = getManifest().getSrcRoots();
+ if (srcRoots != null && !srcRoots.isEmpty()) {
+ for (SourceRoot srcRoot : srcRoots) {
+ IFolder sourceFolder = project.getFolder(srcRoot.getDir());
+ if (!sourceFolder.exists()) {
+ sourceFolder.create(true, true, monitor);
+ }
- entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath()));
+ entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath()));
+ }
+ } else {
+ entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
}
+
+ // build directory as output folder
+ entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath())); //$NON-NLS-1$
+
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
monitor);
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java
index ee55522304..3c42900141 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java
@@ -20,6 +20,10 @@ public interface IQtBuildConfiguration extends ICBuildConfiguration {
String[] getQmakeConfig();
+ /**
+ * @deprecated use getBuildOutput() instead
+ */
+ @Deprecated
Path getProgramPath() throws CoreException;
String getLaunchMode();
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtLaunchConfigurationProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtLaunchConfigurationProvider.java
deleted file mode 100644
index 0ef7ef98c1..0000000000
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtLaunchConfigurationProvider.java
+++ /dev/null
@@ -1,98 +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.qt.core;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.internal.qt.core.launch.QtLaunchDescriptor;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.launchbar.core.AbstractLaunchConfigProvider;
-import org.eclipse.launchbar.core.ILaunchDescriptor;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-
-public abstract class QtLaunchConfigurationProvider extends AbstractLaunchConfigProvider {
-
- private Map<IProject, ILaunchConfiguration> configs = new HashMap<>();
-
- @Override
- public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target)
- throws CoreException {
- ILaunchConfiguration config = null;
- IProject project = descriptor.getAdapter(IProject.class);
- if (project != null) {
- config = configs.get(project);
- if (config == null) {
- config = createLaunchConfiguration(descriptor, target);
- // launch config added will get called below to add it to the
- // configs map
- }
- }
- return config;
- }
-
- @Override
- protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target,
- ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
- super.populateLaunchConfiguration(descriptor, target, workingCopy);
-
- // Main is actually in the library. Don't stop there
- workingCopy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
-
- // Set the project and the connection
- QtLaunchDescriptor qtDesc = (QtLaunchDescriptor) descriptor;
- workingCopy.setMappedResources(new IResource[] { qtDesc.getProject() });
- }
-
- @Override
- public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
- if (ownsLaunchConfiguration(configuration)) {
- IProject project = configuration.getMappedResources()[0].getProject();
- configs.put(project, configuration);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException {
- for (Entry<IProject, ILaunchConfiguration> entry : configs.entrySet()) {
- if (configuration.equals(entry.getValue())) {
- configs.remove(entry.getKey());
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
- // TODO not sure I care
- return false;
- }
-
- @Override
- public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
- IProject project = descriptor.getAdapter(IProject.class);
- if (project != null) {
- configs.remove(project);
- }
- }
-
- @Override
- public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
- // nothing to do since the Local connection can't be removed
- }
-
-}
diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp
index b3e29a3b85..9835fbac6b 100644
--- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp
+++ b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp
@@ -5,7 +5,7 @@ int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/src/${projectName}.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/${projectName}.qml")));
return app.exec();
}
diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro
index f80ccb38ca..0ff331f048 100644
--- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro
+++ b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro
@@ -5,7 +5,7 @@ CONFIG += c++11
RESOURCES += ${projectName}.qrc
-qml.files = src/${projectName}.qml
+qml.files = ${projectName}.qml
launch_modeall {
CONFIG(debug, debug|release) {
diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc
index 30335ce99e..274d26dc9b 100644
--- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc
+++ b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>src/${projectName}.qml</file>
+ <file>${projectName}.qml</file>
</qresource>
</RCC>
diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml
index 91eac74942..7a88c74085 100644
--- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml
+++ b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml
@@ -1,9 +1,8 @@
<templateManifest>
- <srcRoot dir="src"/>
<file src="/templates/project2/appProject/main.cpp"
- dest="/${projectName}/src/${projectName}.cpp"/>
+ dest="/${projectName}/${projectName}.cpp"/>
<file src="/templates/project2/appProject/main.qml"
- dest="/${projectName}/src/${projectName}.qml"/>
+ dest="/${projectName}/${projectName}.qml"/>
<file src="/templates/project2/appProject/main.pro"
dest="/${projectName}/${projectName}.pro"/>
<file src="/templates/project2/appProject/main.qrc"
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml b/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
index 06fd3d964e..c7abbdbe8e 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/plugin.xml
@@ -7,7 +7,8 @@
delegate="org.eclipse.cdt.arduino.core.internal.launch.ArduinoLaunchConfigurationDelegate"
id="org.eclipse.cdt.arduino.core.launchConfigurationType"
modes="run"
- name="Arduino">
+ name="Arduino"
+ public="false">
</launchConfigurationType>
</extension>
<extension
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 cd057f489f..e610c9fb58 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
@@ -87,7 +87,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
private final ArduinoRemoteConnection target;
private final String launchMode;
private ArduinoBoard defaultBoard;
- private Properties properties;
+ private Properties boardProperties;
// for Makefile generation
private Configuration templateConfig;
@@ -116,7 +116,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
@Override
public synchronized void connectionChanged(RemoteConnectionChangeEvent event) {
if (event.getConnection().equals(target.getRemoteConnection())) {
- properties = null;
+ boardProperties = null;
}
}
@@ -145,32 +145,32 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
}
}
- private synchronized Properties getProperties() throws CoreException {
- if (properties == null) {
+ private synchronized Properties getBoardProperties() throws CoreException {
+ if (boardProperties == null) {
ArduinoBoard board = getBoard();
ArduinoPlatform platform = board.getPlatform();
// IDE generated properties
- properties = new Properties();
- properties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$
- properties.put("runtime.ide.version", "10608"); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("software", "ARDUINO"); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$
- properties.put("build.path", "."); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("build.core.path", //$NON-NLS-1$
+ boardProperties = new Properties();
+ boardProperties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$
+ boardProperties.put("runtime.ide.version", "10608"); //$NON-NLS-1$ //$NON-NLS-2$
+ boardProperties.put("software", "ARDUINO"); //$NON-NLS-1$ //$NON-NLS-2$
+ boardProperties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$
+ boardProperties.put("build.path", "."); //$NON-NLS-1$ //$NON-NLS-2$
+ boardProperties.put("build.core.path", //$NON-NLS-1$
platform.getInstallPath().resolve("cores").resolve("{build.core}").toString()); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("build.system.path", platform.getInstallPath().resolve("system").toString()); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("build.variant.path", //$NON-NLS-1$
+ boardProperties.put("build.system.path", platform.getInstallPath().resolve("system").toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ boardProperties.put("build.variant.path", //$NON-NLS-1$
platform.getInstallPath().resolve("variants").resolve("{build.variant}").toString()); //$NON-NLS-1$ //$NON-NLS-2$
// Everyone seems to want to use arduino package tools
ArduinoPackage arduinoPackage = manager.getPackage("arduino"); //$NON-NLS-1$
if (arduinoPackage != null) {
for (ArduinoTool tool : arduinoPackage.getLatestTools()) {
- properties.put("runtime.tools." + tool.getName() + ".path", tool.getInstallPath().toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ boardProperties.put("runtime.tools." + tool.getName() + ".path", tool.getInstallPath().toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
for (ArduinoTool tool : arduinoPackage.getTools()) {
- properties.put("runtime.tools." + tool.getName() + '-' + tool.getVersion() + ".path", //$NON-NLS-1$ //$NON-NLS-2$
+ boardProperties.put("runtime.tools." + tool.getName() + '-' + tool.getVersion() + ".path", //$NON-NLS-1$ //$NON-NLS-2$
tool.getInstallPath().toString());
}
}
@@ -183,21 +183,21 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
ArduinoPlatform superPlatform = manager.getInstalledPlatform(segments[0],
platform.getArchitecture());
if (superPlatform != null) {
- properties.putAll(superPlatform.getPlatformProperties());
+ boardProperties.putAll(superPlatform.getPlatformProperties());
}
}
}
// Platform
- properties.putAll(platform.getPlatformProperties());
+ boardProperties.putAll(platform.getPlatformProperties());
// Tools
for (ToolDependency toolDep : platform.getToolsDependencies()) {
- properties.putAll(toolDep.getTool().getToolProperties());
+ boardProperties.putAll(toolDep.getTool().getToolProperties());
}
// Board
- properties.putAll(board.getBoardProperties());
+ boardProperties.putAll(board.getBoardProperties());
// Menus
HierarchicalProperties menus = board.getMenus();
@@ -213,15 +213,15 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
}
}
if (value != null && !value.isEmpty()) {
- properties.putAll(board.getMenuProperties(key, value));
+ boardProperties.putAll(board.getMenuProperties(key, value));
}
}
}
}
// always do this in case the project changes names
- properties.put("build.project_name", getProject().getName()); //$NON-NLS-1$
- return properties;
+ boardProperties.put("build.project_name", getProject().getName()); //$NON-NLS-1$
+ return boardProperties;
}
public Map<String, Object> getBuildModel() throws CoreException {
@@ -263,7 +263,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
buildModel.put("libraries_path", pathString(ArduinoPreferences.getArduinoHome().resolve("libraries"))); //$NON-NLS-1$ //$NON-NLS-2$
// the recipes
- properties.putAll(getProperties());
+ properties.putAll(getBoardProperties());
buildModel.put("build_path", properties.get("build.path")); //$NON-NLS-1$ //$NON-NLS-2$
buildModel.put("project_name", project.getName()); //$NON-NLS-1$
@@ -471,7 +471,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
}
public int getMaxCodeSize() throws CoreException {
- String sizeStr = getProperties().getProperty("upload.maximum_size"); //$NON-NLS-1$
+ String sizeStr = getBoardProperties().getProperty("upload.maximum_size"); //$NON-NLS-1$
return sizeStr != null ? Integer.parseInt(sizeStr) : -1;
}
@@ -480,13 +480,13 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
}
public int getMaxDataSize() throws CoreException {
- String sizeStr = getProperties().getProperty("upload.maximum_data_size"); //$NON-NLS-1$
+ String sizeStr = getBoardProperties().getProperty("upload.maximum_data_size"); //$NON-NLS-1$
return sizeStr != null ? Integer.parseInt(sizeStr) : -1;
}
public String[] getUploadCommand(String serialPort) throws CoreException {
Properties properties = new Properties();
- properties.putAll(getProperties());
+ properties.putAll(getBoardProperties());
String toolName = properties.getProperty("upload.tool"); //$NON-NLS-1$
ArduinoPlatform platform = getBoard().getPlatform();
@@ -610,7 +610,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
ArduinoPlatform platform = getBoard().getPlatform();
Properties properties = new Properties();
- properties.putAll(getProperties());
+ properties.putAll(getBoardProperties());
// Overrides for scanner discovery
properties.put("source_file", ""); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java
index 1efdf44d37..5c044f0e58 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/project/NewArduinoProjectWizard.java
@@ -15,6 +15,8 @@ public class NewArduinoProjectWizard extends NewWizard {
public NewArduinoProjectWizard() {
super(ARDUINO_TAG_ID);
+ setWindowTitle("New Arduino C++ Project");
+ setTemplateSelectionPageTitle("Templates for New Arduino C++ Project");
}
}

Back to the top