diff options
author | Doug Schaefer | 2018-02-02 20:38:23 +0000 |
---|---|---|
committer | Doug Schaefer | 2018-02-04 01:33:56 +0000 |
commit | 5b29b5b5d8714a82b9d9667c7e61d44a554bec76 (patch) | |
tree | 385e5fef4503997a52ad65a5cb70563d37b68f44 /build | |
parent | e8f619c3447ea7f47df74680660151fb07da3c4a (diff) | |
download | org.eclipse.cdt-5b29b5b5d8714a82b9d9667c7e61d44a554bec76.tar.gz org.eclipse.cdt-5b29b5b5d8714a82b9d9667c7e61d44a554bec76.tar.xz org.eclipse.cdt-5b29b5b5d8714a82b9d9667c7e61d44a554bec76.zip |
Bug 530673 Fix issue with CMake and changing toolchains.
Cleaned up add and remove of toolchain files, handling of when
a toolchain changes for a config, and the launch bar tracker to
be more accurate with toolchains.
Change-Id: I1a1efdf08a5f47058552c85404fe8d602d158e73
Diffstat (limited to 'build')
4 files changed, 33 insertions, 15 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 a666c3d68b8..fbaaa6c81ce 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 @@ -81,6 +81,10 @@ public class CMakeBuildConfiguration extends CBuildConfiguration { } } + public ICMakeToolChainFile getToolChainFile() { + return toolChainFile; + } + private void saveToolChainFile() { Preferences settings = getSettings(); settings.put(TOOLCHAIN_FILE, toolChainFile.getPath().toString()); diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java index 2ffd0864ed1..b3e6b350156 100644 --- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java +++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java @@ -37,7 +37,8 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv } @Override - public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name) throws CoreException { + public synchronized ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name) + throws CoreException { if (config.getName().equals(IBuildConfiguration.DEFAULT_CONFIG_NAME)) { IToolChain toolChain = null; @@ -66,7 +67,20 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv return null; } } else { - return new CMakeBuildConfiguration(config, name); + CMakeBuildConfiguration cmakeConfig = new CMakeBuildConfiguration(config, name); + ICMakeToolChainFile tcFile = cmakeConfig.getToolChainFile(); + IToolChain toolChain = cmakeConfig.getToolChain(); + if (toolChain == null || tcFile == null) { + // config not complete? + return null; + } + if (!toolChain.equals(tcFile.getToolChain())) { + // toolchain changed + return new CMakeBuildConfiguration(config, name, tcFile.getToolChain(), tcFile, + cmakeConfig.getLaunchMode()); + } else { + return cmakeConfig; + } } } 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 a0aead98df3..db58245796d 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,6 +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_NoToolchainFile=No CMake 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.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java index 7cc58fbb996..6a6275747db 100644 --- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java +++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java @@ -100,11 +100,11 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre WizardDialog dialog = new WizardDialog(getShell(), wizard); if (dialog.open() == Window.OK) { ICMakeToolChainFile file = wizard.getNewFile(); - if (filesToRemove.containsKey(file.getPath())) { - filesToRemove.remove(file.getPath()); - } else { - filesToAdd.put(file.getPath(), file); + ICMakeToolChainFile oldFile = manager.getToolChainFile(file.getPath()); + if (oldFile != null) { + filesToRemove.put(oldFile.getPath(), oldFile); } + filesToAdd.put(file.getPath(), file); updateTable(); } } @@ -162,27 +162,27 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre files.put(file.getPath(), file); } - for (ICMakeToolChainFile file : filesToAdd.values()) { - files.put(file.getPath(), file); - } - for (ICMakeToolChainFile file : filesToRemove.values()) { files.remove(file.getPath()); } + for (ICMakeToolChainFile file : filesToAdd.values()) { + files.put(file.getPath(), file); + } + return files; } @Override public boolean performOk() { - for (ICMakeToolChainFile file : filesToAdd.values()) { - manager.addToolChainFile(file); - } - for (ICMakeToolChainFile file : filesToRemove.values()) { manager.removeToolChainFile(file); } + for (ICMakeToolChainFile file : filesToAdd.values()) { + manager.addToolChainFile(file); + } + filesToAdd.clear(); filesToRemove.clear(); |