mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Apply CMake changes from Bug 530673 to Meson
- Fix issue with Meson and changing toolchains since Meson is based on CMake plug-ins - Cleaned up add and remove of toolchain files and handling of when a toolchain changes for a config Change-Id: I147a30454c69e3d8d86fc50c561a1667ddfb5df3
This commit is contained in:
parent
3405063203
commit
e31e23bb4e
6 changed files with 36 additions and 17 deletions
|
@ -18,6 +18,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CommandLauncherManager;
|
||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
|
@ -26,6 +27,7 @@ import org.eclipse.cdt.core.build.CBuildConfiguration;
|
|||
import org.eclipse.cdt.core.build.ICBuildCommandLauncher;
|
||||
import org.eclipse.cdt.core.build.IToolChain;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.meson.core.Activator;
|
||||
import org.eclipse.cdt.meson.core.IMesonConstants;
|
||||
|
@ -91,6 +93,10 @@ public class MesonBuildConfiguration extends CBuildConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
public IMesonToolChainFile getToolChainFile() {
|
||||
return toolChainFile;
|
||||
}
|
||||
|
||||
private boolean isLocal() throws CoreException {
|
||||
IToolChain toolchain = getToolChain();
|
||||
return Platform.getOS().equals(toolchain.getProperty(IToolChain.ATTR_OS))
|
||||
|
@ -315,5 +321,4 @@ public class MesonBuildConfiguration extends CBuildConfiguration {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class MesonBuildConfigurationProvider 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;
|
||||
|
||||
|
@ -69,7 +69,19 @@ public class MesonBuildConfigurationProvider implements ICBuildConfigurationProv
|
|||
// No valid combinations
|
||||
return null;
|
||||
}
|
||||
return new MesonBuildConfiguration(config, name);
|
||||
MesonBuildConfiguration mesonConfig = new MesonBuildConfiguration(config, name);
|
||||
IMesonToolChainFile tcFile = mesonConfig.getToolChainFile();
|
||||
IToolChain toolChain = mesonConfig.getToolChain();
|
||||
if (toolChain == null || tcFile == null) {
|
||||
// config not complete?
|
||||
return null;
|
||||
}
|
||||
if (!toolChain.equals(tcFile.getToolChain())) {
|
||||
// toolchain changed
|
||||
return new MesonBuildConfiguration(config, name, tcFile.getToolChain(), tcFile,
|
||||
mesonConfig.getLaunchMode());
|
||||
}
|
||||
return mesonConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,6 +102,7 @@ public class MesonBuildConfigurationProvider implements ICBuildConfigurationProv
|
|||
Collection<IMesonToolChainFile> files = manager.getToolChainFilesMatching(properties);
|
||||
if (!files.isEmpty()) {
|
||||
file = files.iterator().next();
|
||||
toolChain = file.getToolChain();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public class MesonToolChainManager implements IMesonToolChainManager {
|
|||
SafeRunner.run(new ISafeRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
listener.handleCMakeToolChainEvent(event);
|
||||
listener.handleMesonToolChainEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,6 +14,6 @@ package org.eclipse.cdt.meson.core;
|
|||
*/
|
||||
public interface IMesonToolChainListener {
|
||||
|
||||
void handleCMakeToolChainEvent(MesonToolChainEvent event);
|
||||
void handleMesonToolChainEvent(MesonToolChainEvent event);
|
||||
|
||||
}
|
||||
|
|
|
@ -104,11 +104,11 @@ public class MesonPreferencePage extends PreferencePage implements IWorkbenchPre
|
|||
WizardDialog dialog = new WizardDialog(getShell(), wizard);
|
||||
if (dialog.open() == Window.OK) {
|
||||
IMesonToolChainFile file = wizard.getNewFile();
|
||||
if (filesToRemove.containsKey(file.getPath())) {
|
||||
filesToRemove.remove(file.getPath());
|
||||
} else {
|
||||
filesToAdd.put(file.getPath(), file);
|
||||
IMesonToolChainFile oldFile = manager.getToolChainFile(file.getPath());
|
||||
if (oldFile != null) {
|
||||
filesToRemove.put(oldFile.getPath(), oldFile);
|
||||
}
|
||||
filesToAdd.put(file.getPath(), file);
|
||||
updateTable();
|
||||
}
|
||||
}
|
||||
|
@ -166,27 +166,27 @@ public class MesonPreferencePage extends PreferencePage implements IWorkbenchPre
|
|||
files.put(file.getPath(), file);
|
||||
}
|
||||
|
||||
for (IMesonToolChainFile file : filesToAdd.values()) {
|
||||
files.put(file.getPath(), file);
|
||||
}
|
||||
|
||||
for (IMesonToolChainFile file : filesToRemove.values()) {
|
||||
files.remove(file.getPath());
|
||||
}
|
||||
|
||||
for (IMesonToolChainFile file : filesToAdd.values()) {
|
||||
files.put(file.getPath(), file);
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
for (IMesonToolChainFile file : filesToAdd.values()) {
|
||||
manager.addToolChainFile(file);
|
||||
}
|
||||
|
||||
for (IMesonToolChainFile file : filesToRemove.values()) {
|
||||
manager.removeToolChainFile(file);
|
||||
}
|
||||
|
||||
for (IMesonToolChainFile file : filesToAdd.values()) {
|
||||
manager.addToolChainFile(file);
|
||||
}
|
||||
|
||||
filesToAdd.clear();
|
||||
filesToRemove.clear();
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ public class NewMesonToolChainFilePage extends WizardPage {
|
|||
IMesonToolChainFile file = manager.newToolChainFile(Paths.get(pathText.getText()));
|
||||
|
||||
IToolChain tc = toolchains[tcCombo.getSelectionIndex()];
|
||||
|
||||
file.setProperty(ICBuildConfiguration.TOOLCHAIN_TYPE, tc.getTypeId());
|
||||
file.setProperty(ICBuildConfiguration.TOOLCHAIN_ID, tc.getId());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue