mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-11 11:05:24 +02:00
Allow participants in CMake toolchain file management.
For ESP8266, I want to auto discover the toolchains and friends installed into Eclipse. I also want to handle toolchain files manually added by the user. Adding providers and listeners. Adds prefix to gcc commands. Makes CMake config provider for Local only. ESP8266 has it's own launch config. Add build output to the build config model. And fix up output folders. Change-Id: I5aa178ff23e27dc24e3efe8e79de2e3a8d692cde
This commit is contained in:
parent
22cb5e0d7c
commit
37ebb67c2a
19 changed files with 297 additions and 45 deletions
|
@ -73,7 +73,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
|||
this.version = version;
|
||||
this.name = id + " - " + version; //$NON-NLS-1$
|
||||
this.path = path;
|
||||
this.prefix = prefix;
|
||||
this.prefix = prefix != null ? prefix : "";
|
||||
|
||||
if (path != null) {
|
||||
StringBuilder pathString = new StringBuilder();
|
||||
|
@ -393,15 +393,15 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
|||
|
||||
@Override
|
||||
public String[] getCompileCommands() {
|
||||
return new String[] { "gcc", "g++", "clang", "clang++", "cc", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||
return new String[] { prefix + "gcc", prefix + "g++", prefix + "clang", prefix + "clang++", prefix + "cc", prefix + "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCompileCommands(ILanguage language) {
|
||||
if (GPPLanguage.ID.equals(language.getId())) {
|
||||
return new String[] { "g++", "clang++", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
return new String[] { prefix + "g++", prefix + "clang++", prefix + "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
} else if (GCCLanguage.ID.equals(language.getId())) {
|
||||
return new String[] { "gcc", "clang", "cc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
return new String[] { prefix + "gcc", prefix + "clang", prefix + "cc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
} else {
|
||||
return new String[0];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="toolChainProvider" name="CMake ToolChain File Provider" schema="schema/toolChainProvider.exsd"/>
|
||||
<extension
|
||||
id="cmakeNature"
|
||||
point="org.eclipse.core.resources.natures">
|
||||
|
|
102
build/org.eclipse.cdt.cmake.core/schema/toolChainProvider.exsd
Normal file
102
build/org.eclipse.cdt.cmake.core/schema/toolChainProvider.exsd
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.cmake.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.cmake.core" id="toolChainProvider" name="CMake ToolChain File Provider"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</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">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.cmake.core.ICMakeToolChainProvider"/>
|
||||
</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>
|
|
@ -22,7 +22,9 @@ import org.eclipse.core.resources.IFolder;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
|
||||
import org.eclipse.tools.templates.freemarker.SourceRoot;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
@ -68,6 +70,9 @@ public class CMakeProjectGenerator extends FMProjectGenerator {
|
|||
} else {
|
||||
entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
|
||||
}
|
||||
|
||||
entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath(),
|
||||
new IPath[] { new Path("**/CMakeFiles/**") }));
|
||||
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
|
||||
monitor);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*******************************************************************************
|
||||
* 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.cmake.core;
|
||||
|
||||
/**
|
||||
* Event occured with CMake ToolChain Files, either added or removed.
|
||||
*/
|
||||
public class CMakeToolChainEvent {
|
||||
|
||||
/**
|
||||
* ToolChain file has been added.
|
||||
*/
|
||||
public static final int ADDED = 1;
|
||||
|
||||
/**
|
||||
* ToolChain File has been removed.
|
||||
*/
|
||||
public static final int REMOVED = 2;
|
||||
|
||||
private final int type;
|
||||
private final ICMakeToolChainFile toolChainFile;
|
||||
|
||||
public CMakeToolChainEvent(int type, ICMakeToolChainFile toolChainFile) {
|
||||
this.type = type;
|
||||
this.toolChainFile = toolChainFile;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ICMakeToolChainFile getToolChainFile() {
|
||||
return toolChainFile;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/*******************************************************************************
|
||||
* 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.cmake.core;
|
||||
|
||||
/**
|
||||
* Listener for toolchain events.
|
||||
*/
|
||||
public interface ICMakeToolChainListener {
|
||||
|
||||
void handleCMakeToolChainEvent(CMakeToolChainEvent event);
|
||||
|
||||
}
|
|
@ -30,4 +30,8 @@ public interface ICMakeToolChainManager {
|
|||
|
||||
Collection<ICMakeToolChainFile> getToolChainFiles();
|
||||
|
||||
void addListener(ICMakeToolChainListener listener);
|
||||
|
||||
void removeListener(ICMakeToolChainListener listener);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* 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.cmake.core;
|
||||
|
||||
public interface ICMakeToolChainProvider {
|
||||
|
||||
void init(ICMakeToolChainManager manager);
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
// * Copyright (c) 2015, 2016 QNX Software Systems and others.
|
||||
* Copyright (c) 2015, 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
|
||||
|
@ -28,10 +28,13 @@ import org.eclipse.cdt.core.build.IToolChain;
|
|||
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.IFolder;
|
||||
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.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
@ -96,7 +99,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
if (!Files.exists(buildDir.resolve("Makefile"))) { //$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.
|
||||
// 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)) {
|
||||
|
@ -127,7 +131,8 @@ 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.
|
||||
// TODO need to figure out which builder to call. Hardcoding to
|
||||
// make for now.
|
||||
List<String> command = Arrays.asList("make"); //$NON-NLS-1$
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
|
||||
setBuildEnvironment(processBuilder.environment());
|
||||
|
|
|
@ -55,7 +55,7 @@ public class CMakeLaunchConfigurationDelegate extends LaunchConfigurationTargete
|
|||
IToolChain toolChain = tcs.iterator().next();
|
||||
|
||||
IProject project = getProject(configuration);
|
||||
ICBuildConfiguration config = configManager.createBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
|
||||
ICBuildConfiguration config = configManager.getBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
|
||||
|
||||
if (config != null) {
|
||||
IProjectDescription desc = project.getDescription();
|
||||
|
|
|
@ -28,35 +28,11 @@ import org.eclipse.launchbar.core.target.ILaunchTargetManager;
|
|||
|
||||
public class CMakeLaunchConfigurationProvider extends AbstractLaunchConfigProvider {
|
||||
|
||||
private final ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
|
||||
private final IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
|
||||
|
||||
private Map<IProject, ILaunchConfiguration> configs = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
|
||||
if (ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String os = target.getAttribute(ILaunchTarget.ATTR_OS, ""); //$NON-NLS-1$
|
||||
if (os.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, ""); //$NON-NLS-1$
|
||||
if (arch.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.put(IToolChain.ATTR_OS, os);
|
||||
properties.put(IToolChain.ATTR_ARCH, arch);
|
||||
if (manager.getToolChainFilesMatching(properties).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !tcManager.getToolChainsMatching(properties).isEmpty();
|
||||
return ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,12 +13,22 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.cdt.cmake.core.CMakeToolChainEvent;
|
||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainListener;
|
||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
|
||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainProvider;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.ISafeRunnable;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.SafeRunner;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
@ -30,6 +40,8 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
|
|||
private static final String N = "n"; //$NON-NLS-1$
|
||||
private static final String PATH = "__path"; //$NON-NLS-1$
|
||||
|
||||
private final List<ICMakeToolChainListener> listeners = new LinkedList<>();
|
||||
|
||||
private Preferences getPreferences() {
|
||||
return InstanceScope.INSTANCE.getNode(Activator.getId()).node("cmakeToolchains"); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -57,6 +69,19 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
|
|||
}
|
||||
|
||||
// TODO discovery
|
||||
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.getId(),
|
||||
"toolChainProvider"); //$NON-NLS-1$
|
||||
for (IConfigurationElement element : point.getConfigurationElements()) {
|
||||
if (element.getName().equals("provider")) { //$NON-NLS-1$
|
||||
try {
|
||||
ICMakeToolChainProvider provider = (ICMakeToolChainProvider) element
|
||||
.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
provider.init(this);
|
||||
} catch (ClassCastException | CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,11 +117,14 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
|
|||
} catch (BackingStoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
|
||||
fireEvent(new CMakeToolChainEvent(CMakeToolChainEvent.ADDED, file));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeToolChainFile(ICMakeToolChainFile file) {
|
||||
init();
|
||||
fireEvent(new CMakeToolChainEvent(CMakeToolChainEvent.REMOVED, file));
|
||||
files.remove(file.getPath());
|
||||
|
||||
String n = ((CMakeToolChainFile) file).n;
|
||||
|
@ -143,4 +171,30 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
|
|||
return matches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(ICMakeToolChainListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(ICMakeToolChainListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
private void fireEvent(CMakeToolChainEvent event) {
|
||||
for (ICMakeToolChainListener listener : listeners) {
|
||||
SafeRunner.run(new ISafeRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
listener.handleCMakeToolChainEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable exception) {
|
||||
Activator.log(exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<extension
|
||||
point="org.eclipse.ui.preferencePages">
|
||||
<page
|
||||
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
|
||||
class="org.eclipse.cdt.cmake.ui.internal.CMakePreferencePage"
|
||||
id="org.eclipse.cdt.cmake.ui.page1"
|
||||
name="%cmake.preferences.name">
|
||||
|
|
|
@ -184,6 +184,9 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
|
|||
manager.removeToolChainFile(file);
|
||||
}
|
||||
|
||||
filesToAdd.clear();
|
||||
filesToRemove.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,10 @@ public class BinaryRunner {
|
|||
*/
|
||||
public void waitIfRunning() {
|
||||
try {
|
||||
runnerJob.join();
|
||||
Job currentJob = Job.getJobManager().currentJob();
|
||||
if (currentJob != null && !currentJob.equals(runnerJob)) {
|
||||
runnerJob.join();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ import org.eclipse.cdt.core.IMarkerGenerator;
|
|||
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.IBinaryContainer;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
@ -58,6 +60,7 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -174,15 +177,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
|||
}
|
||||
IFolder buildFolder = buildRootFolder.getFolder(name);
|
||||
if (!buildFolder.exists()) {
|
||||
buildFolder.create(true, true, new NullProgressMonitor());
|
||||
buildFolder.setDerived(true, null);
|
||||
ICProject cproject = CoreModel.getDefault().create(getProject());
|
||||
IOutputEntry output = CoreModel.newOutputEntry(buildFolder.getFullPath());
|
||||
IPathEntry[] oldEntries = cproject.getRawPathEntries();
|
||||
IPathEntry[] newEntries = new IPathEntry[oldEntries.length + 1];
|
||||
System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
|
||||
newEntries[oldEntries.length] = output;
|
||||
cproject.setRawPathEntries(newEntries, null);
|
||||
buildFolder.create(IResource.FORCE | IResource.DERIVED, true, new NullProgressMonitor());
|
||||
}
|
||||
|
||||
return buildFolder;
|
||||
|
@ -200,6 +195,20 @@ public abstract class CBuildConfiguration extends PlatformObject
|
|||
CCorePlugin.getDefault().getBuildEnvironmentManager().setEnvironment(env, config, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinary[] getBuildOutput() throws CoreException {
|
||||
ICProject cproject = CoreModel.getDefault().create(config.getProject());
|
||||
IBinaryContainer binaries = cproject.getBinaryContainer();
|
||||
IPath outputPath = getBuildContainer().getFullPath();
|
||||
List<IBinary> outputs = new ArrayList<>();
|
||||
for (IBinary binary : binaries.getBinaries()) {
|
||||
if (binary.isExecutable() && outputPath.isPrefixOf(binary.getPath())) {
|
||||
outputs.add(binary);
|
||||
}
|
||||
}
|
||||
return outputs.toArray(new IBinary[outputs.size()]);
|
||||
}
|
||||
|
||||
public void setActive(IProgressMonitor monitor) throws CoreException {
|
||||
IProject project = config.getProject();
|
||||
if (config.equals(project.getActiveBuildConfig())) {
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.eclipse.cdt.core.build;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
|
@ -59,4 +60,20 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
|
|||
|
||||
void clean(IConsole console, IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
* @return build output IContainer
|
||||
* @throws CoreException
|
||||
* @since 6.1
|
||||
*/
|
||||
default IBinary[] getBuildOutput() throws CoreException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param env
|
||||
* @since 6.1
|
||||
*/
|
||||
default void setBuildEnvironment(Map<String, String> env) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public interface ICBuildConfigurationManager {
|
|||
* @throws CoreException
|
||||
* @since 6.1
|
||||
*/
|
||||
ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
|
||||
ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
|
||||
IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -215,7 +215,7 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
|
|||
}
|
||||
|
||||
@Override
|
||||
public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
|
||||
public ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain,
|
||||
String launchMode, IProgressMonitor monitor) throws CoreException {
|
||||
ICBuildConfigurationProvider provider = getProvider(project);
|
||||
if (provider != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue