1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 458370: NPE trying to build an existing project

Change-Id: I99cdc7d535a98633ae9d2ea8cca1d49dab1eca3d
Signed-off-by: Andrew Gvozdev <angvoz.dev@gmail.com>
This commit is contained in:
Andrew Gvozdev 2015-03-12 11:09:13 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent 50775fe2fb
commit fe8b5e806d
2 changed files with 38 additions and 32 deletions

View file

@ -1103,42 +1103,47 @@ public class BuildDescription implements IBuildDescription {
// use artifact name & extension
if (fTargetStep == action){
String artifactName = fCfg.getArtifactName();
try {
String tmp = ManagedBuildManager.getBuildMacroProvider().resolveValue(artifactName, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
if((tmp = tmp.trim()).length() > 0)
artifactName = tmp;
} catch (BuildMacroException e){
}
String artifactExt = fCfg.getArtifactExtension();
try {
String tmp = ManagedBuildManager.getBuildMacroProvider()
.resolveValue(artifactExt, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
if((tmp = tmp.trim()).length() > 0)
artifactExt = tmp;
} catch (BuildMacroException e) {
}
String artifactPrefix = tool.getOutputPrefix();
if(artifactPrefix != null && artifactPrefix.length() != 0){
if (artifactName != null && ! artifactName.trim().isEmpty()) {
try {
String tmp = ManagedBuildManager.getBuildMacroProvider().resolveValue(artifactPrefix, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
String tmp = ManagedBuildManager.getBuildMacroProvider().resolveValue(artifactName, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
if((tmp = tmp.trim()).length() > 0)
artifactPrefix = tmp;
artifactName = tmp;
} catch (BuildMacroException e){
}
artifactName = artifactPrefix + artifactName;
String artifactExt = fCfg.getArtifactExtension();
try {
String tmp = ManagedBuildManager.getBuildMacroProvider()
.resolveValue(artifactExt, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
if((tmp = tmp.trim()).length() > 0)
artifactExt = tmp;
} catch (BuildMacroException e) {
}
String artifactPrefix = tool.getOutputPrefix();
if(artifactPrefix != null && artifactPrefix.length() != 0){
try {
String tmp = ManagedBuildManager.getBuildMacroProvider().resolveValue(artifactPrefix, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
if((tmp = tmp.trim()).length() > 0)
artifactPrefix = tmp;
} catch (BuildMacroException e){
}
artifactName = artifactPrefix + artifactName;
}
IPath path = new Path(artifactName);
if(artifactExt != null && artifactExt.length() != 0)
path = path.addFileExtension(artifactExt);
IOutputType type = action.getTool().getPrimaryOutputType();
BuildIOType ioType = action.getIOTypeForType(type, false);
if(ioType == null)
ioType = action.createIOType(false, true, type);
addOutputs(new IPath[]{path}, ioType, outDirPath);
} else {
String msg = BuildModelMessages.getFormattedString("BuildDescription.MissingArtifact", new String[] {fProject.getName(), fCfg.getName()}); //$NON-NLS-1$
ManagedBuilderCorePlugin.log(new Status(IStatus.WARNING, ManagedBuilderCorePlugin.PLUGIN_ID, msg));
}
IPath path = new Path(artifactName);
if(artifactExt != null && artifactExt.length() != 0)
path = path.addFileExtension(artifactExt);
IOutputType type = action.getTool().getPrimaryOutputType();
BuildIOType ioType = action.getIOTypeForType(type, false);
if(ioType == null)
ioType = action.createIOType(false, true, type);
addOutputs(new IPath[]{path}, ioType, outDirPath);
} else if (outTypes != null && outTypes.length > 0) {
for (IOutputType type : outTypes) {
boolean primaryOutput = (type == tool.getPrimaryOutputType());

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2007 Intel Corporation and others.
# Copyright (c) 2015 Intel Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -10,3 +10,4 @@
###############################################################################
BuildResource.0=Generated resource conflict: \ntwo resources of the same name: {0} \ngenerated by different tools \ntool1: {1} \ntool2: {2}\n
BuildDescription.MissingArtifact=Build Artifact is missing in project ''{0}'' configuration ''{1}''