mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Updates for Core Build.
Change-Id: I8720d5b57e335adde538838790c3ecdd465a7ed7
This commit is contained in:
parent
23f68c6c35
commit
e371ba0919
36 changed files with 943 additions and 426 deletions
|
@ -14,7 +14,6 @@ import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -32,7 +31,6 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
import org.osgi.service.prefs.Preferences;
|
import org.osgi.service.prefs.Preferences;
|
||||||
|
|
||||||
|
@ -40,6 +38,11 @@ import com.google.gson.Gson;
|
||||||
|
|
||||||
public class CMakeBuildConfiguration extends CBuildConfiguration {
|
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 static final String TOOLCHAIN_FILE = "cdt.cmake.toolchainfile"; //$NON-NLS-1$
|
||||||
|
|
||||||
private ICMakeToolChainFile toolChainFile;
|
private ICMakeToolChainFile toolChainFile;
|
||||||
|
@ -85,6 +88,12 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
try {
|
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);
|
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
|
||||||
|
|
||||||
ConsoleOutputStream outStream = console.getOutputStream();
|
ConsoleOutputStream outStream = console.getOutputStream();
|
||||||
|
@ -93,24 +102,19 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
||||||
|
|
||||||
outStream.write(String.format("Building in: %s\n", buildDir.toString()));
|
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<>();
|
List<String> command = new ArrayList<>();
|
||||||
|
|
||||||
// TODO assuming cmake is in the path here, probably need a
|
// TODO location of CMake out of preferences if not found here
|
||||||
// preference in case it isn't.
|
Path cmakePath = findCommand("cmake"); //$NON-NLS-1$
|
||||||
Path cmakePath = CBuildConfiguration.getCommandFromPath(Paths.get("cmake")); //$NON-NLS-1$
|
if (cmakePath != null) {
|
||||||
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$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
command.add(cmakePath.toString());
|
command.add(cmakePath.toString());
|
||||||
|
} else {
|
||||||
|
command.add("cmake"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
command.add("-G"); //$NON-NLS-1$
|
command.add("-G"); //$NON-NLS-1$
|
||||||
// TODO ninja?
|
command.add(generator);
|
||||||
command.add("Unix Makefiles"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
if (toolChainFile != null) {
|
if (toolChainFile != null) {
|
||||||
command.add("-DCMAKE_TOOLCHAIN_FILE=" + toolChainFile.getPath().toString()); //$NON-NLS-1$
|
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,
|
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
|
||||||
getToolChain().getErrorParserIds())) {
|
getToolChain().getErrorParserIds())) {
|
||||||
// TODO need to figure out which builder to call. Hardcoding to
|
String buildCommand = properties.get(BUILD_COMMAND);
|
||||||
// make for now.
|
if (buildCommand == null) {
|
||||||
List<String> command = Arrays.asList("make"); //$NON-NLS-1$
|
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());
|
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
|
||||||
setBuildEnvironment(processBuilder.environment());
|
setBuildEnvironment(processBuilder.environment());
|
||||||
Process process = processBuilder.start();
|
Process process = processBuilder.start();
|
||||||
|
@ -153,20 +169,35 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
||||||
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
|
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
try {
|
try {
|
||||||
|
Map<String, String> properties = getProperties();
|
||||||
|
String generator = properties.get(CMAKE_GENERATOR);
|
||||||
|
|
||||||
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
|
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
|
||||||
|
|
||||||
ConsoleOutputStream outStream = console.getOutputStream();
|
ConsoleOutputStream outStream = console.getOutputStream();
|
||||||
|
|
||||||
Path buildDir = getBuildDirectory();
|
Path buildDir = getBuildDirectory();
|
||||||
|
|
||||||
if (!Files.exists(buildDir.resolve("Makefile"))) { //$NON-NLS-1$
|
if (!Files.exists(buildDir.resolve("CMakeFiles"))) { //$NON-NLS-1$
|
||||||
outStream.write("Makefile not found. Assuming clean.");
|
outStream.write("CMakeFiles not found. Assuming clean.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO need to figure out which builder to call. Hardcoding to make
|
String cleanCommand = properties.get(CLEAN_COMMAND);
|
||||||
// for now.
|
if (cleanCommand == null) {
|
||||||
List<String> command = Arrays.asList("make", "clean"); //$NON-NLS-1$
|
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());
|
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
|
||||||
Process process = processBuilder.start();
|
Process process = processBuilder.start();
|
||||||
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
|
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
|
||||||
|
|
|
@ -11,7 +11,9 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.ui.ide,
|
org.eclipse.ui.ide,
|
||||||
org.eclipse.cdt.cmake.core,
|
org.eclipse.cdt.cmake.core,
|
||||||
org.eclipse.tools.templates.ui;bundle-version="1.1.0",
|
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-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -51,5 +51,13 @@
|
||||||
</tagReference>
|
</tagReference>
|
||||||
</template>
|
</template>
|
||||||
</extension>
|
</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>
|
</plugin>
|
||||||
|
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -102,6 +102,8 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
private final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
|
private final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
|
||||||
private ScannerInfoCache scannerInfoCache;
|
private ScannerInfoCache scannerInfoCache;
|
||||||
|
|
||||||
|
private Map<String, String> properties;
|
||||||
|
|
||||||
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
|
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.name = name;
|
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
|
// TODO should really be passing a monitor in here or create this in
|
||||||
// a better spot. should also throw the core exception
|
// a better spot. should also throw the core exception
|
||||||
// TODO make the name of this folder a project property
|
// 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()) {
|
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);
|
IFolder buildFolder = buildRootFolder.getFolder(name);
|
||||||
if (!buildFolder.exists()) {
|
if (!buildFolder.exists()) {
|
||||||
buildFolder.create(IResource.FORCE | IResource.DERIVED, true, new NullProgressMonitor());
|
buildFolder.create(IResource.FORCE | IResource.DERIVED, true, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildFolder;
|
return buildFolder;
|
||||||
|
@ -662,4 +666,20 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
return null;
|
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<>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.build;
|
package org.eclipse.cdt.core.build;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
|
@ -50,18 +51,65 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
|
||||||
*/
|
*/
|
||||||
IToolChain getToolChain() throws CoreException;
|
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;
|
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;
|
IEnvironmentVariable getVariable(String name) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all of the build environment variables for this configuration.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
IEnvironmentVariable[] getVariables() 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;
|
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;
|
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
|
* @throws CoreException
|
||||||
* @since 6.1
|
* @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
|
* @param env
|
||||||
|
* build environment
|
||||||
* @since 6.1
|
* @since 6.1
|
||||||
*/
|
*/
|
||||||
default void setBuildEnvironment(Map<String, String> env) {
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ public class NewCDTProjectWizard extends NewWizard {
|
||||||
|
|
||||||
public NewCDTProjectWizard() {
|
public NewCDTProjectWizard() {
|
||||||
super(cdtTag);
|
super(cdtTag);
|
||||||
|
setWindowTitle("New C/C++ Project");
|
||||||
setTemplateSelectionPageTitle("Templates for New C/C++ Project");
|
setTemplateSelectionPageTitle("Templates for New C/C++ Project");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ AttachLaunch.name=C/C++ Attach to Application
|
||||||
PostMortemLaunch.name=C/C++ Postmortem Debugger
|
PostMortemLaunch.name=C/C++ Postmortem Debugger
|
||||||
RemoteApplicationLaunch.name=C/C++ Remote Application
|
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
|
CDebugger.name=C/C++ Development Tools Core Debugger Extension
|
||||||
BreakpointAction.name=Breakpoint Action Extension
|
BreakpointAction.name=Breakpoint Action Extension
|
||||||
|
|
|
@ -467,7 +467,8 @@
|
||||||
delegate="org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalRunLaunchDelegate"
|
delegate="org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalRunLaunchDelegate"
|
||||||
id="org.eclipse.cdt.debug.core.localLaunchConfigurationType"
|
id="org.eclipse.cdt.debug.core.localLaunchConfigurationType"
|
||||||
modes="run"
|
modes="run"
|
||||||
name="%localApplicationLaunch.name">
|
name="%localApplicationLaunch.name"
|
||||||
|
public="false">
|
||||||
</launchConfigurationType>
|
</launchConfigurationType>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -64,6 +64,11 @@ public class CoreBuildLocalRunLaunchDelegate extends LaunchConfigurationTargeted
|
||||||
IProjectDescription desc = project.getDescription();
|
IProjectDescription desc = project.getDescription();
|
||||||
desc.setActiveBuildConfig(config.getBuildConfiguration().getName());
|
desc.setActiveBuildConfig(config.getBuildConfiguration().getName());
|
||||||
project.setDescription(desc, monitor);
|
project.setDescription(desc, monitor);
|
||||||
|
|
||||||
|
Map<String, String> buildProps = configuration.getAttribute("COREBUILD_" + mode, new HashMap<>()); //$NON-NLS-1$
|
||||||
|
if (!buildProps.isEmpty()) {
|
||||||
|
config.setProperties(buildProps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2575,13 +2575,5 @@
|
||||||
id="org.eclipse.cdt.debug.ui.localLaunchConfigurationTypeImage">
|
id="org.eclipse.cdt.debug.ui.localLaunchConfigurationTypeImage">
|
||||||
</launchConfigurationTypeImage>
|
</launchConfigurationTypeImage>
|
||||||
</extension>
|
</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>
|
</plugin>
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.launch; singleton:=true
|
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-Activator: org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<?eclipse version="3.0"?>
|
<?eclipse version="3.0"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
<extension-point id="launchConfigAffinity" name="%launchConfigAffinity.name" schema="schema/launchConfigAffinity.exsd"/>
|
<extension-point id="launchConfigAffinity" name="%launchConfigAffinity.name" schema="schema/launchConfigAffinity.exsd"/>
|
||||||
|
<extension-point id="coreBuildTab" name="Core Build Tab" schema="schema/coreBuildTab.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.debug.core.launchDelegates">
|
point="org.eclipse.debug.core.launchDelegates">
|
||||||
|
@ -141,4 +142,12 @@
|
||||||
</enablement>
|
</enablement>
|
||||||
</renameParticipant>
|
</renameParticipant>
|
||||||
</extension>
|
</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>
|
</plugin>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>9.0.1-SNAPSHOT</version>
|
<version>9.1.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.launch</artifactId>
|
<artifactId>org.eclipse.cdt.launch</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
117
launch/org.eclipse.cdt.launch/schema/coreBuildTab.exsd
Normal file
117
launch/org.eclipse.cdt.launch/schema/coreBuildTab.exsd
Normal file
|
@ -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>
|
|
@ -5,8 +5,10 @@
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* 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.AbstractLaunchConfigurationTabGroup;
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||||
|
@ -15,8 +17,13 @@ public class LocalLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
||||||
// empty for now
|
ILaunchConfigurationTab mainTab = new CoreBuildMainTab();
|
||||||
setTabs(new ILaunchConfigurationTab[0]);
|
ILaunchConfigurationTab buildTab = new CoreBuildTab();
|
||||||
|
|
||||||
|
setTabs(new ILaunchConfigurationTab[] {
|
||||||
|
mainTab,
|
||||||
|
buildTab
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -114,51 +114,6 @@
|
||||||
<super type="org.eclipse.cdt.codan.core.codanProblem"/>
|
<super type="org.eclipse.cdt.codan.core.codanProblem"/>
|
||||||
<persistent value="true"/>
|
<persistent value="true"/>
|
||||||
</extension>
|
</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
|
<extension
|
||||||
point="org.eclipse.cdt.core.buildConfigProvider">
|
point="org.eclipse.cdt.core.buildConfigProvider">
|
||||||
<provider
|
<provider
|
||||||
|
|
|
@ -115,11 +115,6 @@ public class QtBuildConfiguration extends CBuildConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> T getAdapter(Class<T> adapter) {
|
|
||||||
return super.getAdapter(adapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IQtInstall getQtInstall() {
|
public IQtInstall getQtInstall() {
|
||||||
if (qtInstall == null && !qtInstallSpec.isEmpty()) {
|
if (qtInstall == null && !qtInstallSpec.isEmpty()) {
|
||||||
// find one that matches the spec
|
// find one that matches the spec
|
||||||
|
@ -176,6 +171,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public Path getProgramPath() throws CoreException {
|
public Path getProgramPath() throws CoreException {
|
||||||
// TODO get the app name from the .pro file.
|
// TODO get the app name from the .pro file.
|
||||||
|
|
|
@ -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.IQtBuildConfiguration;
|
||||||
import org.eclipse.cdt.qt.core.IQtInstall;
|
import org.eclipse.cdt.qt.core.IQtInstall;
|
||||||
import org.eclipse.cdt.qt.core.IQtInstallManager;
|
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.IBuildConfiguration;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
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,
|
public IQtBuildConfiguration getConfiguration(IProject project, Map<String, String> properties, String launchMode,
|
||||||
IProgressMonitor monitor) throws CoreException {
|
IProgressMonitor monitor) throws CoreException {
|
||||||
Collection<IToolChain> toolChains = toolChainManager.getToolChainsMatching(properties);
|
Collection<IToolChain> toolChains = toolChainManager.getToolChainsMatching(properties);
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -51,7 +51,9 @@ public class QtProjectGenerator extends FMProjectGenerator {
|
||||||
// Create the source folders
|
// Create the source folders
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
List<IPathEntry> entries = new ArrayList<>();
|
List<IPathEntry> entries = new ArrayList<>();
|
||||||
for (SourceRoot srcRoot : getManifest().getSrcRoots()) {
|
List<SourceRoot> srcRoots = getManifest().getSrcRoots();
|
||||||
|
if (srcRoots != null && !srcRoots.isEmpty()) {
|
||||||
|
for (SourceRoot srcRoot : srcRoots) {
|
||||||
IFolder sourceFolder = project.getFolder(srcRoot.getDir());
|
IFolder sourceFolder = project.getFolder(srcRoot.getDir());
|
||||||
if (!sourceFolder.exists()) {
|
if (!sourceFolder.exists()) {
|
||||||
sourceFolder.create(true, true, monitor);
|
sourceFolder.create(true, true, monitor);
|
||||||
|
@ -59,6 +61,13 @@ public class QtProjectGenerator extends FMProjectGenerator {
|
||||||
|
|
||||||
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()]),
|
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
|
||||||
monitor);
|
monitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ public interface IQtBuildConfiguration extends ICBuildConfiguration {
|
||||||
|
|
||||||
String[] getQmakeConfig();
|
String[] getQmakeConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use getBuildOutput() instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
Path getProgramPath() throws CoreException;
|
Path getProgramPath() throws CoreException;
|
||||||
|
|
||||||
String getLaunchMode();
|
String getLaunchMode();
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@ int main(int argc, char *argv[]) {
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/src/${projectName}.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:/${projectName}.qml")));
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ CONFIG += c++11
|
||||||
|
|
||||||
RESOURCES += ${projectName}.qrc
|
RESOURCES += ${projectName}.qrc
|
||||||
|
|
||||||
qml.files = src/${projectName}.qml
|
qml.files = ${projectName}.qml
|
||||||
|
|
||||||
launch_modeall {
|
launch_modeall {
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>src/${projectName}.qml</file>
|
<file>${projectName}.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<templateManifest>
|
<templateManifest>
|
||||||
<srcRoot dir="src"/>
|
|
||||||
<file src="/templates/project2/appProject/main.cpp"
|
<file src="/templates/project2/appProject/main.cpp"
|
||||||
dest="/${projectName}/src/${projectName}.cpp"/>
|
dest="/${projectName}/${projectName}.cpp"/>
|
||||||
<file src="/templates/project2/appProject/main.qml"
|
<file src="/templates/project2/appProject/main.qml"
|
||||||
dest="/${projectName}/src/${projectName}.qml"/>
|
dest="/${projectName}/${projectName}.qml"/>
|
||||||
<file src="/templates/project2/appProject/main.pro"
|
<file src="/templates/project2/appProject/main.pro"
|
||||||
dest="/${projectName}/${projectName}.pro"/>
|
dest="/${projectName}/${projectName}.pro"/>
|
||||||
<file src="/templates/project2/appProject/main.qrc"
|
<file src="/templates/project2/appProject/main.qrc"
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
delegate="org.eclipse.cdt.arduino.core.internal.launch.ArduinoLaunchConfigurationDelegate"
|
delegate="org.eclipse.cdt.arduino.core.internal.launch.ArduinoLaunchConfigurationDelegate"
|
||||||
id="org.eclipse.cdt.arduino.core.launchConfigurationType"
|
id="org.eclipse.cdt.arduino.core.launchConfigurationType"
|
||||||
modes="run"
|
modes="run"
|
||||||
name="Arduino">
|
name="Arduino"
|
||||||
|
public="false">
|
||||||
</launchConfigurationType>
|
</launchConfigurationType>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
private final ArduinoRemoteConnection target;
|
private final ArduinoRemoteConnection target;
|
||||||
private final String launchMode;
|
private final String launchMode;
|
||||||
private ArduinoBoard defaultBoard;
|
private ArduinoBoard defaultBoard;
|
||||||
private Properties properties;
|
private Properties boardProperties;
|
||||||
|
|
||||||
// for Makefile generation
|
// for Makefile generation
|
||||||
private Configuration templateConfig;
|
private Configuration templateConfig;
|
||||||
|
@ -116,7 +116,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
@Override
|
@Override
|
||||||
public synchronized void connectionChanged(RemoteConnectionChangeEvent event) {
|
public synchronized void connectionChanged(RemoteConnectionChangeEvent event) {
|
||||||
if (event.getConnection().equals(target.getRemoteConnection())) {
|
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 {
|
private synchronized Properties getBoardProperties() throws CoreException {
|
||||||
if (properties == null) {
|
if (boardProperties == null) {
|
||||||
ArduinoBoard board = getBoard();
|
ArduinoBoard board = getBoard();
|
||||||
ArduinoPlatform platform = board.getPlatform();
|
ArduinoPlatform platform = board.getPlatform();
|
||||||
|
|
||||||
// IDE generated properties
|
// IDE generated properties
|
||||||
properties = new Properties();
|
boardProperties = new Properties();
|
||||||
properties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$
|
boardProperties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$
|
||||||
properties.put("runtime.ide.version", "10608"); //$NON-NLS-1$ //$NON-NLS-2$
|
boardProperties.put("runtime.ide.version", "10608"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
properties.put("software", "ARDUINO"); //$NON-NLS-1$ //$NON-NLS-2$
|
boardProperties.put("software", "ARDUINO"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
properties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$
|
boardProperties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$
|
||||||
properties.put("build.path", "."); //$NON-NLS-1$ //$NON-NLS-2$
|
boardProperties.put("build.path", "."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
properties.put("build.core.path", //$NON-NLS-1$
|
boardProperties.put("build.core.path", //$NON-NLS-1$
|
||||||
platform.getInstallPath().resolve("cores").resolve("{build.core}").toString()); //$NON-NLS-1$ //$NON-NLS-2$
|
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$
|
boardProperties.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.variant.path", //$NON-NLS-1$
|
||||||
platform.getInstallPath().resolve("variants").resolve("{build.variant}").toString()); //$NON-NLS-1$ //$NON-NLS-2$
|
platform.getInstallPath().resolve("variants").resolve("{build.variant}").toString()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// Everyone seems to want to use arduino package tools
|
// Everyone seems to want to use arduino package tools
|
||||||
ArduinoPackage arduinoPackage = manager.getPackage("arduino"); //$NON-NLS-1$
|
ArduinoPackage arduinoPackage = manager.getPackage("arduino"); //$NON-NLS-1$
|
||||||
if (arduinoPackage != null) {
|
if (arduinoPackage != null) {
|
||||||
for (ArduinoTool tool : arduinoPackage.getLatestTools()) {
|
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()) {
|
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());
|
tool.getInstallPath().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,21 +183,21 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
ArduinoPlatform superPlatform = manager.getInstalledPlatform(segments[0],
|
ArduinoPlatform superPlatform = manager.getInstalledPlatform(segments[0],
|
||||||
platform.getArchitecture());
|
platform.getArchitecture());
|
||||||
if (superPlatform != null) {
|
if (superPlatform != null) {
|
||||||
properties.putAll(superPlatform.getPlatformProperties());
|
boardProperties.putAll(superPlatform.getPlatformProperties());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Platform
|
// Platform
|
||||||
properties.putAll(platform.getPlatformProperties());
|
boardProperties.putAll(platform.getPlatformProperties());
|
||||||
|
|
||||||
// Tools
|
// Tools
|
||||||
for (ToolDependency toolDep : platform.getToolsDependencies()) {
|
for (ToolDependency toolDep : platform.getToolsDependencies()) {
|
||||||
properties.putAll(toolDep.getTool().getToolProperties());
|
boardProperties.putAll(toolDep.getTool().getToolProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Board
|
// Board
|
||||||
properties.putAll(board.getBoardProperties());
|
boardProperties.putAll(board.getBoardProperties());
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
HierarchicalProperties menus = board.getMenus();
|
HierarchicalProperties menus = board.getMenus();
|
||||||
|
@ -213,15 +213,15 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value != null && !value.isEmpty()) {
|
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
|
// always do this in case the project changes names
|
||||||
properties.put("build.project_name", getProject().getName()); //$NON-NLS-1$
|
boardProperties.put("build.project_name", getProject().getName()); //$NON-NLS-1$
|
||||||
return properties;
|
return boardProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getBuildModel() throws CoreException {
|
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$
|
buildModel.put("libraries_path", pathString(ArduinoPreferences.getArduinoHome().resolve("libraries"))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// the recipes
|
// the recipes
|
||||||
properties.putAll(getProperties());
|
properties.putAll(getBoardProperties());
|
||||||
buildModel.put("build_path", properties.get("build.path")); //$NON-NLS-1$ //$NON-NLS-2$
|
buildModel.put("build_path", properties.get("build.path")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
buildModel.put("project_name", project.getName()); //$NON-NLS-1$
|
buildModel.put("project_name", project.getName()); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxCodeSize() throws CoreException {
|
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;
|
return sizeStr != null ? Integer.parseInt(sizeStr) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,13 +480,13 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxDataSize() throws CoreException {
|
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;
|
return sizeStr != null ? Integer.parseInt(sizeStr) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getUploadCommand(String serialPort) throws CoreException {
|
public String[] getUploadCommand(String serialPort) throws CoreException {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.putAll(getProperties());
|
properties.putAll(getBoardProperties());
|
||||||
|
|
||||||
String toolName = properties.getProperty("upload.tool"); //$NON-NLS-1$
|
String toolName = properties.getProperty("upload.tool"); //$NON-NLS-1$
|
||||||
ArduinoPlatform platform = getBoard().getPlatform();
|
ArduinoPlatform platform = getBoard().getPlatform();
|
||||||
|
@ -610,7 +610,7 @@ public class ArduinoBuildConfiguration extends CBuildConfiguration
|
||||||
|
|
||||||
ArduinoPlatform platform = getBoard().getPlatform();
|
ArduinoPlatform platform = getBoard().getPlatform();
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.putAll(getProperties());
|
properties.putAll(getBoardProperties());
|
||||||
|
|
||||||
// Overrides for scanner discovery
|
// Overrides for scanner discovery
|
||||||
properties.put("source_file", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
properties.put("source_file", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -15,6 +15,8 @@ public class NewArduinoProjectWizard extends NewWizard {
|
||||||
|
|
||||||
public NewArduinoProjectWizard() {
|
public NewArduinoProjectWizard() {
|
||||||
super(ARDUINO_TAG_ID);
|
super(ARDUINO_TAG_ID);
|
||||||
|
setWindowTitle("New Arduino C++ Project");
|
||||||
|
setTemplateSelectionPageTitle("Templates for New Arduino C++ Project");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue