mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 527818 - Clean up handling of missing toolchain file
If we're building for non-local targets we need a toolchain file. Print out an error message when it's missing at build time. Recover when one is added. Also a rider that makes sure the Makefile projects are marked experimental. Change-Id: I0c295dc5b3d71a04c60c3385ce790553f172859d
This commit is contained in:
parent
68b441c16d
commit
0ed7b10dea
4 changed files with 22 additions and 1 deletions
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.build.CBuildConfiguration;
|
|||
import org.eclipse.cdt.core.build.IToolChain;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.utils.Platform;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -90,6 +91,12 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isLocal() throws CoreException {
|
||||
IToolChain toolchain = getToolChain();
|
||||
return Platform.getOS().equals(toolchain.getProperty(IToolChain.ATTR_OS))
|
||||
&& Platform.getOSArch().equals(toolchain.getProperty(IToolChain.ATTR_ARCH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject[] build(int kind, Map<String, String> args, IConsole console, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
|
@ -109,6 +116,18 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
|
||||
outStream.write(String.format(Messages.CMakeBuildConfiguration_BuildingIn, buildDir.toString()));
|
||||
|
||||
// Make sure we have a toolchain file if cross
|
||||
if (toolChainFile == null && !isLocal()) {
|
||||
ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
|
||||
toolChainFile = manager.getToolChainFileFor(getToolChain());
|
||||
|
||||
if (toolChainFile == null) {
|
||||
// error
|
||||
console.getErrorStream().write(Messages.CMakeBuildConfiguration_NoToolchainFile);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
boolean runCMake;
|
||||
switch (generator) {
|
||||
case "Ninja": //$NON-NLS-1$
|
||||
|
|
|
@ -16,6 +16,7 @@ public class Messages extends NLS {
|
|||
public static String CMakeBuildConfiguration_BuildingComplete;
|
||||
public static String CMakeBuildConfiguration_Cleaning;
|
||||
public static String CMakeBuildConfiguration_NotFound;
|
||||
public static String CMakeBuildConfiguration_NoToolchainFile;
|
||||
public static String CMakeBuildConfiguration_ProcCompCmds;
|
||||
public static String CMakeBuildConfiguration_ProcCompJson;
|
||||
static {
|
||||
|
|
|
@ -10,5 +10,6 @@ CMakeBuildConfiguration_BuildingIn=Building in: %s\n
|
|||
CMakeBuildConfiguration_BuildingComplete=Build complete: %s\n
|
||||
CMakeBuildConfiguration_Cleaning=Cleaning %s
|
||||
CMakeBuildConfiguration_NotFound=CMakeFiles not found. Assuming clean.
|
||||
CMakeBuildConfiguration_NoToolchainFile=No toolchain file found for this target.
|
||||
CMakeBuildConfiguration_ProcCompCmds=Processing compile commands %s
|
||||
CMakeBuildConfiguration_ProcCompJson=Processing compile_commands.json
|
||||
|
|
|
@ -637,7 +637,7 @@
|
|||
label="Makefile Project"
|
||||
wizard="org.eclipse.cdt.make.internal.ui.wizards.NewMakefileProjectWizard">
|
||||
<description>
|
||||
Create a new project that builds with the 'make' build tool.
|
||||
(Experimental) Create a new project that builds with the'make' build tool using CDT's new Core Build System.
|
||||
</description>
|
||||
<tagReference
|
||||
id="org.eclipse.cdt.ui.cdtTag">
|
||||
|
|
Loading…
Add table
Reference in a new issue