mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 389536 - NPE in AdditionalInput for projects containing files with
custom build-steps. Tools for custom build steps normally don't belong to a tool chain. We assume now that the inputs don't need to be rebuilt rather than provoking a NPE. The actual fix is similiar to the patch added to the mentioned bug originally been created by Piotr Aniola. It has been extended with a test case demonstrating the problem (and the fix). Change-Id: I5f17248cbe8e84779144bb5f1873c5b9456baa16 Signed-off-by: Sebastian Bauer <mail@sebastianbauer.info> Reviewed-on: https://git.eclipse.org/r/38206 Tested-by: Hudson CI Reviewed-by: Elena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
parent
c631da77c6
commit
accfa032aa
2 changed files with 26 additions and 1 deletions
|
@ -2368,6 +2368,30 @@ public class BuildDescriptionModelTests extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testDesRebuildStateWithCustomBuildStep() {
|
||||
/* This test captures Bug 389536 */
|
||||
IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.gnu30.exe");
|
||||
try {
|
||||
CCProjectNature.addCCNature(project, null);
|
||||
} catch (CoreException e1) {
|
||||
fail("fail to add CC nature");
|
||||
}
|
||||
|
||||
IFile testYFile = ManagedBuildTestHelper.createFile(project, "test.y");
|
||||
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||
IManagedProject mProj = info.getManagedProject();
|
||||
IConfiguration cfg = mProj.getConfigurations()[0];
|
||||
|
||||
IResourceConfiguration testYCfg = cfg.createResourceConfiguration(testYFile);
|
||||
ITool bisonTool = testYCfg.createTool(null, "tool.bison", "Bison", false);
|
||||
bisonTool.setCustomBuildStep(true);
|
||||
IInputType bisonInputType = bisonTool.createInputType(null, "inputtype.bison", "Bison Inputfiles", false);
|
||||
bisonInputType.createAdditionalInput("");
|
||||
cfg.setRebuildState(false);
|
||||
assertFalse(cfg.needsRebuild());
|
||||
}
|
||||
|
||||
private void doTestTool(ITool tool){
|
||||
IBuildObject obj = tool.getParent();
|
||||
IConfiguration cfg;
|
||||
|
|
|
@ -342,7 +342,8 @@ public class AdditionalInput implements IAdditionalInput {
|
|||
|| fKind.intValue() == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY
|
||||
|| isLibrariesInput()) {
|
||||
IToolChain toolChain = getToolChain();
|
||||
if (!toolChain.isExtensionElement()) {
|
||||
/* toolChain can be null e.g. in tools for custom build steps */
|
||||
if (toolChain != null && !toolChain.isExtensionElement()) {
|
||||
long artifactTimeStamp = getArtifactTimeStamp(toolChain);
|
||||
if (0 != artifactTimeStamp) {
|
||||
String[] paths = getPaths();
|
||||
|
|
Loading…
Add table
Reference in a new issue