mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Changes for bugzilla 54202 - Changing the active configuration forces a save in the cdtbuildfile.
This commit is contained in:
parent
4fdafaa433
commit
1661bb8022
13 changed files with 1151 additions and 962 deletions
|
@ -45,6 +45,19 @@ public interface IConfiguration extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public ITool[] getTools();
|
public ITool[] getTools();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Answers <code>true</code> the receiver has changes that need to be saved
|
||||||
|
* in the project file, else <code>false</code>.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isDirty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isDirty
|
||||||
|
*/
|
||||||
|
public void setDirty(boolean isDirty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the receiver to the value specified in the argument
|
* Sets the name of the receiver to the value specified in the argument
|
||||||
*
|
*
|
||||||
|
@ -57,6 +70,7 @@ public interface IConfiguration extends IBuildObject {
|
||||||
*
|
*
|
||||||
* @param option The option to change.
|
* @param option The option to change.
|
||||||
* @param value The value to apply to the option.
|
* @param value The value to apply to the option.
|
||||||
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
*/
|
*/
|
||||||
public void setOption(IOption option, boolean value)
|
public void setOption(IOption option, boolean value)
|
||||||
|
@ -67,6 +81,8 @@ public interface IConfiguration extends IBuildObject {
|
||||||
*
|
*
|
||||||
* @param option The option that will be effected by change.
|
* @param option The option that will be effected by change.
|
||||||
* @param value The value to apply to the option.
|
* @param value The value to apply to the option.
|
||||||
|
*
|
||||||
|
* @throws BuildException
|
||||||
*/
|
*/
|
||||||
public void setOption(IOption option, String value)
|
public void setOption(IOption option, String value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
@ -76,6 +92,8 @@ public interface IConfiguration extends IBuildObject {
|
||||||
*
|
*
|
||||||
* @param option The option to change.
|
* @param option The option to change.
|
||||||
* @param value The values to apply to the option.
|
* @param value The values to apply to the option.
|
||||||
|
*
|
||||||
|
* @throws BuildException
|
||||||
*/
|
*/
|
||||||
public void setOption(IOption option, String[] value)
|
public void setOption(IOption option, String[] value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
@ -83,8 +101,8 @@ public interface IConfiguration extends IBuildObject {
|
||||||
/**
|
/**
|
||||||
* Overrides the tool command for a tool defined in the receiver.
|
* Overrides the tool command for a tool defined in the receiver.
|
||||||
*
|
*
|
||||||
* @param tool
|
* @param tool The tool that will have its command modified
|
||||||
* @param command
|
* @param command The command
|
||||||
*/
|
*/
|
||||||
public void setToolCommand(ITool tool, String command);
|
public void setToolCommand(ITool tool, String command);
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,11 @@ public interface ITarget extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public String getArtifactName();
|
public String getArtifactName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isDirty
|
||||||
|
*/
|
||||||
|
public void setDirty(boolean isDirty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers the unique ID of the binary parser associated with the target.
|
* Answers the unique ID of the binary parser associated with the target.
|
||||||
*
|
*
|
||||||
|
@ -171,6 +176,14 @@ public interface ITarget extends IBuildObject {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isAbstract();
|
public boolean isAbstract();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Answers <code>true</code> the receiver has changes that need to be saved
|
||||||
|
* in the project file, else <code>false</code>.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isDirty();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers <code>true</code> if the receiver is a target that is defined
|
* Answers <code>true</code> if the receiver is a target that is defined
|
||||||
|
@ -232,5 +245,4 @@ public interface ITarget extends IBuildObject {
|
||||||
* @param resource
|
* @param resource
|
||||||
*/
|
*/
|
||||||
public void updateOwner(IResource resource);
|
public void updateOwner(IResource resource);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Target;
|
import org.eclipse.cdt.managedbuilder.internal.core.Target;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||||
|
@ -206,18 +207,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* @param config
|
* @param config
|
||||||
* @param option
|
* @param option
|
||||||
*/
|
*/
|
||||||
private static void setDirty(IConfiguration config, IOption option) {
|
private static void notifyListeners(IConfiguration config, IOption option) {
|
||||||
// Set the build info dirty so builder will rebuild
|
|
||||||
IResource resource = config.getOwner();
|
|
||||||
IManagedBuildInfo info = getBuildInfo(resource);
|
|
||||||
info.setDirty(true);
|
|
||||||
|
|
||||||
// Continue if change is something that effect the scanner
|
// Continue if change is something that effect the scanner
|
||||||
if (!(option.getValueType() == IOption.INCLUDE_PATH
|
if (!(option.getValueType() == IOption.INCLUDE_PATH
|
||||||
|| option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
|
|| option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Figure out if there is a listener for this change
|
// Figure out if there is a listener for this change
|
||||||
|
IResource resource = config.getOwner();
|
||||||
List listeners = (List) getBuildModelListeners().get(resource);
|
List listeners = (List) getBuildModelListeners().get(resource);
|
||||||
if (listeners == null) {
|
if (listeners == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -237,8 +234,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
*/
|
*/
|
||||||
public static void setOption(IConfiguration config, IOption option, boolean value) {
|
public static void setOption(IConfiguration config, IOption option, boolean value) {
|
||||||
try {
|
try {
|
||||||
|
// Request a value change and set dirty if real change results
|
||||||
config.setOption(option, value);
|
config.setOption(option, value);
|
||||||
setDirty(config, option);
|
notifyListeners(config, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -254,7 +252,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
public static void setOption(IConfiguration config, IOption option, String value) {
|
public static void setOption(IConfiguration config, IOption option, String value) {
|
||||||
try {
|
try {
|
||||||
config.setOption(option, value);
|
config.setOption(option, value);
|
||||||
setDirty(config, option);
|
notifyListeners(config, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -270,19 +268,35 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
public static void setOption(IConfiguration config, IOption option, String[] value) {
|
public static void setOption(IConfiguration config, IOption option, String[] value) {
|
||||||
try {
|
try {
|
||||||
config.setOption(option, value);
|
config.setOption(option, value);
|
||||||
setDirty(config, option);
|
notifyListeners(config, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param config
|
||||||
|
* @param tool
|
||||||
|
* @param command
|
||||||
|
*/
|
||||||
|
public static void setToolCommand(IConfiguration config, ITool tool, String command) {
|
||||||
|
// The tool may be a reference.
|
||||||
|
if (tool instanceof ToolReference) {
|
||||||
|
// If so, just set the command in the reference
|
||||||
|
((ToolReference)tool).setToolCommand(command);
|
||||||
|
} else {
|
||||||
|
config.setToolCommand(tool, command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the build information associated with a project and all resources
|
* Saves the build information associated with a project and all resources
|
||||||
* in the project to the build info file.
|
* in the project to the build info file.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
|
* @param force
|
||||||
*/
|
*/
|
||||||
public static void saveBuildInfo(IProject project) {
|
public static void saveBuildInfo(IProject project, boolean force) {
|
||||||
// Create document
|
// Create document
|
||||||
Document doc = new DocumentImpl();
|
Document doc = new DocumentImpl();
|
||||||
Element rootElement = doc.createElement(ROOT_ELEM_NAME);
|
Element rootElement = doc.createElement(ROOT_ELEM_NAME);
|
||||||
|
@ -290,30 +304,31 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
|
|
||||||
// Save the build info
|
// Save the build info
|
||||||
ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
|
ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
|
||||||
if (buildInfo != null)
|
if (buildInfo != null && (force == true || buildInfo.isDirty())) {
|
||||||
buildInfo.serialize(doc, rootElement);
|
buildInfo.serialize(doc, rootElement);
|
||||||
|
|
||||||
// Save the document
|
// Save the document
|
||||||
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
||||||
OutputFormat format = new OutputFormat();
|
OutputFormat format = new OutputFormat();
|
||||||
format.setIndenting(true);
|
format.setIndenting(true);
|
||||||
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
|
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
|
||||||
String xml = null;
|
String xml = null;
|
||||||
try {
|
try {
|
||||||
Serializer serializer
|
Serializer serializer
|
||||||
= SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format); //$NON-NLS-1$
|
= SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format); //$NON-NLS-1$
|
||||||
serializer.asDOMSerializer().serialize(doc);
|
serializer.asDOMSerializer().serialize(doc);
|
||||||
xml = s.toString("UTF8"); //$NON-NLS-1$
|
xml = s.toString("UTF8"); //$NON-NLS-1$
|
||||||
IFile rscFile = project.getFile(FILE_NAME);
|
IFile rscFile = project.getFile(FILE_NAME);
|
||||||
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
|
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
|
||||||
// update the resource content
|
// update the resource content
|
||||||
if (rscFile.exists()) {
|
if (rscFile.exists()) {
|
||||||
rscFile.setContents(inputStream, IResource.FORCE, null);
|
rscFile.setContents(inputStream, IResource.FORCE, null);
|
||||||
} else {
|
} else {
|
||||||
rscFile.create(inputStream, IResource.FORCE, null);
|
rscFile.create(inputStream, IResource.FORCE, null);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +557,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
|
|
||||||
if (buildInfo == null && create) {
|
if (buildInfo == null && create) {
|
||||||
try {
|
try {
|
||||||
|
// Create a new build info object for the project
|
||||||
buildInfo = new ManagedBuildInfo(resource);
|
buildInfo = new ManagedBuildInfo(resource);
|
||||||
|
// Associate the build info with the project for the duration of the session
|
||||||
resource.setSessionProperty(buildInfoProperty, buildInfo);
|
resource.setSessionProperty(buildInfoProperty, buildInfo);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
buildInfo = null;
|
buildInfo = null;
|
||||||
|
@ -668,5 +685,5 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
public static IConfigurationElement getConfigElement(IBuildObject buildObj) {
|
public static IConfigurationElement getConfigElement(IBuildObject buildObj) {
|
||||||
return (IConfigurationElement)getConfigElementMap().get(buildObj);
|
return (IConfigurationElement)getConfigElementMap().get(buildObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,11 @@ import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
public class Configuration extends BuildObject implements IConfiguration {
|
public class Configuration extends BuildObject implements IConfiguration {
|
||||||
|
private boolean isDirty = false;
|
||||||
private ITarget target;
|
|
||||||
private IConfiguration parent;
|
private IConfiguration parent;
|
||||||
private List toolReferences;
|
|
||||||
private boolean resolved = true;
|
private boolean resolved = true;
|
||||||
|
private ITarget target;
|
||||||
|
private List toolReferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a configuration from the project manifest file.
|
* Build a configuration from the project manifest file.
|
||||||
|
@ -307,6 +307,14 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
return tools;
|
return tools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isDirty()
|
||||||
|
*/
|
||||||
|
public boolean isDirty() {
|
||||||
|
return isDirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
|
||||||
*/
|
*/
|
||||||
|
@ -418,15 +426,27 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
element.appendChild(toolRefElement);
|
element.appendChild(toolRefElement);
|
||||||
toolRef.serialize(doc, toolRefElement);
|
toolRef.serialize(doc, toolRefElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I am clean now
|
||||||
|
isDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDirty(boolean)
|
||||||
|
*/
|
||||||
|
public void setDirty(boolean isDirty) {
|
||||||
|
this.isDirty = isDirty;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
|
||||||
*/
|
*/
|
||||||
public void setOption(IOption option, boolean value) throws BuildException {
|
public void setOption(IOption option, boolean value) throws BuildException {
|
||||||
// Is there a delta
|
// Is there a delta
|
||||||
if (option.getBooleanValue() != value)
|
if (option.getBooleanValue() != value) {
|
||||||
createOptionReference(option).setValue(value);
|
createOptionReference(option).setValue(value);
|
||||||
|
isDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -441,8 +461,10 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
else {
|
else {
|
||||||
oldValue = option.getStringValue();
|
oldValue = option.getStringValue();
|
||||||
}
|
}
|
||||||
if (oldValue != null && !oldValue.equals(value))
|
if (oldValue != null && !oldValue.equals(value)) {
|
||||||
createOptionReference(option).setValue(value);
|
createOptionReference(option).setValue(value);
|
||||||
|
isDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -471,8 +493,10 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
oldValue = new String[0];
|
oldValue = new String[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!Arrays.equals(value, oldValue))
|
if(!Arrays.equals(value, oldValue)) {
|
||||||
createOptionReference(option).setValue(value);
|
createOptionReference(option).setValue(value);
|
||||||
|
isDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -489,8 +513,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
}
|
}
|
||||||
// Set the ref's command
|
// Set the ref's command
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
ref.setToolCommand(command);
|
isDirty = ref.setToolCommand(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,10 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
public static final String MINOR_SEPERATOR = "::"; //$NON-NLS-1$
|
public static final String MINOR_SEPERATOR = "::"; //$NON-NLS-1$
|
||||||
private static final QualifiedName defaultConfigProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultConfig"); //$NON-NLS-1$
|
private static final QualifiedName defaultConfigProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultConfig"); //$NON-NLS-1$
|
||||||
private static final QualifiedName defaultTargetProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultTarget"); //$NON-NLS-1$
|
private static final QualifiedName defaultTargetProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultTarget"); //$NON-NLS-1$
|
||||||
|
private String defaultConfigIds;
|
||||||
private Map defaultConfigMap;
|
private Map defaultConfigMap;
|
||||||
private ITarget defaultTarget;
|
private ITarget defaultTarget;
|
||||||
|
private String defaultTargetId;
|
||||||
private boolean isDirty;
|
private boolean isDirty;
|
||||||
private IResource owner;
|
private IResource owner;
|
||||||
private Map targetMap;
|
private Map targetMap;
|
||||||
|
@ -58,8 +60,28 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @param owner
|
* @param owner
|
||||||
*/
|
*/
|
||||||
public ManagedBuildInfo(IResource owner) {
|
public ManagedBuildInfo(IResource owner) {
|
||||||
targetList = new ArrayList();
|
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
isDirty = false;
|
||||||
|
|
||||||
|
// The id of the default target from the project persistent settings store
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
defaultTargetId = null;
|
||||||
|
try {
|
||||||
|
defaultTargetId = project.getPersistentProperty(defaultTargetProperty);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// We have all the build elements so we can stop if this occurs
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the default configs for every target out of the same store
|
||||||
|
defaultConfigIds = null;
|
||||||
|
try {
|
||||||
|
defaultConfigIds = project.getPersistentProperty(defaultConfigProperty);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// Again, hitting this error just means the default config is not set
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +92,6 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
public ManagedBuildInfo(IResource owner, Element element) {
|
public ManagedBuildInfo(IResource owner, Element element) {
|
||||||
// Store the IProject the info is for
|
|
||||||
this(owner);
|
this(owner);
|
||||||
|
|
||||||
// Read in the top-level info objects
|
// Read in the top-level info objects
|
||||||
|
@ -81,70 +102,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
}
|
}
|
||||||
child = child.getNextSibling();
|
child = child.getNextSibling();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// The id of the default configuration from the persistent store
|
|
||||||
IProject project = (IProject)getOwner();
|
|
||||||
String defaultTargetId = null;
|
|
||||||
try {
|
|
||||||
defaultTargetId = project.getPersistentProperty(defaultTargetProperty);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
// We have all the build elements so we can stop if this occurs
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// All targets have been read in so set the default from the persisted ID
|
|
||||||
if (defaultTargetId != null) {
|
|
||||||
defaultTarget = (ITarget) getTargetMap().get(defaultTargetId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the string of all default config IDs from the store
|
|
||||||
String defaultIds = null;
|
|
||||||
try {
|
|
||||||
defaultIds = project.getPersistentProperty(defaultConfigProperty);
|
|
||||||
} catch (CoreException e1) {
|
|
||||||
// Again, hitting this error just means the default config is not set
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (defaultIds != null) {
|
|
||||||
String[] majorTokens = defaultIds.split(MAJOR_SEPERATOR);
|
|
||||||
for (int index = majorTokens.length - 1; index >= 0; --index) {
|
|
||||||
// Now split each token into the target and config id component
|
|
||||||
String idToken = majorTokens[index];
|
|
||||||
if (idToken != null) {
|
|
||||||
String[] minorTokens = idToken.split(MINOR_SEPERATOR);
|
|
||||||
// The first token is the target ID
|
|
||||||
ITarget target = getTarget(minorTokens[0]);
|
|
||||||
// The second is the configuration ID
|
|
||||||
IConfiguration config = target.getConfiguration(minorTokens[1]);
|
|
||||||
if (config != null) {
|
|
||||||
getDefaultConfigMap().put(target.getId(), config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* // Now we have a miserable O(N^2) operation (oh well, the data sets are small)
|
|
||||||
ListIterator stringIter = configIds.listIterator();
|
|
||||||
while (stringIter.hasNext()){
|
|
||||||
String confId = (String) stringIter.next();
|
|
||||||
ListIterator targIter = targetList.listIterator();
|
|
||||||
while (targIter.hasNext()) {
|
|
||||||
Target targ = (Target) targIter.next();
|
|
||||||
IConfiguration conf = targ.getConfiguration(confId);
|
|
||||||
if (conf != null) {
|
|
||||||
defaultConfigMap.put(targ.getId(), conf);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/ }
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
|
||||||
*/
|
*/
|
||||||
public void addTarget(ITarget target) {
|
public void addTarget(ITarget target) {
|
||||||
getTargetMap().put(target.getId(), target);
|
getTargetMap().put(target.getId(), target);
|
||||||
targetList.add(target);
|
getTargets().add(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -250,6 +215,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
private Map getDefaultConfigMap() {
|
private Map getDefaultConfigMap() {
|
||||||
if (defaultConfigMap == null) {
|
if (defaultConfigMap == null) {
|
||||||
defaultConfigMap = new HashMap();
|
defaultConfigMap = new HashMap();
|
||||||
|
// We read this as part of the constructor
|
||||||
|
if (defaultConfigIds != null) {
|
||||||
|
String[] majorTokens = defaultConfigIds.split(MAJOR_SEPERATOR);
|
||||||
|
for (int index = majorTokens.length - 1; index >= 0; --index) {
|
||||||
|
// Now split each token into the target and config id component
|
||||||
|
String idToken = majorTokens[index];
|
||||||
|
if (idToken != null) {
|
||||||
|
String[] minorTokens = idToken.split(MINOR_SEPERATOR);
|
||||||
|
// The first token is the target ID
|
||||||
|
ITarget target = getTarget(minorTokens[0]);
|
||||||
|
if (target == null) continue;
|
||||||
|
// The second is the configuration ID
|
||||||
|
IConfiguration config = target.getConfiguration(minorTokens[1]);
|
||||||
|
if (config != null) {
|
||||||
|
defaultConfigMap.put(target.getId(), config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return defaultConfigMap;
|
return defaultConfigMap;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +260,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
*/
|
*/
|
||||||
public ITarget getDefaultTarget() {
|
public ITarget getDefaultTarget() {
|
||||||
if (defaultTarget == null) {
|
if (defaultTarget == null) {
|
||||||
defaultTarget = (ITarget) targetList.get(0);
|
// See if there is a target that was persisted
|
||||||
|
if (defaultTargetId != null) {
|
||||||
|
defaultTarget = (ITarget) getTargetMap().get(defaultTargetId);
|
||||||
|
}
|
||||||
|
// If that failed, look for anything
|
||||||
|
if (defaultTarget == null) {
|
||||||
|
defaultTarget = (ITarget) getTargets().get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return defaultTarget;
|
return defaultTarget;
|
||||||
}
|
}
|
||||||
|
@ -709,6 +700,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
|
||||||
*/
|
*/
|
||||||
public List getTargets() {
|
public List getTargets() {
|
||||||
|
if (targetList == null) {
|
||||||
|
targetList = new ArrayList();
|
||||||
|
}
|
||||||
return targetList;
|
return targetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,7 +834,20 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isDirty()
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isDirty()
|
||||||
*/
|
*/
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return isDirty;
|
// If the info has been flagged dirty, answer true
|
||||||
|
if (isDirty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if any of the defined targets are dirty
|
||||||
|
Iterator iter = getTargets().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
if (((ITarget)iter.next()).isDirty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -877,27 +884,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the contents of the build model to the persistent store specified in the
|
/* (non-Javadoc)
|
||||||
* argument.
|
|
||||||
*
|
*
|
||||||
* @param doc
|
|
||||||
* @param element
|
|
||||||
*/
|
*/
|
||||||
public void serialize(Document doc, Element element) {
|
private void persistDefaultConfigurations() {
|
||||||
// Create a buffer of the default configuration IDs
|
// Create a buffer of the default configuration IDs
|
||||||
StringBuffer defaultConfigs = new StringBuffer();
|
StringBuffer defaultConfigs = new StringBuffer();
|
||||||
|
Iterator iter = getTargets().listIterator();
|
||||||
// Write out each target and their default config
|
|
||||||
Iterator iter = targetList.listIterator();
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
// Get the target
|
|
||||||
Target targ = (Target)iter.next();
|
|
||||||
// Create an XML element to hold the target settings
|
|
||||||
Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME);
|
|
||||||
element.appendChild(targetElement);
|
|
||||||
targ.serialize(doc, targetElement);
|
|
||||||
// Persist the default target configuration pair as <targ_ID>::<conf_ID>
|
// Persist the default target configuration pair as <targ_ID>::<conf_ID>
|
||||||
|
ITarget targ = (ITarget)iter.next();
|
||||||
IConfiguration config = getDefaultConfiguration((ITarget)targ);
|
IConfiguration config = getDefaultConfiguration((ITarget)targ);
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
defaultConfigs.append(targ.getId());
|
defaultConfigs.append(targ.getId());
|
||||||
|
@ -906,65 +903,105 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
defaultConfigs.append(MAJOR_SEPERATOR);
|
defaultConfigs.append(MAJOR_SEPERATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Persist the default configurations
|
||||||
/* for (int i = 0; i < targets.size(); ++i) {
|
IProject project = (IProject) getOwner();
|
||||||
Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME);
|
try {
|
||||||
element.appendChild(targetElement);
|
project.setPersistentProperty(defaultConfigProperty, defaultConfigs.toString().trim());
|
||||||
((Target)targets.get(i)).serialize(doc, targetElement);
|
} catch (CoreException e) {
|
||||||
IConfiguration config = getDefaultConfiguration((ITarget)targets.get(i));
|
// Too bad
|
||||||
if (config != null) {
|
|
||||||
Element configEl = doc.createElement(DEFAULT_CONFIGURATION);
|
|
||||||
element.appendChild(configEl);
|
|
||||||
configEl.setAttribute(IConfiguration.ID, config.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/ // Persist the default target as a project setting
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void persistDefaultTarget() {
|
||||||
|
// Persist the default target as a project setting
|
||||||
IProject project = (IProject) getOwner();
|
IProject project = (IProject) getOwner();
|
||||||
ITarget defTarget = getDefaultTarget();
|
ITarget defTarget = getDefaultTarget();
|
||||||
if (defTarget != null){
|
if (defTarget != null){
|
||||||
try {
|
try {
|
||||||
project.setPersistentProperty(defaultTargetProperty, defTarget.getId());
|
project.setPersistentProperty(defaultTargetProperty, defTarget.getId());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// There is no point in storing the default configurations
|
// Tough
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
try {
|
|
||||||
// Persist the default configurations
|
/**
|
||||||
project.setPersistentProperty(defaultConfigProperty, defaultConfigs.toString().trim());
|
* Write the contents of the build model to the persistent store
|
||||||
} catch (CoreException e) {
|
* specified in the argument.
|
||||||
// Too bad
|
*
|
||||||
|
* @param doc
|
||||||
|
* @param element
|
||||||
|
*/
|
||||||
|
public void serialize(Document doc, Element element) {
|
||||||
|
// Write out each target
|
||||||
|
Iterator iter = getTargets().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
// Get the target
|
||||||
|
Target targ = (Target)iter.next();
|
||||||
|
// Create an XML element to hold the target settings
|
||||||
|
Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME);
|
||||||
|
element.appendChild(targetElement);
|
||||||
|
targ.serialize(doc, targetElement);
|
||||||
}
|
}
|
||||||
|
// Remember the default target and configurations
|
||||||
|
persistDefaultTarget();
|
||||||
|
persistDefaultConfigurations();
|
||||||
|
// I'm clean now
|
||||||
|
setDirty(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
|
||||||
*/
|
*/
|
||||||
public void setDefaultConfiguration(IConfiguration configuration) {
|
public void setDefaultConfiguration(IConfiguration configuration) {
|
||||||
|
// Sanity
|
||||||
|
if (configuration== null) return;
|
||||||
|
|
||||||
// Get the target associated with the argument
|
// Get the target associated with the argument
|
||||||
ITarget target = configuration.getTarget();
|
ITarget target = configuration.getTarget();
|
||||||
// Make sure it is the default
|
|
||||||
setDefaultTarget(target);
|
// See if there is anything to be done
|
||||||
getDefaultConfigMap().put(target.getId(), configuration);
|
IConfiguration oldDefault = getDefaultConfiguration(target);
|
||||||
|
if (!configuration.equals(oldDefault)) {
|
||||||
|
// Make sure it is the default
|
||||||
|
setDefaultTarget(target);
|
||||||
|
// Make the argument the
|
||||||
|
getDefaultConfigMap().put(target.getId(), configuration);
|
||||||
|
// Save it
|
||||||
|
persistDefaultConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
|
||||||
*/
|
*/
|
||||||
public void setDefaultTarget(ITarget target) {
|
public void setDefaultTarget(ITarget target) {
|
||||||
if (defaultTarget != null && defaultTarget.getId().equals(target.getId())) {
|
// Sanity
|
||||||
return;
|
if (target == null) return;
|
||||||
|
|
||||||
|
// Make sure there is something to change
|
||||||
|
if (!target.equals(defaultTarget)) {
|
||||||
|
defaultTarget = target;
|
||||||
|
defaultTargetId = target.getId();
|
||||||
|
persistDefaultTarget();
|
||||||
}
|
}
|
||||||
defaultTarget = target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setDirty(boolean)
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setDirty(boolean)
|
||||||
*/
|
*/
|
||||||
public void setDirty(boolean isDirty) {
|
public void setDirty(boolean isDirty) {
|
||||||
|
// Reset the dirty status here
|
||||||
this.isDirty = isDirty;
|
this.isDirty = isDirty;
|
||||||
|
// and in the contained targets
|
||||||
|
Iterator iter = getTargets().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
ITarget target = (ITarget)iter.next();
|
||||||
|
target.setDirty(isDirty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -979,7 +1016,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
if (!owner.equals(resource)) {
|
if (!owner.equals(resource)) {
|
||||||
owner = resource;
|
owner = resource;
|
||||||
// Do the same for the targets
|
// Do the same for the targets
|
||||||
Iterator iter = targetList.listIterator();
|
Iterator iter = getTargets().listIterator();
|
||||||
while(iter.hasNext()) {
|
while(iter.hasNext()) {
|
||||||
ITarget target = (ITarget) iter.next();
|
ITarget target = (ITarget) iter.next();
|
||||||
target.updateOwner(resource);
|
target.updateOwner(resource);
|
||||||
|
|
|
@ -37,11 +37,12 @@ public class Target extends BuildObject implements ITarget {
|
||||||
private String artifactName;
|
private String artifactName;
|
||||||
private String binaryParserId;
|
private String binaryParserId;
|
||||||
private String cleanCommand;
|
private String cleanCommand;
|
||||||
|
private List configList;
|
||||||
private Map configMap;
|
private Map configMap;
|
||||||
private List configurations;
|
|
||||||
private String defaultExtension;
|
private String defaultExtension;
|
||||||
private String extension;
|
private String extension;
|
||||||
private boolean isAbstract = false;
|
private boolean isAbstract = false;
|
||||||
|
private boolean isDirty = false;
|
||||||
private boolean isTest = false;
|
private boolean isTest = false;
|
||||||
private String makeArguments;
|
private String makeArguments;
|
||||||
private String makeCommand;
|
private String makeCommand;
|
||||||
|
@ -252,12 +253,10 @@ public class Target extends BuildObject implements ITarget {
|
||||||
ToolReference current = (ToolReference)refIter.next();
|
ToolReference current = (ToolReference)refIter.next();
|
||||||
current.resolveReferences();
|
current.resolveReferences();
|
||||||
}
|
}
|
||||||
if (configurations != null) {
|
Iterator configIter = getConfigurationList().iterator();
|
||||||
Iterator configIter = configurations.iterator();
|
while (configIter.hasNext()) {
|
||||||
while (configIter.hasNext()) {
|
Configuration current = (Configuration)configIter.next();
|
||||||
Configuration current = (Configuration)configIter.next();
|
current.resolveReferences();
|
||||||
current.resolveReferences();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,12 +266,13 @@ public class Target extends BuildObject implements ITarget {
|
||||||
*/
|
*/
|
||||||
public void removeConfiguration(String id) {
|
public void removeConfiguration(String id) {
|
||||||
// Remove the specified configuration from the list and map
|
// Remove the specified configuration from the list and map
|
||||||
Iterator iter = configurations.listIterator();
|
Iterator iter = getConfigurationList().listIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IConfiguration config = (IConfiguration)iter.next();
|
IConfiguration config = (IConfiguration)iter.next();
|
||||||
if (config.getId().equals(id)) {
|
if (config.getId().equals(id)) {
|
||||||
configurations.remove(config);
|
getConfigurationList().remove(config);
|
||||||
configMap.remove(id);
|
getConfigurationMap().remove(id);
|
||||||
|
isDirty = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,14 +310,18 @@ public class Target extends BuildObject implements ITarget {
|
||||||
if (makeArguments != null) {
|
if (makeArguments != null) {
|
||||||
element.setAttribute(MAKE_ARGS, makeArguments);
|
element.setAttribute(MAKE_ARGS, makeArguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configurations != null)
|
// Serialize the configuration settings
|
||||||
for (int i = 0; i < configurations.size(); ++i) {
|
Iterator iter = getConfigurationList().listIterator();
|
||||||
Configuration config = (Configuration)configurations.get(i);
|
while (iter.hasNext()) {
|
||||||
Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
|
Configuration config = (Configuration) iter.next();
|
||||||
element.appendChild(configElement);
|
Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
|
||||||
config.serialize(doc, configElement);
|
element.appendChild(configElement);
|
||||||
}
|
config.serialize(doc, configElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I am clean now
|
||||||
|
isDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-javadoc)
|
/* (non-javadoc)
|
||||||
|
@ -566,14 +570,35 @@ public class Target extends BuildObject implements ITarget {
|
||||||
getToolMap().put(tool.getId(), tool);
|
getToolMap().put(tool.getId(), tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Safe accessor for the list of configurations.
|
||||||
|
*
|
||||||
|
* @return List containing the configurations
|
||||||
|
*/
|
||||||
|
private List getConfigurationList() {
|
||||||
|
if (configList == null) {
|
||||||
|
configList = new ArrayList();
|
||||||
|
}
|
||||||
|
return configList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Safe accessor for the map of configuration ids to configurations
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map getConfigurationMap() {
|
||||||
|
if (configMap == null) {
|
||||||
|
configMap = new HashMap();
|
||||||
|
}
|
||||||
|
return configMap;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations()
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations()
|
||||||
*/
|
*/
|
||||||
public IConfiguration[] getConfigurations() {
|
public IConfiguration[] getConfigurations() {
|
||||||
if (configurations != null)
|
return (IConfiguration[])getConfigurationList().toArray(new IConfiguration[getConfigurationList().size()]);
|
||||||
return (IConfiguration[])configurations.toArray(new IConfiguration[configurations.size()]);
|
|
||||||
else
|
|
||||||
return emptyConfigs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -665,19 +690,15 @@ public class Target extends BuildObject implements ITarget {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
|
* @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
|
||||||
*/
|
*/
|
||||||
public IConfiguration getConfiguration(String id) {
|
public IConfiguration getConfiguration(String id) {
|
||||||
return (IConfiguration)configMap.get(id);
|
return (IConfiguration)getConfigurationMap().get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param configuration
|
* @param configuration
|
||||||
*/
|
*/
|
||||||
public void addConfiguration(IConfiguration configuration) {
|
public void addConfiguration(IConfiguration configuration) {
|
||||||
if (configurations == null) {
|
getConfigurationList().add(configuration);
|
||||||
configurations = new ArrayList();
|
getConfigurationMap().put(configuration.getId(), configuration);
|
||||||
configMap = new HashMap();
|
|
||||||
}
|
|
||||||
configurations.add(configuration);
|
|
||||||
configMap.put(configuration.getId(), configuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -687,6 +708,25 @@ public class Target extends BuildObject implements ITarget {
|
||||||
return isAbstract;
|
return isAbstract;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#isDirty()
|
||||||
|
*/
|
||||||
|
public boolean isDirty() {
|
||||||
|
// If I need saving, just say yes
|
||||||
|
if (isDirty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate over the configurations and ask them if they need saving
|
||||||
|
Iterator iter = getConfigurationList().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
if (((IConfiguration)iter.next()).isDirty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITarget#isTestTarget()
|
* @see org.eclipse.cdt.core.build.managed.ITarget#isTestTarget()
|
||||||
*/
|
*/
|
||||||
|
@ -705,6 +745,7 @@ public class Target extends BuildObject implements ITarget {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
|
* @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
|
||||||
*/
|
*/
|
||||||
public IConfiguration createConfiguration(IConfiguration parent, String id) {
|
public IConfiguration createConfiguration(IConfiguration parent, String id) {
|
||||||
|
isDirty = true;
|
||||||
return new Configuration(this, parent, id);
|
return new Configuration(this, parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,6 +764,7 @@ public class Target extends BuildObject implements ITarget {
|
||||||
public void setArtifactExtension(String extension) {
|
public void setArtifactExtension(String extension) {
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
this.extension = extension;
|
this.extension = extension;
|
||||||
|
isDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,16 +773,32 @@ public class Target extends BuildObject implements ITarget {
|
||||||
*/
|
*/
|
||||||
public void setArtifactName(String name) {
|
public void setArtifactName(String name) {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
artifactName = name;
|
artifactName = name;
|
||||||
|
isDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setDirty(boolean)
|
||||||
|
*/
|
||||||
|
public void setDirty(boolean isDirty) {
|
||||||
|
// Override the dirty flag here
|
||||||
|
this.isDirty = isDirty;
|
||||||
|
// and in the configurations
|
||||||
|
Iterator iter = getConfigurationList().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
IConfiguration config = (IConfiguration)iter.next();
|
||||||
|
config.setDirty(isDirty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setMakeArguments(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setMakeArguments(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void setMakeArguments(String makeArgs) {
|
public void setMakeArguments(String makeArgs) {
|
||||||
if (makeArgs != null && !getMakeArguments().equals(makeArgs)) {
|
if (makeArgs != null && !getMakeArguments().equals(makeArgs)) {
|
||||||
makeArguments = makeArgs;
|
makeArguments = makeArgs;
|
||||||
|
isDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,6 +808,7 @@ public class Target extends BuildObject implements ITarget {
|
||||||
public void setMakeCommand(String command) {
|
public void setMakeCommand(String command) {
|
||||||
if (command != null && !getMakeCommand().equals(command)) {
|
if (command != null && !getMakeCommand().equals(command)) {
|
||||||
makeCommand = command;
|
makeCommand = command;
|
||||||
|
isDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,10 +366,14 @@ public class ToolReference extends AbstractToolReference {
|
||||||
* Sets the command in the receiver to be the argument.
|
* Sets the command in the receiver to be the argument.
|
||||||
*
|
*
|
||||||
* @param cmd
|
* @param cmd
|
||||||
*/
|
* @return <code>true</code> if the call results in a chnaged command, else <code>false</code>
|
||||||
public void setToolCommand(String cmd) {
|
*/
|
||||||
|
public boolean setToolCommand(String cmd) {
|
||||||
if (cmd != null && !cmd.equals(command)) {
|
if (cmd != null && !cmd.equals(command)) {
|
||||||
command = cmd;
|
command = cmd;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,6 +41,7 @@ BuildPropertyPage.label.Configuration=Configuration:
|
||||||
BuildPropertyPage.label.Active=Active configuration
|
BuildPropertyPage.label.Active=Active configuration
|
||||||
BuildPropertyPage.label.Settings=Configuration settings
|
BuildPropertyPage.label.Settings=Configuration settings
|
||||||
BuildPropertyPage.label.AddConfButton=Manage...
|
BuildPropertyPage.label.AddConfButton=Manage...
|
||||||
|
BuildPropertyPage.selection.configuration.all=All configurations
|
||||||
BuildPropertyPage.label.ToolTree=Tools
|
BuildPropertyPage.label.ToolTree=Tools
|
||||||
BuildPropertyPage.label.ToolOptions=Options
|
BuildPropertyPage.label.ToolOptions=Options
|
||||||
BuildPropertyPage.tip.platform=Select a platform for the project
|
BuildPropertyPage.tip.platform=Select a platform for the project
|
||||||
|
|
|
@ -75,6 +75,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
private static final String BUILD_TOOLS_LABEL = LABEL + ".BuildToolTree"; //$NON-NLS-1$
|
private static final String BUILD_TOOLS_LABEL = LABEL + ".BuildToolTree"; //$NON-NLS-1$
|
||||||
private static final String PLATFORM_LABEL = LABEL + ".Platform"; //$NON-NLS-1$
|
private static final String PLATFORM_LABEL = LABEL + ".Platform"; //$NON-NLS-1$
|
||||||
private static final String CONFIG_LABEL = LABEL + ".Configuration"; //$NON-NLS-1$
|
private static final String CONFIG_LABEL = LABEL + ".Configuration"; //$NON-NLS-1$
|
||||||
|
private static final String ALL_CONFS = PREFIX + ".selection.configuration.all"; //$NON-NLS-1$
|
||||||
private static final String ACTIVE_LABEL = LABEL + ".Active"; //$NON-NLS-1$
|
private static final String ACTIVE_LABEL = LABEL + ".Active"; //$NON-NLS-1$
|
||||||
private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
|
private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
|
||||||
private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
|
private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
|
||||||
|
@ -453,8 +454,15 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
// If there is nothing in config selection widget just bail
|
// If there is nothing in config selection widget just bail
|
||||||
if (configSelector.getItemCount() == 0) return;
|
if (configSelector.getItemCount() == 0) return;
|
||||||
|
|
||||||
// Cache the selected config
|
// Check if the user has selected the "all" configuration
|
||||||
selectedConfiguration = configurations[configSelector.getSelectionIndex()];
|
int selectionIndex = configSelector.getSelectionIndex();
|
||||||
|
if (selectionIndex >= configurations.length) {
|
||||||
|
// This is the all config
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// Cache the selected config
|
||||||
|
selectedConfiguration = configurations[selectionIndex];
|
||||||
|
}
|
||||||
|
|
||||||
// Set the content provider for the list viewer
|
// Set the content provider for the list viewer
|
||||||
ToolListContentProvider provider = new ToolListContentProvider();
|
ToolListContentProvider provider = new ToolListContentProvider();
|
||||||
|
@ -768,7 +776,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
|
|
||||||
// Write out the build model info
|
// Write out the build model info
|
||||||
ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
|
ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
|
||||||
ManagedBuildManager.saveBuildInfo(getProject());
|
ManagedBuildManager.saveBuildInfo(getProject(), false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,6 +790,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
// Clear and replace the contents of the selector widget
|
// Clear and replace the contents of the selector widget
|
||||||
configSelector.removeAll();
|
configSelector.removeAll();
|
||||||
configSelector.setItems(getConfigurationNames());
|
configSelector.setItems(getConfigurationNames());
|
||||||
|
configSelector.add(ManagedBuilderUIPlugin.getResourceString(ALL_CONFS));
|
||||||
|
|
||||||
// Make sure the active configuration is selected
|
// Make sure the active configuration is selected
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.jface.preference.StringFieldEditor;
|
import org.eclipse.jface.preference.StringFieldEditor;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
@ -77,13 +77,9 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The tool may be a reference.
|
// Ask the build system manager to change the tool command
|
||||||
if (tool instanceof ToolReference) {
|
ManagedBuildManager.setToolCommand(configuration, tool, command);
|
||||||
// If so, just set the command in the reference
|
|
||||||
((ToolReference)tool).setToolCommand(command);
|
|
||||||
} else {
|
|
||||||
configuration.setToolCommand(tool, command);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,20 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
|
||||||
private boolean dirtyFlag;
|
private boolean dirtyFlag;
|
||||||
private IConfiguration owner;
|
private IConfiguration owner;
|
||||||
|
|
||||||
public BuildToolsSettingsStore (IConfiguration config) {
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public BuildToolsSettingsStore() {
|
||||||
listenerList = new ListenerList();
|
listenerList = new ListenerList();
|
||||||
dirtyFlag = false;
|
dirtyFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
public BuildToolsSettingsStore (IConfiguration config) {
|
||||||
|
this();
|
||||||
owner = config;
|
owner = config;
|
||||||
|
|
||||||
// Now populate the options map
|
// Now populate the options map
|
||||||
populateSettingsMap();
|
populateSettingsMap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
|
|
||||||
// Save the build options
|
// Save the build options
|
||||||
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE));
|
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE));
|
||||||
ManagedBuildManager.saveBuildInfo(newProject);
|
ManagedBuildManager.saveBuildInfo(newProject, true);
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue