1
0
Fork 0
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:
Sebastian Bauer 2014-12-15 00:01:13 +01:00 committed by Elena Laskavaia
parent c631da77c6
commit accfa032aa
2 changed files with 26 additions and 1 deletions

View file

@ -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){ private void doTestTool(ITool tool){
IBuildObject obj = tool.getParent(); IBuildObject obj = tool.getParent();
IConfiguration cfg; IConfiguration cfg;

View file

@ -342,7 +342,8 @@ public class AdditionalInput implements IAdditionalInput {
|| fKind.intValue() == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY || fKind.intValue() == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY
|| isLibrariesInput()) { || isLibrariesInput()) {
IToolChain toolChain = getToolChain(); 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); long artifactTimeStamp = getArtifactTimeStamp(toolChain);
if (0 != artifactTimeStamp) { if (0 != artifactTimeStamp) {
String[] paths = getPaths(); String[] paths = getPaths();