mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Bug 536884 - Removing header cache should cause ScannerInfo refresh
- add a new IToolChain property "cdt.needScannerRefresh" that is set if scanner info needs to be refreshed - for a Container build, turn the property on in ContainerGCCToolChain startBuildProcess() if the Container headers for the toolchain's have been deleted - in CBuildConfiguration processLine(), look for the toolchain property when looking to see if scannerinfo should be calculated - in CBuildConfiguration, turn the toolchain property off in shutdown() Change-Id: I67a3537d1e2967dc15b66a1c37abda1ae8f78bff
This commit is contained in:
parent
a394557c60
commit
1a8f399b8b
3 changed files with 48 additions and 4 deletions
|
@ -106,6 +106,8 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
IConsoleParser2, IElementChangedListener {
|
IConsoleParser2, IElementChangedListener {
|
||||||
|
|
||||||
private static final String LAUNCH_MODE = "cdt.launchMode"; //$NON-NLS-1$
|
private static final String LAUNCH_MODE = "cdt.launchMode"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String NEED_REFRESH = "cdt.needScannerRefresh"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final List<String> DEFAULT_COMMAND = new ArrayList<>(0);
|
private static final List<String> DEFAULT_COMMAND = new ArrayList<>(0);
|
||||||
|
|
||||||
|
@ -470,8 +472,15 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IToolChain tc = getToolChain();
|
||||||
|
if (tc instanceof IToolChain2) {
|
||||||
|
// we may have a Container build...default to Path based on command
|
||||||
|
return Paths.get(command);
|
||||||
|
}
|
||||||
} catch (InvalidPathException e) {
|
} catch (InvalidPathException e) {
|
||||||
// ignore
|
// ignore
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -937,6 +946,15 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
IResource[] resources = toolChain.getResourcesFromCommand(command, getBuildDirectoryURI());
|
IResource[] resources = toolChain.getResourcesFromCommand(command, getBuildDirectoryURI());
|
||||||
if (resources != null && resources.length > 0) {
|
if (resources != null && resources.length > 0) {
|
||||||
List<String> commandStrings = toolChain.stripCommand(command, resources);
|
List<String> commandStrings = toolChain.stripCommand(command, resources);
|
||||||
|
|
||||||
|
boolean needScannerRefresh = false;
|
||||||
|
|
||||||
|
if (toolChain instanceof IToolChain2) {
|
||||||
|
String needRefresh = toolChain.getProperty(NEED_REFRESH);
|
||||||
|
if ("true".equals(needRefresh)) { //$NON-NLS-1$
|
||||||
|
needScannerRefresh = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (IResource resource : resources) {
|
for (IResource resource : resources) {
|
||||||
loadScannerInfoCache();
|
loadScannerInfoCache();
|
||||||
|
@ -951,7 +969,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
hasCommand = false;
|
hasCommand = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasCommand) {
|
if (!hasCommand || needScannerRefresh) {
|
||||||
Path commandPath = findCommand(command.get(0));
|
Path commandPath = findCommand(command.get(0));
|
||||||
if (commandPath != null) {
|
if (commandPath != null) {
|
||||||
command.set(0, commandPath.toString());
|
command.set(0, commandPath.toString());
|
||||||
|
@ -1058,6 +1076,15 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
IResource[] resources = toolChain.getResourcesFromCommand(command, getBuildDirectoryURI());
|
IResource[] resources = toolChain.getResourcesFromCommand(command, getBuildDirectoryURI());
|
||||||
if (resources != null && resources.length > 0) {
|
if (resources != null && resources.length > 0) {
|
||||||
List<String> commandStrings = toolChain.stripCommand(command, resources);
|
List<String> commandStrings = toolChain.stripCommand(command, resources);
|
||||||
|
|
||||||
|
boolean needScannerRefresh = false;
|
||||||
|
|
||||||
|
if (toolChain instanceof IToolChain2) {
|
||||||
|
String needRefresh = toolChain.getProperty(NEED_REFRESH);
|
||||||
|
if ("true".equals(needRefresh)) { //$NON-NLS-1$
|
||||||
|
needScannerRefresh = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (IResource resource : resources) {
|
for (IResource resource : resources) {
|
||||||
loadScannerInfoCache();
|
loadScannerInfoCache();
|
||||||
|
@ -1072,7 +1099,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
hasCommand = false;
|
hasCommand = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasCommand) {
|
if (!hasCommand || needScannerRefresh) {
|
||||||
Path commandPath = findCommand(command.get(0));
|
Path commandPath = findCommand(command.get(0));
|
||||||
if (commandPath != null) {
|
if (commandPath != null) {
|
||||||
command.set(0, commandPath.toString());
|
command.set(0, commandPath.toString());
|
||||||
|
@ -1117,6 +1144,9 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// TODO persist changes
|
// TODO persist changes
|
||||||
|
|
||||||
|
// Bug 536884 - Turn off any manual future scanner refresh
|
||||||
|
toolChain.setProperty(NEED_REFRESH, "false"); //$NON-NLS-1$
|
||||||
|
|
||||||
// Trigger a reindex if anything changed
|
// Trigger a reindex if anything changed
|
||||||
// TODO be more surgical
|
// TODO be more surgical
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher;
|
import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class ContainerCommandLauncherFactory
|
public class ContainerCommandLauncherFactory
|
||||||
implements ICommandLauncherFactory, ICommandLauncherFactory2 {
|
implements ICommandLauncherFactory, ICommandLauncherFactory2 {
|
||||||
|
|
||||||
|
@ -349,8 +350,12 @@ public class ContainerCommandLauncherFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// TODO: fix this logic in future so it can be done using a call
|
// Bug 536884 - if no include entries, check if the copied
|
||||||
// rather than using a property of the toolchain
|
// header files have been erased by the end-user in which
|
||||||
|
// case mark that scanner info needs refreshing (only way
|
||||||
|
// the headers will be recopied)
|
||||||
|
// TODO: fix this in a minor release to be an additional method
|
||||||
|
// that can be registered by the removal of the header files
|
||||||
IPath pluginPath = Platform
|
IPath pluginPath = Platform
|
||||||
.getStateLocation(Platform
|
.getStateLocation(Platform
|
||||||
.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
|
.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.nio.file.InvalidPathException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -641,6 +642,14 @@ public class ContainerGCCToolChain extends PlatformObject
|
||||||
ICommandLauncher launcher = CommandLauncherManager.getInstance()
|
ICommandLauncher launcher = CommandLauncherManager.getInstance()
|
||||||
.getCommandLauncher(config);
|
.getCommandLauncher(config);
|
||||||
|
|
||||||
|
// Bug 536884 - following is a kludge to allow us to check if the
|
||||||
|
// Container headers have been deleted by the user in which case
|
||||||
|
// we need to re-perform scanner info collection and copy headers
|
||||||
|
// to the host.
|
||||||
|
// TODO: make this cleaner
|
||||||
|
CommandLauncherManager.getInstance().processIncludePaths(config,
|
||||||
|
Collections.emptyList());
|
||||||
|
|
||||||
launcher.setProject(config.getBuildConfiguration().getProject());
|
launcher.setProject(config.getBuildConfiguration().getProject());
|
||||||
if (launcher instanceof ICBuildCommandLauncher) {
|
if (launcher instanceof ICBuildCommandLauncher) {
|
||||||
((ICBuildCommandLauncher) launcher).setBuildConfiguration(config);
|
((ICBuildCommandLauncher) launcher).setBuildConfiguration(config);
|
||||||
|
|
Loading…
Add table
Reference in a new issue