1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Fix no binaries issue with Core Build.

When a second config is added, the binary parsers wasn't getting
reset so the new binary parser wasn't getting called.

Also cleans up the reset to remove the close that happens. Not sure
why it was needed so will keep an eye out for new bad behavior.

Change-Id: I0b4cb628829b138e2ceb3f08833649b90255648c
This commit is contained in:
Doug Schaefer 2016-11-02 14:30:27 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent c0d53c2cc9
commit b6d218a652
3 changed files with 27 additions and 15 deletions

View file

@ -787,21 +787,13 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
if (project != null) {
ICProject cproject = create(project);
if (cproject != null) {
// Let the function remove the children
// but it has the side of effect of removing the CProject also
// so we have to recall create again.
try {
cproject.close();
} catch (CModelException e) {
CCorePlugin.log(e);
if (binaryParsersMap.remove(project) != null) {
// Fired and ICElementDelta.PARSER_CHANGED
CElementDelta delta = new CElementDelta(getCModel());
delta.binaryParserChanged(cproject);
registerCModelDelta(delta);
fire(ElementChangedEvent.POST_CHANGE);
}
binaryParsersMap.remove(project);
// Fired and ICElementDelta.PARSER_CHANGED
CElementDelta delta = new CElementDelta(getCModel());
delta.binaryParserChanged(cproject);
registerCModelDelta(delta);
fire(ElementChangedEvent.POST_CHANGE);
}
}
}

View file

@ -48,6 +48,8 @@ import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
import org.eclipse.cdt.core.parser.IncludeExportPatterns;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.model.BinaryRunner;
import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.cdt.internal.core.parser.ParserSettings2;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IBuildConfiguration;
@ -246,6 +248,20 @@ public abstract class CBuildConfiguration extends PlatformObject
outputs.add(binary);
}
}
if (outputs.isEmpty()) {
// Give the binary runner a kick and try again.
BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(cproject);
runner.start();
runner.waitIfRunning();
for (IBinary binary : binaries.getBinaries()) {
if (binary.isExecutable() && outputPath.isPrefixOf(binary.getPath())) {
outputs.add(binary);
}
}
}
return outputs.toArray(new IBinary[outputs.size()]);
}

View file

@ -161,6 +161,9 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
synchronized (configs) {
configs.put(buildConfig, cConfig);
}
// reset the binary parsers
CModelManager.getDefault().resetBinaryParser(buildConfig.getProject());
}
@Override
@ -193,7 +196,8 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
config = provider.getCBuildConfiguration(buildConfig, configName);
if (config != null) {
configs.put(buildConfig, config);
// Also make sure we reset the binary parser cache for the new config
// Also make sure we reset the binary parser cache
// for the new config
resetBinaryParser = true;
}
}