Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDoug Schaefer2017-11-27 19:46:06 +0000
committerDoug Schaefer2017-11-27 19:46:06 +0000
commit0ed7b10dea94cf37c6da0593ccfb94002b5385e8 (patch)
tree6c6a4b50b68330ebe3b40cda458798b3b62c56a4 /build
parent68b441c16d6e30424177193daf048bd693deb20f (diff)
downloadorg.eclipse.cdt-0ed7b10dea94cf37c6da0593ccfb94002b5385e8.tar.gz
org.eclipse.cdt-0ed7b10dea94cf37c6da0593ccfb94002b5385e8.tar.xz
org.eclipse.cdt-0ed7b10dea94cf37c6da0593ccfb94002b5385e8.zip
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
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java19
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java1
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties1
-rw-r--r--build/org.eclipse.cdt.make.ui/plugin.xml2
4 files changed, 22 insertions, 1 deletions
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index 8be3ee22b21..a666c3d68b8 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -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$
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java
index 26f166eae40..e07d1e9ef65 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java
@@ -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 {
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties
index 09b418b25be..a0aead98df3 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties
@@ -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
diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml
index 6f3fb11cb0d..76e21adb9d2 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.xml
+++ b/build/org.eclipse.cdt.make.ui/plugin.xml
@@ -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 &apos;make&apos; build tool.
+ (Experimental) Create a new project that builds with the&apos;make&apos; build tool using CDT&apos;s new Core Build System.
</description>
<tagReference
id="org.eclipse.cdt.ui.cdtTag">

Back to the top