mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
1. Fix for [Bug 186078] Targets from "Make Targets"view do not use "Builder Settings" for making
2. Fix to conversion mechanism 3.Fix to error parser settings NPE
This commit is contained in:
parent
dd19c6c7d6
commit
ea86a3db2a
9 changed files with 105 additions and 56 deletions
|
@ -45,7 +45,6 @@ public interface IBuilder extends IBuildObject, IMakeBuilderInfo {
|
|||
|
||||
// static final String BUILD_COMMAND = "buildCommand"; //$NON-NLS-1$
|
||||
static final String ATTRIBUTE_BUILD_PATH = "buildPath"; //$NON-NLS-1$
|
||||
static final String ATTRIBUTE_STOP_ON_ERROR = "stopOnError"; //$NON-NLS-1$
|
||||
// static final String USE_DEFAULT_BUILD_CMD = "useDefaultBuildCmd"; //$NON-NLS-1$
|
||||
static final String ATTRIBUTE_TARGET_AUTO = "autoBuildTarget"; //$NON-NLS-1$
|
||||
static final String ATTRIBUTE_TARGET_INCREMENTAL = "incrementalBuildTarget"; //$NON-NLS-1$
|
||||
|
|
|
@ -666,6 +666,12 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
|
||||
return (IBuilder) getExtensionBuilderMap().get(id);
|
||||
}
|
||||
|
||||
public static IBuilder getExtensionBuilder(IBuilder builder) {
|
||||
for(;builder != null && !builder.isExtensionElement(); builder = builder.getSuperClass());
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the option from the manifest with the ID specified in the argument
|
||||
|
|
|
@ -585,7 +585,8 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
protected void loadFromProject(ICStorageElement element) {
|
||||
|
||||
// id
|
||||
setId(element.getAttribute(IBuildObject.ID));
|
||||
if(element.getAttribute(IBuildObject.ID) != null)
|
||||
setId(element.getAttribute(IBuildObject.ID));
|
||||
|
||||
// name
|
||||
if (element.getAttribute(IBuildObject.NAME) != null) {
|
||||
|
@ -596,11 +597,13 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
if (superClassId != null && superClassId.length() > 0) {
|
||||
superClass = ManagedBuildManager.getExtensionBuilder(superClassId);
|
||||
// Check for migration support
|
||||
checkForMigrationSupport();
|
||||
if(element.getAttribute(IProjectType.SUPERCLASS) != null){
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
if (superClassId != null && superClassId.length() > 0) {
|
||||
superClass = ManagedBuildManager.getExtensionBuilder(superClassId);
|
||||
// Check for migration support
|
||||
checkForMigrationSupport();
|
||||
}
|
||||
}
|
||||
|
||||
// Get the 'versionSupported' attribute
|
||||
|
@ -636,37 +639,54 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
args = element.getAttribute(IBuilder.ARGUMENTS);
|
||||
}
|
||||
|
||||
autoBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_AUTO);
|
||||
if(element.getAttribute(ATTRIBUTE_TARGET_AUTO) != null)
|
||||
autoBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_AUTO);
|
||||
|
||||
String tmp = element.getAttribute(ATTRIBUTE_AUTO_ENABLED);
|
||||
if(tmp != null)
|
||||
autoBuildEnabled = Boolean.valueOf(tmp);
|
||||
incrementalBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL);
|
||||
|
||||
if(element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL) != null)
|
||||
incrementalBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_INCREMENTAL_ENABLED);
|
||||
if(tmp != null)
|
||||
incrementalBuildEnabled = Boolean.valueOf(tmp);
|
||||
cleanBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_CLEAN);
|
||||
|
||||
if(element.getAttribute(ATTRIBUTE_TARGET_CLEAN) != null)
|
||||
cleanBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_CLEAN);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_CLEAN_ENABLED);
|
||||
if(tmp != null)
|
||||
cleanBuildEnabled = Boolean.valueOf(tmp);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_MANAGED_BUILD_ON);
|
||||
if(tmp != null)
|
||||
managedBuildOn = Boolean.valueOf(tmp);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_KEEP_ENV);
|
||||
if(tmp != null)
|
||||
keepEnvVarInBuildfile = Boolean.valueOf(tmp);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_SUPORTS_MANAGED_BUILD);
|
||||
if(tmp != null)
|
||||
supportsManagedBuild = Boolean.valueOf(tmp);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_CUSTOMIZED_ERROR_PARSERS);
|
||||
if(tmp != null)
|
||||
customizedErrorParserIds = CDataUtil.stringToArray(tmp, ";"); //$NON-NLS-1$
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT);
|
||||
if(tmp != null)
|
||||
customizedEnvironment = (HashMap)MapStorageElement.decodeMap(tmp);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT);
|
||||
if(tmp != null)
|
||||
appendEnvironment = Boolean.valueOf(tmp);;
|
||||
buildPath = element.getAttribute(ATTRIBUTE_BUILD_PATH);
|
||||
appendEnvironment = Boolean.valueOf(tmp);
|
||||
|
||||
if(element.getAttribute(ATTRIBUTE_BUILD_PATH) != null)
|
||||
buildPath = element.getAttribute(ATTRIBUTE_BUILD_PATH);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS);
|
||||
if(tmp != null)
|
||||
customBuildProperties = (HashMap)MapStorageElement.decodeMap(tmp);
|
||||
|
@ -682,11 +702,16 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
// TODO: Issue warning?
|
||||
}
|
||||
|
||||
ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD);
|
||||
if(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD) != null)
|
||||
ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
|
||||
if(tmp != null)
|
||||
stopOnErr = Boolean.valueOf(tmp);
|
||||
parallelBuildCmd = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD);
|
||||
|
||||
if(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD) != null)
|
||||
parallelBuildCmd = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD);
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
|
||||
if(tmp != null){
|
||||
try {
|
||||
|
@ -694,6 +719,7 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
} catch (NumberFormatException e){
|
||||
}
|
||||
}
|
||||
|
||||
tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_ON);
|
||||
if(tmp != null)
|
||||
parallelBuildOn = Boolean.valueOf(tmp);
|
||||
|
@ -884,7 +910,7 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
if (superClass != null) {
|
||||
return superClass.getCommand();
|
||||
} else {
|
||||
return new String("make"); //$NON-NLS-1$
|
||||
return "make"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return command;
|
||||
|
@ -1652,7 +1678,7 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
}
|
||||
|
||||
public boolean isDefaultBuildCmd() {
|
||||
return isExtensionBuilder || (command == null && args == null && superClass != null);
|
||||
return isExtensionBuilder || (command == null && args == null /*&& stopOnErr == null && parallelBuildOn == null && parallelNum == null */ && superClass != null);
|
||||
}
|
||||
|
||||
public boolean isStopOnError() {
|
||||
|
@ -1699,6 +1725,9 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
if(on){
|
||||
command = null;
|
||||
args = null;
|
||||
// stopOnErr = null;
|
||||
// parallelBuildOn = null;
|
||||
// parallelNum = null;
|
||||
} else {
|
||||
command = getCommand();
|
||||
}
|
||||
|
@ -1918,7 +1947,7 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
return new String[]{BUILD_COMMAND, BuilderFactory.BUILD_COMMAND};
|
||||
} else if(ARGUMENTS.equals(name)){
|
||||
return new String[]{BUILD_ARGUMENTS, BuilderFactory.BUILD_ARGUMENTS};
|
||||
} else if(ATTRIBUTE_STOP_ON_ERROR.equals(name)){
|
||||
} else if(ATTRIBUTE_STOP_ON_ERR.equals(name)){
|
||||
return new String[]{BuilderFactory.STOP_ON_ERROR};
|
||||
} //TODO else if(BuilderFactory.USE_DEFAULT_BUILD_CMD.equals(name)){
|
||||
// return getCommand();
|
||||
|
|
|
@ -16,6 +16,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.make.core.IMakeCommonBuildInfo;
|
||||
import org.eclipse.cdt.make.internal.core.BuildInfoFactory;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
|
@ -23,7 +26,6 @@ import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
|||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.newmake.internal.core.MakeMessages;
|
||||
import org.eclipse.core.resources.ICommand;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
|
@ -54,7 +56,7 @@ public class BuilderFactory {
|
|||
|
||||
static final String CONTENTS = PREFIX + ".contents"; //$NON-NLS-1$
|
||||
static final String CONTENTS_BUILDER = PREFIX + ".builder"; //$NON-NLS-1$
|
||||
// static final String CONTENTS_BUILDER_CUSTOMIZATION = PREFIX + ".builderCustomization"; //$NON-NLS-1$
|
||||
static final String CONTENTS_BUILDER_CUSTOMIZATION = PREFIX + ".builderCustomization"; //$NON-NLS-1$
|
||||
static final String CONTENTS_CONFIGURATION_IDS = PREFIX + ".configurationIds"; //$NON-NLS-1$
|
||||
|
||||
// static final String IDS = PREFIX + ".ids"; //$NON-NLS-1$
|
||||
|
@ -240,7 +242,8 @@ public class BuilderFactory {
|
|||
args.put(IBuilder.ID, ManagedBuildManager.calculateChildId(command.getBuilderName(), null));
|
||||
}
|
||||
|
||||
return createBuilder(cfg, args);
|
||||
//TODO: do we need a to check for the non-customization case ?
|
||||
return createBuilder(cfg, args, cfg.getBuilder() != null);
|
||||
}
|
||||
|
||||
public static IBuilder createBuilderForEclipseBuilder(IConfiguration cfg, String eclipseBuilderID) throws CoreException {
|
||||
|
@ -272,37 +275,36 @@ public class BuilderFactory {
|
|||
|
||||
|
||||
|
||||
private static IBuilder createBuilder(IConfiguration cfg, Map args){
|
||||
private static IBuilder createBuilder(IConfiguration cfg, Map args, boolean customization){
|
||||
IToolChain tCh = cfg.getToolChain();
|
||||
boolean isMakeTargetBuild = false;
|
||||
if(args.get(IBuilder.ID) == null){
|
||||
args.put(IBuilder.ID, ManagedBuildManager.calculateChildId(cfg.getId(), null));
|
||||
isMakeTargetBuild = true;
|
||||
}
|
||||
MapStorageElement el = new BuildArgsStorageElement(args, null);
|
||||
Builder builder = new Builder(tCh, el, ManagedBuildManager.getVersion().toString());
|
||||
IBuilder cfgBuilder = cfg.getEditableBuilder();
|
||||
if(builder.getBuildPathAttribute() == null){
|
||||
//set the build path from the cfg settings
|
||||
builder.setBuildPath(cfgBuilder.getBuildPath());
|
||||
}
|
||||
if(builder.getManagedBuildOnAttribute() == null){
|
||||
try {
|
||||
builder.setManagedBuildOn(cfgBuilder.isManagedBuildOn());
|
||||
} catch (CoreException e) {
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
if(isMakeTargetBuild){
|
||||
String [] ids = builder.getCustomizedErrorParserIds();
|
||||
if(ids != null && ids.length == 0){
|
||||
builder.setCustomizedErrorParserIds(null);
|
||||
}
|
||||
|
||||
Builder builder;
|
||||
if(customization){
|
||||
builder = (Builder)createCustomBuilder(cfg, cfgBuilder);
|
||||
|
||||
//adjusting settings
|
||||
String tmp = (String)args.get(ErrorParserManager.PREF_ERROR_PARSER);
|
||||
if(tmp != null && tmp.length() == 0)
|
||||
args.remove(ErrorParserManager.PREF_ERROR_PARSER);
|
||||
|
||||
String id = builder.getErrorParserIds();
|
||||
if(id == null)
|
||||
builder.setErrorParserIds(cfgBuilder.getErrorParserIds());
|
||||
tmp = (String)args.get(USE_DEFAULT_BUILD_CMD);
|
||||
if(tmp != null && Boolean.valueOf(tmp).equals(Boolean.TRUE)){
|
||||
args.remove(IMakeCommonBuildInfo.BUILD_COMMAND);
|
||||
args.remove(IMakeCommonBuildInfo.BUILD_ARGUMENTS);
|
||||
}
|
||||
//end adjusting settings
|
||||
|
||||
MapStorageElement el = new BuildArgsStorageElement(args, null);
|
||||
builder.loadFromProject(el);
|
||||
} else {
|
||||
if(args.get(IBuilder.ID) == null){
|
||||
args.put(IBuilder.ID, ManagedBuildManager.calculateChildId(cfg.getId(), null));
|
||||
}
|
||||
MapStorageElement el = new BuildArgsStorageElement(args, null);
|
||||
builder = new Builder(tCh, el, ManagedBuildManager.getVersion().toString());
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
@ -316,13 +318,13 @@ public class BuilderFactory {
|
|||
builders = new IBuilder[]{builder};
|
||||
} else {
|
||||
String type = (String)args.get(CONTENTS);
|
||||
if(type == null){
|
||||
if(type == null || CONTENTS_BUILDER_CUSTOMIZATION.equals(type)){
|
||||
IConfiguration cfg = info.getDefaultConfiguration();
|
||||
IBuilder builder;
|
||||
if(args.size() == 0){
|
||||
builder = cfg.getEditableBuilder();
|
||||
} else {
|
||||
builder = createBuilder(cfg, args);
|
||||
builder = createBuilder(cfg, args, true);
|
||||
}
|
||||
builders = new IBuilder[]{builder};
|
||||
//TODO:
|
||||
|
@ -331,7 +333,7 @@ public class BuilderFactory {
|
|||
if(cfgs.length != 0){
|
||||
List list = new ArrayList(cfgs.length);
|
||||
for(int i = 0; i < cfgs.length; i++){
|
||||
IBuilder builder = createBuilder(cfgs[i], args);
|
||||
IBuilder builder = createBuilder(cfgs[i], args, false);
|
||||
if(builder != null)
|
||||
list.add(builder);
|
||||
}
|
||||
|
|
|
@ -478,7 +478,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
if(VERBOSE)
|
||||
outputTrace(project.getName(), ">>build requested, type = " + kind); //$NON-NLS-1$
|
||||
|
||||
IBuilder builders[] = BuilderFactory.createBuilders(project, args);
|
||||
IBuilder builders[] = ManagedBuilderCorePlugin.createBuilders(project, args);
|
||||
IProject[] projects = build(kind, project, builders, true, monitor);
|
||||
|
||||
if(VERBOSE)
|
||||
|
@ -1443,7 +1443,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
|
||||
protected void clean(IProgressMonitor monitor) throws CoreException {
|
||||
IProject curProject = getProject();
|
||||
IBuilder[] builders = BuilderFactory.createBuilders(curProject, null);
|
||||
IBuilder[] builders = ManagedBuilderCorePlugin.createBuilders(curProject, null);
|
||||
for(int i = 0; i < builders.length; i++){
|
||||
IBuilder builder = builders[i];
|
||||
CfgBuildInfo bInfo = new CfgBuildInfo(builder, true);
|
||||
|
@ -1668,13 +1668,13 @@ public class CommonBuilder extends ACBuilder {
|
|||
// Set the environment
|
||||
String[] env = calcEnvironment(builder);
|
||||
String[] buildArguments = targets;
|
||||
if (builder.isDefaultBuildCmd()) {
|
||||
// if (builder.isDefaultBuildCmd()) {
|
||||
// if (!builder.isStopOnError()) {
|
||||
// buildArguments = new String[targets.length + 1];
|
||||
// buildArguments[0] = "-k"; //$NON-NLS-1$
|
||||
// System.arraycopy(targets, 0, buildArguments, 1, targets.length);
|
||||
// }
|
||||
} else {
|
||||
// } else {
|
||||
String args = builder.getBuildArguments();
|
||||
if (args != null && !(args = args.trim()).equals("")) { //$NON-NLS-1$
|
||||
String[] newArgs = makeArray(args);
|
||||
|
@ -1682,7 +1682,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
System.arraycopy(newArgs, 0, buildArguments, 0, newArgs.length);
|
||||
System.arraycopy(targets, 0, buildArguments, newArgs.length, targets.length);
|
||||
}
|
||||
}
|
||||
// }
|
||||
// MakeRecon recon = new MakeRecon(buildCommand, buildArguments, env, workingDirectory, makeMonitor, cos);
|
||||
// recon.invokeMakeRecon();
|
||||
// cos = recon;
|
||||
|
|
|
@ -2360,6 +2360,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
} else {
|
||||
resetErrorParsers();
|
||||
Set oldSet = contributeErrorParsers(null, true);
|
||||
if(oldSet == null)
|
||||
oldSet = new HashSet();
|
||||
HashSet newSet = new HashSet();
|
||||
newSet.addAll(Arrays.asList(ids));
|
||||
newSet.remove(null);
|
||||
|
@ -2385,6 +2387,9 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
|
||||
void removeErrorParsers(Set set){
|
||||
Set oldSet = contributeErrorParsers(null, false);
|
||||
if(oldSet == null)
|
||||
oldSet = new HashSet();
|
||||
|
||||
oldSet.removeAll(set);
|
||||
setErrorParserAttribute((String[])oldSet.toArray(new String[oldSet.size()]));
|
||||
|
||||
|
|
|
@ -3849,6 +3849,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
|
||||
void removeErrorParsers(Set set){
|
||||
Set oldSet = contributeErrorParsers(null);
|
||||
if(oldSet == null)
|
||||
oldSet = new HashSet();
|
||||
|
||||
oldSet.removeAll(set);
|
||||
setErrorParserList((String[])oldSet.toArray(new String[oldSet.size()]));
|
||||
}
|
||||
|
|
|
@ -2577,6 +2577,9 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
|||
|
||||
void removeErrorParsers(FolderInfo info, Set set){
|
||||
Set oldSet = contributeErrorParsers(info, null, false);
|
||||
if(oldSet == null)
|
||||
oldSet = new HashSet();
|
||||
|
||||
oldSet.removeAll(set);
|
||||
setErrorParserList((String[])oldSet.toArray(new String[oldSet.size()]));
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
|
||||
private ICProjectDescription getConvertedDescription(IProject project, IProjectDescription eDes) throws CoreException{
|
||||
Object info[] = loadProjectDescriptionFromOldstyleStorage(project);
|
||||
CProjectDescription des;
|
||||
CProjectDescription des = null;
|
||||
String ownerId;
|
||||
try {
|
||||
if(info != null){
|
||||
|
@ -604,6 +604,8 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
CProjectDescription d = clearDescriptionLoadding(project);
|
||||
if(d != null)
|
||||
d.setLoadding(false);
|
||||
if(des != null)
|
||||
des.setLoadding(false);
|
||||
}
|
||||
return des;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue