1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Add IOptionApplicability callback

Add more multi-version tool-chain support
Fix some cases for using relative paths in makefile generation
This commit is contained in:
Leo Treggiari 2005-05-26 21:17:34 +00:00
parent f8dc010214
commit 107015f427
25 changed files with 1033 additions and 184 deletions

View file

@ -118,6 +118,16 @@
</appInfo> </appInfo>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="configurationNameProvider" type="string">
<annotation>
<documentation>
Contains the name of a class that implements an interface with a method for returning a default name for a configuration
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider"/>
</appInfo>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>
@ -236,6 +246,13 @@
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="description" type="string">
<annotation>
<documentation>
Specifies the description of the configuration that will be displayed to the user while creating a project and managing configurations
</documentation>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>
@ -358,6 +375,20 @@
</appInfo> </appInfo>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="versionsSupported" type="string">
<annotation>
<documentation>
Specifies a comma delimited list of versions of this tool-chain that can be loaded without invoking a converter.
</documentation>
</annotation>
</attribute>
<attribute name="convertToId" type="string">
<annotation>
<documentation>
The identifier of a tool-chain, that tool-chains loaded using this definition should be converted to. MBS will invoke a proper converter.
</documentation>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>
@ -563,6 +594,20 @@
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="versionsSupported" type="string">
<annotation>
<documentation>
Specifies a comma delimited list of versions of this tool that can be loaded without invoking a converter.
</documentation>
</annotation>
</attribute>
<attribute name="convertToId" type="string">
<annotation>
<documentation>
The identifier of a tool, that tools loaded using this definition should be converted to. MBS will invoke a proper converter.
</documentation>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>
@ -1035,6 +1080,16 @@ Additional special types exist to flag options of special relevance to the build
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="applicabilityCalculator" type="string">
<annotation>
<documentation>
Optional class which is used to determine dynamically at runtime whether the option is visible, enabled, and used in command line generation. This class must impelment the IOptionApplicability interface. If no calculator is specified then the option is always visible, enabled, and used in command line generation.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IOptionApplicability"/>
</appInfo>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>
@ -1219,7 +1274,6 @@ If this attribute is not specified, MBS will assume that there are no reserved m
Represents the InputFileName macro value. The macro specifies the input file name. The input file has the following meaning: Represents the InputFileName macro value. The macro specifies the input file name. The input file has the following meaning:
1. If a tool does not accept building multiple files of the primary input type with one tool invocation, the input file is the file of the primary input type being built. 1. If a tool does not accept building multiple files of the primary input type with one tool invocation, the input file is the file of the primary input type being built.
2. If a tool accepts building multiple files of the primary input type with one tool invocation the input file is undefined and the macros representing the input file contain information about one of the inputs of the primary input type being built. 2. If a tool accepts building multiple files of the primary input type with one tool invocation the input file is undefined and the macros representing the input file contain information about one of the inputs of the primary input type being built.
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
@ -1257,7 +1311,6 @@ If this attribute is not specified, MBS will assume that there are no reserved m
Represents the OutputFileName macro value. The macro specifies the output file name. The output file has the following meaning: Represents the OutputFileName macro value. The macro specifies the output file name. The output file has the following meaning:
1. If a tool is not capable of producing multiple files of the primary output type with one tool invocation the output file is the file of the primary output type that is built with a given tool invocation. 1. If a tool is not capable of producing multiple files of the primary output type with one tool invocation the output file is the file of the primary output type that is built with a given tool invocation.
2. If a tool is capable of producing multiple files of the primary output type with one tool invocation the output file is undefined and the macros representing the output file contain information about one of the files of the primary output type that are built with a given tool invocation. 2. If a tool is capable of producing multiple files of the primary output type with one tool invocation the output file is undefined and the macros representing the output file contain information about one of the files of the primary output type that are built with a given tool invocation.
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
@ -1289,6 +1342,20 @@ If this attribute is not specified, MBS will assume that there are no reserved m
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="versionsSupported" type="string">
<annotation>
<documentation>
Specifies a comma delimited list of versions of this builder that can be loaded without invoking a converter.
</documentation>
</annotation>
</attribute>
<attribute name="convertToId" type="string">
<annotation>
<documentation>
The identifier of a builder, that builders loaded using this definition should be converted to. MBS will invoke a proper converter.
</documentation>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>

View file

@ -10,6 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.managedbuilder.core; package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.core.runtime.PluginVersionIdentifier;
public interface IBuildObject { public interface IBuildObject {
// Schema element names // Schema element names
public static final String ID = "id"; //$NON-NLS-1$ public static final String ID = "id"; //$NON-NLS-1$
@ -17,5 +19,7 @@ public interface IBuildObject {
public String getId(); public String getId();
public String getName(); public String getName();
public PluginVersionIdentifier getVersion();
public void setVersion(PluginVersionIdentifier version);
public String getManagedBuildRevision();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2004 IBM Corporation and others. * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -49,6 +49,7 @@ public interface IOption extends IBuildObject {
public static final String IS_DEFAULT = "isDefault"; //$NON-NLS-1$ public static final String IS_DEFAULT = "isDefault"; //$NON-NLS-1$
public static final String LIST_VALUE = "listOptionValue"; //$NON-NLS-1$ public static final String LIST_VALUE = "listOptionValue"; //$NON-NLS-1$
public static final String RESOURCE_FILTER = "resourceFilter"; //$NON-NLS-1$ public static final String RESOURCE_FILTER = "resourceFilter"; //$NON-NLS-1$
public static final String APPLICABILITY_CALCULATOR = "applicabilityCalculator"; //$NON-NLS-1$
public static final String TYPE_BOOL = "boolean"; //$NON-NLS-1$ public static final String TYPE_BOOL = "boolean"; //$NON-NLS-1$
public static final String TYPE_ENUM = "enumerated"; //$NON-NLS-1$ public static final String TYPE_ENUM = "enumerated"; //$NON-NLS-1$
public static final String TYPE_INC_PATH = "includePath"; //$NON-NLS-1$ public static final String TYPE_INC_PATH = "includePath"; //$NON-NLS-1$
@ -125,6 +126,12 @@ public interface IOption extends IBuildObject {
*/ */
public void setResourceFilter(int filter); public void setResourceFilter(int filter);
/**
* @return an instance of the class that calculates whether the option is visible,
* enabled, and used in command line generation
*/
public IOptionApplicability getApplicabilityCalculator();
/** /**
* Answers an array of strings containing the built-in values * Answers an array of strings containing the built-in values
* defined for a stringList, includePaths, definedSymbols, or libs * defined for a stringList, includePaths, definedSymbols, or libs

View file

@ -0,0 +1,53 @@
/*******************************************************************************
* Copyright (c) 2005 Texas Instruments Inc. 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Texas Instruments Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
/**
* This interface determines whether or not the option is currently displayed,
* enabled, and used in command-line generation.
*/
public interface IOptionApplicability {
/**
* This method is queried whenever a makefile or makefile fragment is
* generated which uses this option, and in the C/C++ Build property
* pages when displaying the current command line.
*
* @param toolParent The parent tool for this option. This provides
* a context for obtaining other information from the MBS
* @return true if this this option is to be used in command line
* generation, false otherwise
*/
public boolean isOptionUsedInCommandLine(ITool toolParent);
/**
* This method is queried whenever a new option category is displayed.
*
* @param toolParent The parent tool for this option. This provides
* a context for obtaining other information from the MBS
* @return true if this option should be visible in the build options page,
* false otherwise
*/
public boolean isOptionVisible(ITool toolParent);
/**
* Whenever the value of an option changes in the GUI, this method is
* queried on all other visible options for the same category. Note that
* this occurs when the GUI changes - the user may opt to cancel these
* changes.
*
* @param toolParent The parent tool for this option. This provides
* a context for obtaining other information from the MBS
* @return true if this option should be enabled in the build options page,
* or false if it should be disabled (grayed out)
*/
public boolean isOptionEnabled(ITool toolParent);
}

View file

@ -291,9 +291,9 @@ public interface ITarget extends IBuildObject {
/** /**
* Converts a CDT V2.0 target into a ProjectType + Configuration + Toolchain + * Converts a CDT V2.0 target into a ProjectType + Configuration + Toolchain +
* Builder + TargetPlatform. * Builder + TargetPlatform.
* * @param managedBuildRevision
*/ */
public void convertToProjectType(); public void convertToProjectType(String managedBuildRevision);
/** /**
* Returns the <code>ProjectType</code> that this Target has been converted to, * Returns the <code>ProjectType</code> that this Target has been converted to,

View file

@ -1342,7 +1342,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
NodeList nodes = document.getElementsByTagName(ROOT_NODE_NAME); NodeList nodes = document.getElementsByTagName(ROOT_NODE_NAME);
if (nodes.getLength() > 0) { if (nodes.getLength() > 0) {
Node node = nodes.item(0); Node node = nodes.item(0);
buildInfo = new ManagedBuildInfo(project, (Element)node); buildInfo = new ManagedBuildInfo(project, (Element)node, fileVersion);
if (fileVersion != null) { if (fileVersion != null) {
buildInfo.setVersion(fileVersion); buildInfo.setVersion(fileVersion);
} }
@ -1424,7 +1424,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
// reflects the content and structure of the extension section within the // reflects the content and structure of the extension section within the
// declaring plug-in's manifest (plugin.xml) file. // declaring plug-in's manifest (plugin.xml) file.
IConfigurationElement[] elements = extension.getConfigurationElements(); IConfigurationElement[] elements = extension.getConfigurationElements();
loadConfigElements(DefaultManagedConfigElement.convertArray(elements)); String revision = null;
// Get the managedBuildRevsion of the extension.
for (int j = 0; j < elements.length; j++) {
IConfigurationElement element = elements[j];
if( element.getName().equals(REVISION_ELEMENT_NAME) ) {
revision = element.getAttribute(VERSION_ELEMENT_NAME);
break;
}
}
// Get the value of 'ManagedBuilRevision' attribute
loadConfigElements(DefaultManagedConfigElement.convertArray(elements), revision);
} }
} }
// Then call resolve. // Then call resolve.
@ -1541,6 +1554,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID_V2); extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID_V2);
if( extensionPoint != null) { if( extensionPoint != null) {
IExtension[] extensions = extensionPoint.getExtensions(); IExtension[] extensions = extensionPoint.getExtensions();
String revision = null;
if (extensions != null) { if (extensions != null) {
if (extensions.length > 0) { if (extensions.length > 0) {
@ -1555,7 +1570,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR)); throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
} }
IConfigurationElement[] elements = extension.getConfigurationElements(); IConfigurationElement[] elements = extension.getConfigurationElements();
loadConfigElementsV2(DefaultManagedConfigElement.convertArray(elements));
// Get the managedBuildRevsion of the extension.
for (int j = 0; j < elements.length; j++) {
IConfigurationElement element = elements[j];
if(element.getName().equals(REVISION_ELEMENT_NAME)) {
revision = element.getAttribute(VERSION_ELEMENT_NAME);
break;
}
}
// If the "fileVersion" attribute is missing, then default revision is "1.2.0"
if (revision == null)
revision = "1.2.0"; //$NON-NLS-1$
loadConfigElementsV2(DefaultManagedConfigElement.convertArray(elements), revision);
} }
// Resolve references // Resolve references
Iterator targetIter = getExtensionTargetMap().values().iterator(); Iterator targetIter = getExtensionTargetMap().values().iterator();
@ -1586,7 +1613,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
Target target = (Target)targetIter.next(); Target target = (Target)targetIter.next();
// Check to see if it has already been converted - if not, do it // Check to see if it has already been converted - if not, do it
if (target.getCreatedProjectType() == null) { if (target.getCreatedProjectType() == null) {
target.convertToProjectType(); target.convertToProjectType(revision);
} }
} catch (Exception ex) { } catch (Exception ex) {
// TODO: log // TODO: log
@ -1625,23 +1652,23 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
} }
} }
private static void loadConfigElements(IManagedConfigElement[] elements) { private static void loadConfigElements(IManagedConfigElement[] elements, String revision) {
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) { for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {
try { try {
IManagedConfigElement element = elements[toolIndex]; IManagedConfigElement element = elements[toolIndex];
// Load the top level elements, which in turn load their children // Load the top level elements, which in turn load their children
if (element.getName().equals(IProjectType.PROJECTTYPE_ELEMENT_NAME)) { if (element.getName().equals(IProjectType.PROJECTTYPE_ELEMENT_NAME)) {
new ProjectType(element); new ProjectType(element, revision);
} else if (element.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) { } else if (element.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
new Configuration((ProjectType)null, element); new Configuration((ProjectType)null, element, revision);
} else if (element.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) { } else if (element.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
new ToolChain((Configuration)null, element); new ToolChain((Configuration)null, element, revision);
} else if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) { } else if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
new Tool((ProjectType)null, element); new Tool((ProjectType)null, element, revision);
} else if (element.getName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) { } else if (element.getName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
new TargetPlatform((ToolChain)null, element); new TargetPlatform((ToolChain)null, element, revision);
} else if (element.getName().equals(IBuilder.BUILDER_ELEMENT_NAME)) { } else if (element.getName().equals(IBuilder.BUILDER_ELEMENT_NAME)) {
new Builder((ToolChain)null, element); new Builder((ToolChain)null, element, revision);
} else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) { } else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) {
// don't allow nested config providers. // don't allow nested config providers.
if (element instanceof DefaultManagedConfigElement) { if (element instanceof DefaultManagedConfigElement) {
@ -1649,7 +1676,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
IManagedConfigElementProvider provider = createConfigProvider( IManagedConfigElementProvider provider = createConfigProvider(
(DefaultManagedConfigElement)element); (DefaultManagedConfigElement)element);
providedConfigs = provider.getConfigElements(); providedConfigs = provider.getConfigElements();
loadConfigElements(providedConfigs); // This must use the current build model loadConfigElements(providedConfigs, revision); // This must use the current build model
} }
} else { } else {
// TODO: Report an error (log?) // TODO: Report an error (log?)
@ -1661,15 +1688,15 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
} }
} }
private static void loadConfigElementsV2(IManagedConfigElement[] elements) { private static void loadConfigElementsV2(IManagedConfigElement[] elements, String revision) {
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) { for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {
try { try {
IManagedConfigElement element = elements[toolIndex]; IManagedConfigElement element = elements[toolIndex];
// Load the top level elements, which in turn load their children // Load the top level elements, which in turn load their children
if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) { if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
new Tool(element); new Tool(element, revision);
} else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) { } else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
new Target(element); new Target(element,revision);
} else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) { } else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) {
// don't allow nested config providers. // don't allow nested config providers.
if (element instanceof DefaultManagedConfigElement) { if (element instanceof DefaultManagedConfigElement) {
@ -1677,7 +1704,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
IManagedConfigElementProvider provider = createConfigProvider( IManagedConfigElementProvider provider = createConfigProvider(
(DefaultManagedConfigElement)element); (DefaultManagedConfigElement)element);
providedConfigs = provider.getConfigElements(); providedConfigs = provider.getConfigElements();
loadConfigElementsV2(providedConfigs); // This must use the 2.0 build model loadConfigElementsV2(providedConfigs, revision); // This must use the 2.0 build model
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
@ -2051,6 +2078,54 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return EnvironmentVariableProvider.getDefault(); return EnvironmentVariableProvider.getDefault();
} }
/**
* Returns the version, if 'id' contains a valid version
* Returns null if 'id' does not contain a valid version
* Returns null if 'id' does not contain a version
*
* @param idAndVersion
* @return String
*/
public static String getVersionFromIdAndVersion(String idAndVersion) {
// Get the index of the separator '_' in tool id.
int index = idAndVersion.lastIndexOf('_');
//Validate the version number if exists.
if ( index != -1) {
// Get the version number from tool id.
String version = idAndVersion.substring(index+1);
IStatus status = PluginVersionIdentifier.validateVersion(version);
// If there is a valid version then return 'version'
if ( status.isOK())
return version;
}
// If there is no version information or not a valid version, return null
return null;
}
/**
* If the input to this function contains 'id & a valid version', it returns only the 'id' part
* Otherwise it returns the received input back.
*
* @param idAndVersion
* @return String
*/
public static String getIdFromIdAndVersion(String idAndVersion) {
// If there is a valid version return only 'id' part
if ( getVersionFromIdAndVersion(idAndVersion) != null) {
// Get the index of the separator '_' in tool id.
int index = idAndVersion.lastIndexOf('_');
return idAndVersion.substring(0,index);
}
else {
// if there is no version or no valid version
return idAndVersion;
}
}
/** /**
* Returns the instance of the Build Macro Provider * Returns the instance of the Build Macro Provider
* *
@ -2059,5 +2134,4 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
public static IBuildMacroProvider getBuildMacroProvider(){ public static IBuildMacroProvider getBuildMacroProvider(){
return BuildMacroProvider.getDefault(); return BuildMacroProvider.getDefault();
} }
} }

View file

@ -12,12 +12,18 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import org.eclipse.cdt.managedbuilder.core.IBuildObject; import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PluginVersionIdentifier;
public class BuildObject implements IBuildObject { public class BuildObject implements IBuildObject {
protected String id; protected String id;
protected String name; protected String name;
protected PluginVersionIdentifier version = null;
protected String managedBuildRevision = null;
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId() * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
*/ */
@ -52,4 +58,57 @@ public class BuildObject implements IBuildObject {
public String toString() { public String toString() {
return name; return name;
} }
/**
* @return Returns the managedBuildRevision.
*/
public String getManagedBuildRevision() {
return managedBuildRevision;
}
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
return version;
}
/**
* @param version The version to set.
*/
public void setVersion(PluginVersionIdentifier version) {
this.version = version;
}
public PluginVersionIdentifier getVersionFromId() {
String versionNumber;
IStatus status = null;
versionNumber = ManagedBuildManager.getVersionFromIdAndVersion( getId());
if( versionNumber == null) {
// It means, Tool Integrator either not provided version information in 'id' or provided in wrong format,
// So get the default version based on 'managedBuildRevision' attribute.
if ( getManagedBuildRevision() != null) {
PluginVersionIdentifier tmpManagedBuildRevision = new PluginVersionIdentifier( getManagedBuildRevision() );
if (tmpManagedBuildRevision.isEquivalentTo(new PluginVersionIdentifier("1.2.0")) ) //$NON-NLS-1$
versionNumber = "0.0.1"; //$NON-NLS-1$
else if (tmpManagedBuildRevision.isEquivalentTo(new PluginVersionIdentifier("2.0.0")) ) //$NON-NLS-1$
versionNumber = "0.0.2"; //$NON-NLS-1$
else if (tmpManagedBuildRevision.isEquivalentTo(new PluginVersionIdentifier("2.1.0")) ) //$NON-NLS-1$
versionNumber = "0.0.3"; //$NON-NLS-1$
else
versionNumber = "0.0.4"; //$NON-NLS-1$
} else {
versionNumber = "0.0.0"; //$NON-NLS-1$
}
}
return new PluginVersionIdentifier(versionNumber);
}
public void setManagedBuildRevision(String managedBuildRevision) {
this.managedBuildRevision = managedBuildRevision;
}
} }

View file

@ -70,14 +70,18 @@ public class Builder extends BuildObject implements IBuilder {
* defined at the top level * defined at the top level
* @param element The builder definition from the manifest file or a dynamic element * @param element The builder definition from the manifest file or a dynamic element
* provider * provider
* @param managedBuildRevision The fileVersion of Managed Buid System
*/ */
public Builder(IToolChain parent, IManagedConfigElement element) { public Builder(IToolChain parent, IManagedConfigElement element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionBuilder = true; isExtensionBuilder = true;
// setup for resolving // setup for resolving
resolved = false; resolved = false;
// Set the managedBuildRevision
setManagedBuildRevision(managedBuildRevision);
loadFromManifest(element); loadFromManifest(element);
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -97,11 +101,14 @@ public class Builder extends BuildObject implements IBuilder {
public Builder(ToolChain parent, IBuilder superClass, String Id, String name, boolean isExtensionElement) { public Builder(ToolChain parent, IBuilder superClass, String Id, String name, boolean isExtensionElement) {
this.parent = parent; this.parent = parent;
this.superClass = superClass; this.superClass = superClass;
setManagedBuildRevision(parent.getManagedBuildRevision());
if (this.superClass != null) { if (this.superClass != null) {
superClassId = this.superClass.getId(); superClassId = this.superClass.getId();
} }
setId(Id); setId(Id);
setName(name); setName(name);
setVersion(getVersionFromId());
isExtensionBuilder = isExtensionElement; isExtensionBuilder = isExtensionElement;
if (isExtensionElement) { if (isExtensionElement) {
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -117,11 +124,15 @@ public class Builder extends BuildObject implements IBuilder {
* *
* @param parent The <code>IToolChain</code> the Builder will be added to. * @param parent The <code>IToolChain</code> the Builder will be added to.
* @param element The XML element that contains the Builder settings. * @param element The XML element that contains the Builder settings.
* @param managedBuildRevision The fileVersion of Managed Buid System
*/ */
public Builder(IToolChain parent, Element element) { public Builder(IToolChain parent, Element element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionBuilder = false; isExtensionBuilder = false;
// Set the managedBuildRevision
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromProject(element); loadFromProject(element);
} }
@ -142,9 +153,20 @@ public class Builder extends BuildObject implements IBuilder {
} }
setId(Id); setId(Id);
setName(name); setName(name);
// Set the managedBuildRevision & the version
setManagedBuildRevision(builder.getManagedBuildRevision());
setVersion(getVersionFromId());
isExtensionBuilder = false; isExtensionBuilder = false;
// Copy the remaining attributes // Copy the remaining attributes
if(builder.versionsSupported != null) {
versionsSupported = new String(builder.versionsSupported);
}
if(builder.convertToId != null) {
convertToId = new String(builder.convertToId);
}
if (builder.unusedChildren != null) { if (builder.unusedChildren != null) {
unusedChildren = new String(builder.unusedChildren); unusedChildren = new String(builder.unusedChildren);
} }
@ -200,6 +222,9 @@ public class Builder extends BuildObject implements IBuilder {
// Get the name // Get the name
setName(element.getAttribute(IBuildObject.NAME)); setName(element.getAttribute(IBuildObject.NAME));
// Set the version after extracting from 'id' attribute
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
@ -273,6 +298,9 @@ public class Builder extends BuildObject implements IBuilder {
setName(element.getAttribute(IBuildObject.NAME)); setName(element.getAttribute(IBuildObject.NAME));
} }
// Set the version after extracting from 'id' attribute
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
if (superClassId != null && superClassId.length() > 0) { if (superClassId != null && superClassId.length() > 0) {
@ -720,5 +748,4 @@ public class Builder extends BuildObject implements IBuilder {
return superClass.getReservedMacroNameSupplier(); return superClass.getReservedMacroNameSupplier();
return reservedMacroNameSupplier; return reservedMacroNameSupplier;
} }
} }

View file

@ -42,6 +42,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -84,14 +85,17 @@ public class Configuration extends BuildObject implements IConfiguration {
* *
* @param projectType The <code>ProjectType</code> the configuration will be added to. * @param projectType The <code>ProjectType</code> the configuration will be added to.
* @param element The element from the manifest that contains the configuration information. * @param element The element from the manifest that contains the configuration information.
* @param managedBuildRevision
*/ */
public Configuration(ProjectType projectType, IManagedConfigElement element) { public Configuration(ProjectType projectType, IManagedConfigElement element, String managedBuildRevision) {
this.projectType = projectType; this.projectType = projectType;
isExtensionConfig = true; isExtensionConfig = true;
// setup for resolving // setup for resolving
resolved = false; resolved = false;
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromManifest(element); loadFromManifest(element);
@ -108,9 +112,9 @@ public class Configuration extends BuildObject implements IConfiguration {
for (int l = 0; l < configElements.length; ++l) { for (int l = 0; l < configElements.length; ++l) {
IManagedConfigElement configElement = configElements[l]; IManagedConfigElement configElement = configElements[l];
if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) { if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
toolChain = new ToolChain(this, configElement); toolChain = new ToolChain(this, configElement, managedBuildRevision);
}else if (configElement.getName().equals(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME)) { }else if (configElement.getName().equals(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME)) {
ResourceConfiguration resConfig = new ResourceConfiguration(this, configElement); ResourceConfiguration resConfig = new ResourceConfiguration(this, configElement, managedBuildRevision);
addResourceConfiguration(resConfig); addResourceConfiguration(resConfig);
} }
} }
@ -146,6 +150,8 @@ public class Configuration extends BuildObject implements IConfiguration {
// Hook me up to the ProjectType // Hook me up to the ProjectType
if (projectType != null) { if (projectType != null) {
projectType.addConfiguration(this); projectType.addConfiguration(this);
// set managedBuildRevision
setManagedBuildRevision(projectType.getManagedBuildRevision());
} }
} }
@ -170,6 +176,7 @@ public class Configuration extends BuildObject implements IConfiguration {
// Hook me up to the ProjectType // Hook me up to the ProjectType
if (projectType != null) { if (projectType != null) {
projectType.addConfiguration(this); projectType.addConfiguration(this);
setManagedBuildRevision(projectType.getManagedBuildRevision());
} }
} }
@ -179,11 +186,14 @@ public class Configuration extends BuildObject implements IConfiguration {
* *
* @param managedProject The <code>ManagedProject</code> the configuration will be added to. * @param managedProject The <code>ManagedProject</code> the configuration will be added to.
* @param element The XML element that contains the configuration settings. * @param element The XML element that contains the configuration settings.
*
*/ */
public Configuration(ManagedProject managedProject, Element element) { public Configuration(ManagedProject managedProject, Element element, String managedBuildRevision) {
this.managedProject = managedProject; this.managedProject = managedProject;
isExtensionConfig = false; isExtensionConfig = false;
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromProject(element); loadFromProject(element);
@ -194,9 +204,9 @@ public class Configuration extends BuildObject implements IConfiguration {
for (int i = 0; i < configElements.getLength(); ++i) { for (int i = 0; i < configElements.getLength(); ++i) {
Node configElement = configElements.item(i); Node configElement = configElements.item(i);
if (configElement.getNodeName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) { if (configElement.getNodeName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
toolChain = new ToolChain(this, (Element)configElement); toolChain = new ToolChain(this, (Element)configElement, managedBuildRevision);
}else if (configElement.getNodeName().equals(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME)) { }else if (configElement.getNodeName().equals(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME)) {
ResourceConfiguration resConfig = new ResourceConfiguration(this, (Element)configElement); ResourceConfiguration resConfig = new ResourceConfiguration(this, (Element)configElement, managedBuildRevision);
addResourceConfiguration(resConfig); addResourceConfiguration(resConfig);
} }
} }
@ -216,6 +226,9 @@ public class Configuration extends BuildObject implements IConfiguration {
this.managedProject = managedProject; this.managedProject = managedProject;
isExtensionConfig = false; isExtensionConfig = false;
// set managedBuildRevision
setManagedBuildRevision(cloneConfig.getManagedBuildRevision());
// If this contructor is called to clone an existing // If this contructor is called to clone an existing
// configuration, the parent of the cloning config should be stored. // configuration, the parent of the cloning config should be stored.
parent = cloneConfig.getParent() == null ? cloneConfig : cloneConfig.getParent(); parent = cloneConfig.getParent() == null ? cloneConfig : cloneConfig.getParent();
@ -251,13 +264,22 @@ public class Configuration extends BuildObject implements IConfiguration {
// Tool Chain // Tool Chain
int nnn = ManagedBuildManager.getRandomNumber(); int nnn = ManagedBuildManager.getRandomNumber();
String subId; String subId;
String tmpId;
String subName; String subName;
if (cloneConfig.parent != null) { if (cloneConfig.parent != null) {
subId = cloneConfig.parent.getToolChain().getId() + "." + nnn; //$NON-NLS-1$ tmpId = cloneConfig.parent.getToolChain().getId();
subName = cloneConfig.parent.getToolChain().getName(); //$NON-NLS-1$ subName = cloneConfig.parent.getToolChain().getName();
} else { } else {
subId = cloneConfig.getToolChain().getId() + "." + nnn; //$NON-NLS-1$ tmpId = cloneConfig.getToolChain().getId();
subName = cloneConfig.getToolChain().getName(); //$NON-NLS-1$ subName = cloneConfig.getToolChain().getName();
}
String version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
if ( version != null) { // If the 'tmpId' contains version information
subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = tmpId + "." + nnn; //$NON-NLS-1$
} }
if (cloneTools) { if (cloneTools) {
@ -266,7 +288,13 @@ public class Configuration extends BuildObject implements IConfiguration {
// Add a tool-chain element that specifies as its superClass the // Add a tool-chain element that specifies as its superClass the
// tool-chain that is the child of the configuration. // tool-chain that is the child of the configuration.
ToolChain superChain = (ToolChain)cloneConfig.getToolChain(); ToolChain superChain = (ToolChain)cloneConfig.getToolChain();
subId = superChain.getId() + "." + nnn; //$NON-NLS-1$ tmpId = superChain.getId();
version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
if ( version != null) { // If the 'tmpId' contains version information
subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = tmpId + "." + nnn; //$NON-NLS-1$
}
IToolChain newChain = createToolChain(superChain, subId, superChain.getName(), false); IToolChain newChain = createToolChain(superChain, subId, superChain.getName(), false);
// For each tool element child of the tool-chain that is the child of // For each tool element child of the tool-chain that is the child of
@ -277,7 +305,13 @@ public class Configuration extends BuildObject implements IConfiguration {
while (iter.hasNext()) { while (iter.hasNext()) {
Tool toolChild = (Tool) iter.next(); Tool toolChild = (Tool) iter.next();
nnn = ManagedBuildManager.getRandomNumber(); nnn = ManagedBuildManager.getRandomNumber();
subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChild.getId();
version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
if ( version != null) { // If the 'tmpId' contains version information
subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = tmpId + "." + nnn; //$NON-NLS-1$
}
newChain.createTool(toolChild, subId, toolChild.getName(), false); newChain.createTool(toolChild, subId, toolChild.getName(), false);
} }
} }
@ -1357,6 +1391,24 @@ public class Configuration extends BuildObject implements IConfiguration {
return null; return null;
} }
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( projectType != null) {
projectType.getVersion();
} else if ( managedProject != null) {
return managedProject.getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildMacroSupplier() * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildMacroSupplier()
*/ */

View file

@ -31,6 +31,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -122,6 +123,7 @@ public class InputType extends BuildObject implements IInputType {
} }
setId(Id); setId(Id);
setName(name); setName(name);
isExtensionInputType = isExtensionElement; isExtensionInputType = isExtensionElement;
if (isExtensionElement) { if (isExtensionElement) {
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -137,6 +139,7 @@ public class InputType extends BuildObject implements IInputType {
* *
* @param parent The <code>ITool</code> the InputType will be added to. * @param parent The <code>ITool</code> the InputType will be added to.
* @param element The XML element that contains the InputType settings. * @param element The XML element that contains the InputType settings.
*
*/ */
public InputType(ITool parent, Element element) { public InputType(ITool parent, Element element) {
this.parent = parent; this.parent = parent;
@ -177,6 +180,7 @@ public class InputType extends BuildObject implements IInputType {
} }
setId(Id); setId(Id);
setName(name); setName(name);
isExtensionInputType = false; isExtensionInputType = false;
// Copy the remaining attributes // Copy the remaining attributes
@ -1094,4 +1098,31 @@ public class InputType extends BuildObject implements IInputType {
} }
} }
/**
* @return Returns the managedBuildRevision.
*/
public String getManagedBuildRevision() {
if ( managedBuildRevision == null) {
if ( getParent() != null) {
return getParent().getManagedBuildRevision();
}
}
return managedBuildRevision;
}
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
} }

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuilder; import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath; import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator; import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo; import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
@ -120,15 +121,16 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* *
* @param owner * @param owner
* @param element * @param element
* @param managedBuildRevision
*/ */
public ManagedBuildInfo(IResource owner, Element element) { public ManagedBuildInfo(IResource owner, Element element, String managedBuildRevision) {
this(owner); this(owner);
// Recreate the managed build project element and its children // Recreate the managed build project element and its children
NodeList projNodes = element.getElementsByTagName(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME); NodeList projNodes = element.getElementsByTagName(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
// TODO: There should only be 1? // TODO: There should only be 1?
for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) { for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) {
ManagedProject proj = new ManagedProject(this, (Element)projNodes.item(projIndex)); ManagedProject proj = new ManagedProject(this, (Element)projNodes.item(projIndex), managedBuildRevision);
if (!proj.resolveReferences()) if (!proj.resolveReferences())
proj.setValid(false); proj.setValid(false);
} }
@ -439,7 +441,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
IOption option = opts[j]; IOption option = opts[j];
try { try {
if (option.getValueType() == IOption.INCLUDE_PATH) { if (option.getValueType() == IOption.INCLUDE_PATH) {
// Get all the user-defined paths from the option as absolute paths
// check to see if the option has an applicability
// calculator
IOptionApplicability applicabilityCalculator = option
.getApplicabilityCalculator();
if (applicabilityCalculator == null
|| applicabilityCalculator.isOptionUsedInCommandLine(tool)) {
// Get all the user-defined paths from the
// option as absolute paths
String[] userPaths = option.getIncludePaths(); String[] userPaths = option.getIncludePaths();
for (int index = 0; index < userPaths.length; ++index) { for (int index = 0; index < userPaths.length; ++index) {
IPath userPath = new Path(userPaths[index]); IPath userPath = new Path(userPaths[index]);
@ -451,6 +463,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
} }
} }
} }
}
} catch (BuildException e) { } catch (BuildException e) {
// TODO: report error // TODO: report error
continue; continue;
@ -482,13 +495,21 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
IOption option = opts[i]; IOption option = opts[i];
try { try {
if (option.getValueType() == IOption.LIBRARIES) { if (option.getValueType() == IOption.LIBRARIES) {
// check to see if the option has an applicability calculator
IOptionApplicability applicabilitytCalculator = option.getApplicabilityCalculator();
if (applicabilitytCalculator == null
|| applicabilitytCalculator.isOptionUsedInCommandLine(tool)) {
String command = option.getCommand(); String command = option.getCommand();
String[] allLibs = option.getLibraries(); String[] allLibs = option.getLibraries();
for (int j = 0; j < allLibs.length; j++) { for (int j = 0; j < allLibs.length; j++)
{
String string = allLibs[j]; String string = allLibs[j];
libs.add(command + string); libs.add(command + string);
} }
} }
}
} catch (BuildException e) { } catch (BuildException e) {
// TODO: report error // TODO: report error
continue; continue;

View file

@ -30,6 +30,7 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -83,6 +84,8 @@ public class ManagedProject extends BuildObject implements IManagedProject {
setId(owner.getName() + "." + projectType.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$ setId(owner.getName() + "." + projectType.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
setName(projectType.getName()); setName(projectType.getName());
setManagedBuildRevision(projectType.getManagedBuildRevision());
// Hook me up // Hook me up
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner); IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
buildInfo.setManagedProject(this); buildInfo.setManagedProject(this);
@ -94,10 +97,13 @@ public class ManagedProject extends BuildObject implements IManagedProject {
* *
* @param buildInfo * @param buildInfo
* @param element * @param element
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public ManagedProject(ManagedBuildInfo buildInfo, Element element) { public ManagedProject(ManagedBuildInfo buildInfo, Element element, String managedBuildRevision) {
this(buildInfo.getOwner()); this(buildInfo.getOwner());
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
if (loadFromProject(element)) { if (loadFromProject(element)) {
// Load children // Load children
@ -105,7 +111,7 @@ public class ManagedProject extends BuildObject implements IManagedProject {
for (int i = 0; i < configElements.getLength(); ++i) { for (int i = 0; i < configElements.getLength(); ++i) {
Node configElement = configElements.item(i); Node configElement = configElements.item(i);
if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) { if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
Configuration config = new Configuration(this, (Element)configElement); Configuration config = new Configuration(this, (Element)configElement, managedBuildRevision);
}else if (configElement.getNodeName().equals(StorableMacros.MACROS_ELEMENT_NAME)) { }else if (configElement.getNodeName().equals(StorableMacros.MACROS_ELEMENT_NAME)) {
//load user-defined macros //load user-defined macros
userDefinedMacros = new StorableMacros((Element)configElement); userDefinedMacros = new StorableMacros((Element)configElement);
@ -440,6 +446,22 @@ public class ManagedProject extends BuildObject implements IManagedProject {
this.isValid = isValid; this.isValid = isValid;
} }
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if (version == null) {
if ( getProjectType() != null) {
return getProjectType().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
/* /*
* this method is called by the UserDefinedMacroSupplier to obtain user-defined * this method is called by the UserDefinedMacroSupplier to obtain user-defined
* macros available for this managed project * macros available for this managed project

View file

@ -21,12 +21,16 @@ import java.util.Set;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject; import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IProjectType; import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -58,11 +62,12 @@ public class Option extends BuildObject implements IOption {
private Integer valueType; private Integer valueType;
private Boolean isAbstract; private Boolean isAbstract;
private Integer resourceFilter; private Integer resourceFilter;
private IConfigurationElement applicabilityCalculatorElement = null;
private IOptionApplicability applicabilityCalculator = null;
// Miscellaneous // Miscellaneous
private boolean isExtensionOption = false; private boolean isExtensionOption = false;
private boolean isDirty = false; private boolean isDirty = false;
private boolean resolved = true; private boolean resolved = true;
/* /*
* C O N S T R U C T O R S * C O N S T R U C T O R S
*/ */
@ -211,7 +216,10 @@ public class Option extends BuildObject implements IOption {
break; break;
} }
} }
category = option.category; category = option.category;
applicabilityCalculatorElement = option.applicabilityCalculatorElement;
applicabilityCalculator = option.applicabilityCalculator;
setDirty(true); setDirty(true);
} }
@ -284,6 +292,14 @@ public class Option extends BuildObject implements IOption {
} else if (resFilterStr.equals(PROJECT)) { } else if (resFilterStr.equals(PROJECT)) {
resourceFilter = new Integer(FILTER_PROJECT); resourceFilter = new Integer(FILTER_PROJECT);
} }
// get the applicability calculator, if any
String applicabilityCalculatorStr = element.getAttribute(APPLICABILITY_CALCULATOR);
if (applicabilityCalculatorStr != null && element instanceof DefaultManagedConfigElement) {
applicabilityCalculatorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -671,6 +687,12 @@ public class Option extends BuildObject implements IOption {
element.setAttribute(RESOURCE_FILTER, str); element.setAttribute(RESOURCE_FILTER, str);
} }
// Note: applicability calculator cannot be specified in a project file because
// an IConfigurationElement is needed to load it!
if (applicabilityCalculatorElement != null) {
// TODO: issue warning?
}
// I am clean now // I am clean now
isDirty = false; isDirty = false;
} }
@ -761,6 +783,45 @@ public class Option extends BuildObject implements IOption {
return resourceFilter.intValue(); return resourceFilter.intValue();
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.core.IOption#getApplicabilityCalculatorElement()
*/
public IConfigurationElement getApplicabilityCalculatorElement() {
if (applicabilityCalculatorElement == null) {
if (superClass != null) {
return ((Option)superClass).getApplicabilityCalculatorElement();
}
}
return applicabilityCalculatorElement;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.core.IOption#getApplicabilityCalculator()
*/
public IOptionApplicability getApplicabilityCalculator() {
if (applicabilityCalculator != null) {
return applicabilityCalculator;
}
IConfigurationElement element = getApplicabilityCalculatorElement();
if (element != null) {
try {
if (element.getAttribute(APPLICABILITY_CALCULATOR) != null) {
applicabilityCalculator = (IOptionApplicability) element
.createExecutableExtension(APPLICABILITY_CALCULATOR);
return applicabilityCalculator;
}
} catch (CoreException e) {
}
}
return null;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns() * @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
*/ */
@ -1421,4 +1482,32 @@ public class Option extends BuildObject implements IOption {
} }
} }
/**
* @return Returns the managedBuildRevision.
*/
public String getManagedBuildRevision() {
if ( managedBuildRevision == null) {
if ( getParent() != null) {
return getParent().getManagedBuildRevision();
}
}
return managedBuildRevision;
}
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
} }

View file

@ -21,6 +21,7 @@ import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration; import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
// import org.eclipse.core.runtime.PluginVersionIdentifier; // uncomment this line after 'parent' is available
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -317,4 +318,34 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
} }
} }
// Uncomment this code after the 'parent' is available
/**
* @return Returns the managedBuildRevision.
*
public String getManagedBuildRevision() {
if ( managedBuildRevision == null) {
if ( getParent() != null) {
return getParent().getManagedBuildRevision();
}
}
return managedBuildRevision;
}
/**
* @return Returns the version.
*
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
*/
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2004 IBM Corporation and others. * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,11 +16,13 @@ import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -688,6 +690,15 @@ public class OptionReference implements IOption {
return FILTER_ALL; return FILTER_ALL;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.core.IOption#getApplicabilityCalculator()
*/
public IOptionApplicability getApplicabilityCalculator() {
return option.getApplicabilityCalculator();
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#setResourceFilter(int) * @see org.eclipse.cdt.managedbuilder.core.IOption#setResourceFilter(int)
*/ */
@ -721,4 +732,16 @@ public class OptionReference implements IOption {
public void setCommandFalse(String cmd) { public void setCommandFalse(String cmd) {
} }
public PluginVersionIdentifier getVersion() {
return option.getVersion();
}
public void setVersion(PluginVersionIdentifier version) {
option.setVersion(version);
}
public String getManagedBuildRevision() {
return option.getManagedBuildRevision();
}
} }

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -826,4 +827,31 @@ public class OutputType extends BuildObject implements IOutputType {
} }
} }
/**
* @return Returns the managedBuildRevision.
*/
public String getManagedBuildRevision() {
if ( managedBuildRevision == null) {
if ( getParent() != null) {
return getParent().getManagedBuildRevision();
}
}
return managedBuildRevision;
}
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
} }

View file

@ -26,6 +26,8 @@ import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
public class ProjectType extends BuildObject implements IProjectType { public class ProjectType extends BuildObject implements IProjectType {
private static final String EMPTY_STRING = new String(); private static final String EMPTY_STRING = new String();
@ -62,11 +64,14 @@ public class ProjectType extends BuildObject implements IProjectType {
* a plugin manifest file. * a plugin manifest file.
* *
* @param element * @param element
* @param managedBuildRevision
*/ */
public ProjectType(IManagedConfigElement element) { public ProjectType(IManagedConfigElement element, String managedBuildRevision) {
// setup for resolving // setup for resolving
resolved = false; resolved = false;
setManagedBuildRevision(managedBuildRevision);
loadFromManifest(element); loadFromManifest(element);
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -82,14 +87,14 @@ public class ProjectType extends BuildObject implements IProjectType {
// Tool Integrator provided 'ConfigurationNameProvider' class // Tool Integrator provided 'ConfigurationNameProvider' class
// to get configuration names dynamically based architecture, os, toolchain version etc. // to get configuration names dynamically based architecture, os, toolchain version etc.
for (int n = 0; n < configs.length; ++n) { for (int n = 0; n < configs.length; ++n) {
Configuration config = new Configuration(this, configs[n]); Configuration config = new Configuration(this, configs[n], managedBuildRevision);
String newConfigName = configurationNameProvder.getNewConfigurationName(config, usedConfigNames); String newConfigName = configurationNameProvder.getNewConfigurationName(config, usedConfigNames);
config.setName(newConfigName); config.setName(newConfigName);
usedConfigNames[n] = newConfigName; usedConfigNames[n] = newConfigName;
} }
} else { } else {
for (int n = 0; n < configs.length; ++n) { for (int n = 0; n < configs.length; ++n) {
Configuration config = new Configuration(this, configs[n]); Configuration config = new Configuration(this, configs[n], managedBuildRevision);
} }
} }
} }
@ -102,7 +107,7 @@ public class ProjectType extends BuildObject implements IProjectType {
* @param String The id for the new project type * @param String The id for the new project type
* @param String The name for the new project type * @param String The name for the new project type
*/ */
public ProjectType(ProjectType superClass, String Id, String name) { public ProjectType(ProjectType superClass, String Id, String name, String managedBuildRevision) {
// setup for resolving // setup for resolving
resolved = false; resolved = false;
@ -112,6 +117,10 @@ public class ProjectType extends BuildObject implements IProjectType {
} }
setId(Id); setId(Id);
setName(name); setName(name);
setManagedBuildRevision(managedBuildRevision);
setVersion(getVersionFromId());
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
ManagedBuildManager.addExtensionProjectType(this); ManagedBuildManager.addExtensionProjectType(this);
} }
@ -134,6 +143,9 @@ public class ProjectType extends BuildObject implements IProjectType {
// Get the name // Get the name
setName(element.getAttribute(NAME)); setName(element.getAttribute(NAME));
// version
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(SUPERCLASS); superClassId = element.getAttribute(SUPERCLASS);

View file

@ -26,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -58,14 +59,16 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
* @param parent The IConfiguration parent of this resource configuration * @param parent The IConfiguration parent of this resource configuration
* @param element The resource configuration definition from the manifest file * @param element The resource configuration definition from the manifest file
* or a dynamic element provider * or a dynamic element provider
* @param managedBuildRevision
*/ */
public ResourceConfiguration(IConfiguration parent, IManagedConfigElement element) { public ResourceConfiguration(IConfiguration parent, IManagedConfigElement element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionResourceConfig = true; isExtensionResourceConfig = true;
// setup for resolving // setup for resolving
resolved = false; resolved = false;
setManagedBuildRevision(managedBuildRevision);
loadFromManifest(element); loadFromManifest(element);
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -74,7 +77,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
// Load the tool children // Load the tool children
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME); IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
for (int n = 0; n < tools.length; ++n) { for (int n = 0; n < tools.length; ++n) {
Tool toolChild = new Tool(this, tools[n]); Tool toolChild = new Tool(this, tools[n], getManagedBuildRevision());
toolList.add(toolChild); toolList.add(toolChild);
} }
} }
@ -85,11 +88,13 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
* *
* @param parent The <code>IConfiguration</code> the resource configuration will be added to. * @param parent The <code>IConfiguration</code> the resource configuration will be added to.
* @param element The XML element that contains the resource configuration settings. * @param element The XML element that contains the resource configuration settings.
* @param managedBuildRevision
*/ */
public ResourceConfiguration(IConfiguration parent, Element element) { public ResourceConfiguration(IConfiguration parent, Element element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionResourceConfig = false; isExtensionResourceConfig = false;
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromProject(element); loadFromProject(element);
@ -98,7 +103,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
for (int i = 0; i < configElements.getLength(); ++i) { for (int i = 0; i < configElements.getLength(); ++i) {
Node configElement = configElements.item(i); Node configElement = configElements.item(i);
if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) { if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) {
Tool tool = new Tool((IBuildObject)this, (Element)configElement); Tool tool = new Tool((IBuildObject)this, (Element)configElement, getManagedBuildRevision());
addTool(tool); addTool(tool);
} }
} }
@ -110,6 +115,9 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
setId(id); setId(id);
setName(resourceName); setName(resourceName);
if ( parent != null)
setManagedBuildRevision(parent.getManagedBuildRevision());
resPath = path; resPath = path;
isDirty = false; isDirty = false;
isExcluded = new Boolean(false); isExcluded = new Boolean(false);
@ -128,6 +136,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
this.parent = parent; this.parent = parent;
isExtensionResourceConfig = false; isExtensionResourceConfig = false;
setManagedBuildRevision(cloneConfig.getManagedBuildRevision());
// Copy the remaining attributes // Copy the remaining attributes
if (cloneConfig.resPath != null) { if (cloneConfig.resPath != null) {
resPath = new String(cloneConfig.resPath); resPath = new String(cloneConfig.resPath);
@ -143,14 +153,24 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
Tool toolChild = (Tool) iter.next(); Tool toolChild = (Tool) iter.next();
int nnn = ManagedBuildManager.getRandomNumber(); int nnn = ManagedBuildManager.getRandomNumber();
String subId; String subId;
String tmpId;
String subName; String subName;
String version;
if (toolChild.getSuperClass() != null) { if (toolChild.getSuperClass() != null) {
subId = toolChild.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChild.getSuperClass().getId();
subName = toolChild.getSuperClass().getName(); subName = toolChild.getSuperClass().getName();
} else { } else {
subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChild.getId();
subName = toolChild.getName(); subName = toolChild.getName();
} }
version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
if ( version != null) { // If the 'tmpId' contains version information
subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = tmpId + "." + nnn; //$NON-NLS-1$
}
// The superclass for the cloned tool is not the same as the one from the tool being cloned. // The superclass for the cloned tool is not the same as the one from the tool being cloned.
// The superclasses reside in different configurations. // The superclasses reside in different configurations.
ITool toolSuperClass = null; ITool toolSuperClass = null;
@ -620,4 +640,22 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
public IResource getOwner() { public IResource getOwner() {
return getParent().getOwner(); return getParent().getOwner();
} }
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
} }

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer; import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -70,8 +71,9 @@ public class Target extends BuildObject implements ITarget {
* a plugin manifest file. * a plugin manifest file.
* *
* @param element * @param element
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public Target(IManagedConfigElement element) { public Target(IManagedConfigElement element, String managedBuildRevision) {
// setup for resolving // setup for resolving
ManagedBuildManager.putConfigElement(this, element); ManagedBuildManager.putConfigElement(this, element);
resolved = false; resolved = false;
@ -79,6 +81,9 @@ public class Target extends BuildObject implements ITarget {
// id // id
setId(element.getAttribute(ID)); setId(element.getAttribute(ID));
// managedBuildRevision
setManagedBuildRevision(managedBuildRevision);
// hook me up // hook me up
ManagedBuildManager.addExtensionTarget(this); ManagedBuildManager.addExtensionTarget(this);
@ -141,7 +146,7 @@ public class Target extends BuildObject implements ITarget {
// Then load any tools defined for the target // Then load any tools defined for the target
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME); IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
for (int m = 0; m < tools.length; ++m) { for (int m = 0; m < tools.length; ++m) {
ITool newTool = new Tool(this, tools[m]); ITool newTool = new Tool(this, tools[m], managedBuildRevision);
// Add this tool to the target, as this is not done in the constructor // Add this tool to the target, as this is not done in the constructor
this.addTool(newTool); this.addTool(newTool);
} }
@ -177,6 +182,9 @@ public class Target extends BuildObject implements ITarget {
int id = ManagedBuildManager.getRandomNumber(); int id = ManagedBuildManager.getRandomNumber();
setId(owner.getName() + "." + parent.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$ setId(owner.getName() + "." + parent.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
setName(parent.getName()); setName(parent.getName());
setManagedBuildRevision(parent.getManagedBuildRevision());
setArtifactName(parent.getArtifactName()); setArtifactName(parent.getArtifactName());
this.binaryParserId = parent.getBinaryParserId(); this.binaryParserId = parent.getBinaryParserId();
this.errorParserIds = parent.getErrorParserIds(); this.errorParserIds = parent.getErrorParserIds();
@ -959,7 +967,7 @@ public class Target extends BuildObject implements ITarget {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#convertToProjectType() * @see org.eclipse.cdt.managedbuilder.core.ITarget#convertToProjectType()
*/ */
public void convertToProjectType() { public void convertToProjectType(String managedBuildRevision) {
// Create a ProjectType + Configuration + Toolchain + Builder + TargetPlatform // Create a ProjectType + Configuration + Toolchain + Builder + TargetPlatform
// from the Target // from the Target
@ -969,11 +977,11 @@ public class Target extends BuildObject implements ITarget {
if (parent != null) { if (parent != null) {
parentProj = parent.getCreatedProjectType(); parentProj = parent.getCreatedProjectType();
if (parentProj == null) { if (parentProj == null) {
parent.convertToProjectType(); parent.convertToProjectType(managedBuildRevision);
parentProj = parent.getCreatedProjectType(); parentProj = parent.getCreatedProjectType();
} }
} }
ProjectType projectType = new ProjectType(parentProj, getId(), getName()); ProjectType projectType = new ProjectType(parentProj, getId(), getName(), managedBuildRevision);
createdProjectType = projectType; createdProjectType = projectType;
// Set the project type attributes // Set the project type attributes
projectType.setIsAbstract(isAbstract); projectType.setIsAbstract(isAbstract);
@ -1146,4 +1154,20 @@ public class Target extends BuildObject implements ITarget {
return createdProjectType; return createdProjectType;
} }
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
} }

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform; import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -56,14 +57,16 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
* defined at the top level * defined at the top level
* @param element The TargetPlatform definition from the manifest file or a dynamic element * @param element The TargetPlatform definition from the manifest file or a dynamic element
* provider * provider
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public TargetPlatform(IToolChain parent, IManagedConfigElement element) { public TargetPlatform(IToolChain parent, IManagedConfigElement element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionTargetPlatform = true; isExtensionTargetPlatform = true;
// setup for resolving // setup for resolving
resolved = false; resolved = false;
setManagedBuildRevision(managedBuildRevision);
loadFromManifest(element); loadFromManifest(element);
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -83,11 +86,13 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
public TargetPlatform(ToolChain parent, ITargetPlatform superClass, String Id, String name, boolean isExtensionElement) { public TargetPlatform(ToolChain parent, ITargetPlatform superClass, String Id, String name, boolean isExtensionElement) {
this.parent = parent; this.parent = parent;
this.superClass = superClass; this.superClass = superClass;
setManagedBuildRevision(parent.getManagedBuildRevision());
if (this.superClass != null) { if (this.superClass != null) {
superClassId = this.superClass.getId(); superClassId = this.superClass.getId();
} }
setId(Id); setId(Id);
setName(name); setName(name);
isExtensionTargetPlatform = isExtensionElement; isExtensionTargetPlatform = isExtensionElement;
if (isExtensionElement) { if (isExtensionElement) {
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -103,11 +108,13 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
* *
* @param parent The <code>IToolChain</code> the TargetPlatform will be added to. * @param parent The <code>IToolChain</code> the TargetPlatform will be added to.
* @param element The XML element that contains the TargetPlatform settings. * @param element The XML element that contains the TargetPlatform settings.
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public TargetPlatform(IToolChain parent, Element element) { public TargetPlatform(IToolChain parent, Element element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionTargetPlatform = false; isExtensionTargetPlatform = false;
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromProject(element); loadFromProject(element);
} }
@ -130,6 +137,9 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
setName(name); setName(name);
isExtensionTargetPlatform = false; isExtensionTargetPlatform = false;
if ( targetPlatform != null)
setManagedBuildRevision(targetPlatform.getManagedBuildRevision());
// Copy the remaining attributes // Copy the remaining attributes
if (targetPlatform.unusedChildren != null) { if (targetPlatform.unusedChildren != null) {
unusedChildren = new String(targetPlatform.unusedChildren); unusedChildren = new String(targetPlatform.unusedChildren);
@ -582,4 +592,20 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
} }
} }
/**
* @return Returns the version.
*/
public PluginVersionIdentifier getVersion() {
if ( version == null) {
if ( getParent() != null) {
return getParent().getVersion();
}
}
return version;
}
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
} }

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject; import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath; import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IInputType; import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator; import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@ -117,13 +118,17 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* manifest. * manifest.
* *
* @param element The element containing the information about the tool. * @param element The element containing the information about the tool.
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public Tool(IManagedConfigElement element) { public Tool(IManagedConfigElement element, String managedBuildRevision) {
isExtensionTool = true; isExtensionTool = true;
// setup for resolving // setup for resolving
resolved = false; resolved = false;
// Set the managedBuildRevision
setManagedBuildRevision(managedBuildRevision);
loadFromManifest(element); loadFromManifest(element);
// hook me up // hook me up
@ -160,9 +165,10 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* @param parent The parent of this tool. This can be a ToolChain or a * @param parent The parent of this tool. This can be a ToolChain or a
* ResourceConfiguration. * ResourceConfiguration.
* @param element The element containing the information about the tool. * @param element The element containing the information about the tool.
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public Tool(IBuildObject parent, IManagedConfigElement element) { public Tool(IBuildObject parent, IManagedConfigElement element, String managedBuildRevision) {
this(element); this(element, managedBuildRevision);
this.parent = parent; this.parent = parent;
} }
@ -179,11 +185,15 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
public Tool(ToolChain parent, ITool superClass, String Id, String name, boolean isExtensionElement) { public Tool(ToolChain parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
this.parent = parent; this.parent = parent;
this.superClass = superClass; this.superClass = superClass;
setManagedBuildRevision(parent.getManagedBuildRevision());
if (this.superClass != null) { if (this.superClass != null) {
superClassId = this.superClass.getId(); superClassId = this.superClass.getId();
} }
setId(Id); setId(Id);
setName(name); setName(name);
setVersion(getVersionFromId());
isExtensionTool = isExtensionElement; isExtensionTool = isExtensionElement;
if (isExtensionElement) { if (isExtensionElement) {
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -207,11 +217,14 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
public Tool(ResourceConfiguration parent, ITool superClass, String Id, String name, boolean isExtensionElement) { public Tool(ResourceConfiguration parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
this.parent = parent; this.parent = parent;
this.superClass = superClass; this.superClass = superClass;
setManagedBuildRevision(parent.getManagedBuildRevision());
if (this.superClass != null) { if (this.superClass != null) {
superClassId = this.superClass.getId(); superClassId = this.superClass.getId();
} }
setId(Id); setId(Id);
setName(name); setName(name);
setVersion(getVersionFromId());
isExtensionTool = isExtensionElement; isExtensionTool = isExtensionElement;
if (isExtensionElement) { if (isExtensionElement) {
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -228,11 +241,15 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* @param parent The <code>IToolChain</code> or <code>IResourceConfiguration</code> * @param parent The <code>IToolChain</code> or <code>IResourceConfiguration</code>
* the tool will be added to. * the tool will be added to.
* @param element The XML element that contains the tool settings. * @param element The XML element that contains the tool settings.
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public Tool(IBuildObject parent, Element element) { public Tool(IBuildObject parent, Element element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionTool = false; isExtensionTool = false;
// Set the managedBuildRevsion
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromProject(element); loadFromProject(element);
@ -277,9 +294,20 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
} }
setId(Id); setId(Id);
setName(name); setName(name);
// Set the managedBuildRevision & the version
setManagedBuildRevision(tool.getManagedBuildRevision());
setVersion(getVersionFromId());
isExtensionTool = false; isExtensionTool = false;
// Copy the remaining attributes // Copy the remaining attributes
if(tool.versionsSupported != null) {
versionsSupported = new String(tool.versionsSupported);
}
if(tool.convertToId != null) {
convertToId = new String(tool.convertToId);
}
if (tool.unusedChildren != null) { if (tool.unusedChildren != null) {
unusedChildren = new String(tool.unusedChildren); unusedChildren = new String(tool.unusedChildren);
} }
@ -408,6 +436,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
// name // name
setName(element.getAttribute(ITool.NAME)); setName(element.getAttribute(ITool.NAME));
// version
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
@ -520,6 +551,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
setName(element.getAttribute(IBuildObject.NAME)); setName(element.getAttribute(IBuildObject.NAME));
} }
// version
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
if (superClassId != null && superClassId.length() > 0) { if (superClassId != null && superClassId.length() > 0) {
@ -2187,13 +2221,18 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* @return * @return
* @throws BuildException * @throws BuildException
*/ */
public String[] getToolCommandFlags(IPath inputFileLocation, IPath outputFileLocation, IMacroSubstitutor macroSubstitutor) throws BuildException{ public String[] getToolCommandFlags(IPath inputFileLocation, IPath outputFileLocation,
IMacroSubstitutor macroSubstitutor) throws BuildException {
IOption[] opts = getOptions(); IOption[] opts = getOptions();
ArrayList flags = new ArrayList(); ArrayList flags = new ArrayList();
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (int index = 0; index < opts.length; index++) { for (int index = 0; index < opts.length; index++) {
IOption option = opts[index]; IOption option = opts[index];
sb.setLength( 0 ); sb.setLength( 0 );
// check to see if the option has an applicability calculator
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(this)) {
try{ try{
switch (option.getValueType()) { switch (option.getValueType()) {
case IOption.BOOLEAN : case IOption.BOOLEAN :
@ -2219,15 +2258,18 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
case IOption.STRING : case IOption.STRING :
String strCmd = option.getCommand(); String strCmd = option.getCommand();
String val = option.getStringValue(); String val = option.getStringValue();
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent())); macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
if (val.length() > 0 && (val = MacroResolver.resolveToString(val,macroSubstitutor)).length() > 0) { new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
if (val.length() > 0
&& (val = MacroResolver.resolveToString(val, macroSubstitutor)).length() > 0) {
sb.append( evaluateCommand( strCmd, val ) ); sb.append( evaluateCommand( strCmd, val ) );
} }
break; break;
case IOption.STRING_LIST : case IOption.STRING_LIST :
String listCmd = option.getCommand(); String listCmd = option.getCommand();
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent())); macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
String[] list = MacroResolver.resolveStringListValues(option.getStringListValue(), macroSubstitutor, true); String[] list = MacroResolver.resolveStringListValues(option.getStringListValue(), macroSubstitutor, true);
if(list != null){ if(list != null){
for (int j = 0; j < list.length; j++) { for (int j = 0; j < list.length; j++) {
@ -2240,7 +2282,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
case IOption.INCLUDE_PATH : case IOption.INCLUDE_PATH :
String incCmd = option.getCommand(); String incCmd = option.getCommand();
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent())); macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
String[] paths = MacroResolver.resolveStringListValues(option.getIncludePaths(), macroSubstitutor, true); String[] paths = MacroResolver.resolveStringListValues(option.getIncludePaths(), macroSubstitutor, true);
if(paths != null){ if(paths != null){
for (int j = 0; j < paths.length; j++) { for (int j = 0; j < paths.length; j++) {
@ -2253,7 +2296,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
case IOption.PREPROCESSOR_SYMBOLS : case IOption.PREPROCESSOR_SYMBOLS :
String defCmd = option.getCommand(); String defCmd = option.getCommand();
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent())); macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
String[] symbols = MacroResolver.resolveStringListValues(option.getDefinedSymbols(), macroSubstitutor, true); String[] symbols = MacroResolver.resolveStringListValues(option.getDefinedSymbols(), macroSubstitutor, true);
if(symbols != null){ if(symbols != null){
for (int j = 0; j < symbols.length; j++) { for (int j = 0; j < symbols.length; j++) {
@ -2268,11 +2312,13 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
break; break;
} }
if( sb.toString().trim().length() > 0 ) flags.add( sb.toString().trim() ); if (sb.toString().trim().length() > 0)
flags.add(sb.toString().trim());
} catch (BuildMacroException e) { } catch (BuildMacroException e) {
} }
} }
}
String[] f = new String[ flags.size() ]; String[] f = new String[ flags.size() ];
return (String[])flags.toArray( f ); return (String[])flags.toArray( f );
} }

View file

@ -88,14 +88,18 @@ public class ToolChain extends BuildObject implements IToolChain {
* defined at the top level * defined at the top level
* @param element The tool-chain definition from the manifest file or a dynamic element * @param element The tool-chain definition from the manifest file or a dynamic element
* provider * provider
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public ToolChain(IConfiguration parent, IManagedConfigElement element) { public ToolChain(IConfiguration parent, IManagedConfigElement element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionToolChain = true; isExtensionToolChain = true;
// setup for resolving // setup for resolving
resolved = false; resolved = false;
// Set the managedBuildRevision
setManagedBuildRevision(managedBuildRevision);
loadFromManifest(element); loadFromManifest(element);
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -108,7 +112,7 @@ public class ToolChain extends BuildObject implements IToolChain {
// TODO: Report error // TODO: Report error
} }
if (targetPlatforms.length > 0) { if (targetPlatforms.length > 0) {
targetPlatform = new TargetPlatform(this, targetPlatforms[0]); targetPlatform = new TargetPlatform(this, targetPlatforms[0], managedBuildRevision);
} }
// Load the Builder child // Load the Builder child
@ -118,13 +122,13 @@ public class ToolChain extends BuildObject implements IToolChain {
// TODO: Report error // TODO: Report error
} }
if (builders.length > 0) { if (builders.length > 0) {
builder = new Builder(this, builders[0]); builder = new Builder(this, builders[0], managedBuildRevision);
} }
// Load the tool children // Load the tool children
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME); IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
for (int n = 0; n < tools.length; ++n) { for (int n = 0; n < tools.length; ++n) {
Tool toolChild = new Tool(this, tools[n]); Tool toolChild = new Tool(this, tools[n], managedBuildRevision);
addTool(toolChild); addTool(toolChild);
} }
} }
@ -142,11 +146,15 @@ public class ToolChain extends BuildObject implements IToolChain {
public ToolChain(Configuration parent, IToolChain superClass, String Id, String name, boolean isExtensionElement) { public ToolChain(Configuration parent, IToolChain superClass, String Id, String name, boolean isExtensionElement) {
this.parent = parent; this.parent = parent;
this.superClass = superClass; this.superClass = superClass;
setManagedBuildRevision(parent.getManagedBuildRevision());
if (this.superClass != null) { if (this.superClass != null) {
superClassId = this.superClass.getId(); superClassId = this.superClass.getId();
} }
setId(Id); setId(Id);
setName(name); setName(name);
setVersion(getVersionFromId());
isExtensionToolChain = isExtensionElement; isExtensionToolChain = isExtensionElement;
if (isExtensionElement) { if (isExtensionElement) {
// Hook me up to the Managed Build Manager // Hook me up to the Managed Build Manager
@ -162,11 +170,15 @@ public class ToolChain extends BuildObject implements IToolChain {
* *
* @param parent The <code>IConfiguration</code> the tool-chain will be added to. * @param parent The <code>IConfiguration</code> the tool-chain will be added to.
* @param element The XML element that contains the tool-chain settings. * @param element The XML element that contains the tool-chain settings.
* @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public ToolChain(IConfiguration parent, Element element) { public ToolChain(IConfiguration parent, Element element, String managedBuildRevision) {
this.parent = parent; this.parent = parent;
isExtensionToolChain = false; isExtensionToolChain = false;
// Set the managedBuildRevision
setManagedBuildRevision(managedBuildRevision);
// Initialize from the XML attributes // Initialize from the XML attributes
loadFromProject(element); loadFromProject(element);
@ -175,21 +187,22 @@ public class ToolChain extends BuildObject implements IToolChain {
for (int i = 0; i < configElements.getLength(); ++i) { for (int i = 0; i < configElements.getLength(); ++i) {
Node configElement = configElements.item(i); Node configElement = configElements.item(i);
if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) { if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) {
Tool tool = new Tool(this, (Element)configElement); Tool tool = new Tool(this, (Element)configElement, managedBuildRevision);
addTool(tool); addTool(tool);
}else if (configElement.getNodeName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) { }else if (configElement.getNodeName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
if (targetPlatform != null) { if (targetPlatform != null) {
// TODO: report error // TODO: report error
} }
targetPlatform = new TargetPlatform(this, (Element)configElement); targetPlatform = new TargetPlatform(this, (Element)configElement, managedBuildRevision);
}else if (configElement.getNodeName().equals(IBuilder.BUILDER_ELEMENT_NAME)) { }else if (configElement.getNodeName().equals(IBuilder.BUILDER_ELEMENT_NAME)) {
if (builder != null) { if (builder != null) {
// TODO: report error // TODO: report error
} }
builder = new Builder(this, (Element)configElement); builder = new Builder(this, (Element)configElement, managedBuildRevision);
}else if (configElement.getNodeName().equals(StorableMacros.MACROS_ELEMENT_NAME)) { }else if (configElement.getNodeName().equals(StorableMacros.MACROS_ELEMENT_NAME)) {
//load user-defined macros //load user-defined macros
userDefinedMacros = new StorableMacros((Element)configElement); userDefinedMacros = new StorableMacros((Element)configElement);
} }
} }
} }
@ -210,9 +223,21 @@ public class ToolChain extends BuildObject implements IToolChain {
} }
setId(Id); setId(Id);
setName(name); setName(name);
// Set the managedBuildRevision and the version
setManagedBuildRevision(toolChain.getManagedBuildRevision());
setVersion(getVersionFromId());
isExtensionToolChain = false; isExtensionToolChain = false;
// Copy the remaining attributes // Copy the remaining attributes
if(toolChain.versionsSupported != null) {
versionsSupported = new String(toolChain.versionsSupported);
}
if(toolChain.convertToId != null) {
convertToId = new String(toolChain.convertToId);
}
if (toolChain.unusedChildren != null) { if (toolChain.unusedChildren != null) {
unusedChildren = new String(toolChain.unusedChildren); unusedChildren = new String(toolChain.unusedChildren);
} }
@ -250,14 +275,24 @@ public class ToolChain extends BuildObject implements IToolChain {
if (toolChain.builder != null) { if (toolChain.builder != null) {
int nnn = ManagedBuildManager.getRandomNumber(); int nnn = ManagedBuildManager.getRandomNumber();
String subId; String subId;
String tmpId;
String version;
String subName; String subName;
if (toolChain.builder.getSuperClass() != null) { if (toolChain.builder.getSuperClass() != null) {
subId = toolChain.builder.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChain.builder.getSuperClass().getId(); //$NON-NLS-1$
subName = toolChain.builder.getSuperClass().getName(); subName = toolChain.builder.getSuperClass().getName();
} else { } else {
subId = toolChain.builder.getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChain.builder.getId(); //$NON-NLS-1$
subName = toolChain.builder.getName(); subName = toolChain.builder.getName();
} }
version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
if ( version != null) { // If the 'tmpId' contains version information
subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = tmpId + "." + nnn; //$NON-NLS-1$
}
builder = new Builder(this, subId, subName, toolChain.builder); builder = new Builder(this, subId, subName, toolChain.builder);
} }
if (toolChain.targetPlatform != null) { if (toolChain.targetPlatform != null) {
@ -279,14 +314,24 @@ public class ToolChain extends BuildObject implements IToolChain {
Tool toolChild = (Tool) iter.next(); Tool toolChild = (Tool) iter.next();
int nnn = ManagedBuildManager.getRandomNumber(); int nnn = ManagedBuildManager.getRandomNumber();
String subId; String subId;
String tmpId;
String subName; String subName;
String version;
if (toolChild.getSuperClass() != null) { if (toolChild.getSuperClass() != null) {
subId = toolChild.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChild.getSuperClass().getId();
subName = toolChild.getSuperClass().getName(); subName = toolChild.getSuperClass().getName();
} else { } else {
subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$ tmpId = toolChild.getId();
subName = toolChild.getName(); subName = toolChild.getName();
} }
version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
if ( version != null) { // If the 'tmpId' contains version information
subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = tmpId + "." + nnn; //$NON-NLS-1$
}
Tool newTool = new Tool(this, null, subId, subName, toolChild); Tool newTool = new Tool(this, null, subId, subName, toolChild);
addTool(newTool); addTool(newTool);
} }
@ -314,6 +359,9 @@ public class ToolChain extends BuildObject implements IToolChain {
// Get the name // Get the name
setName(element.getAttribute(IBuildObject.NAME)); setName(element.getAttribute(IBuildObject.NAME));
// version
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
@ -384,6 +432,7 @@ public class ToolChain extends BuildObject implements IToolChain {
} }
/* (non-Javadoc) /* (non-Javadoc)
* Initialize the tool-chain information from the XML element * Initialize the tool-chain information from the XML element
* specified in the argument * specified in the argument
@ -400,6 +449,9 @@ public class ToolChain extends BuildObject implements IToolChain {
setName(element.getAttribute(IBuildObject.NAME)); setName(element.getAttribute(IBuildObject.NAME));
} }
// version
setVersion(getVersionFromId());
// superClass // superClass
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
if (superClassId != null && superClassId.length() > 0) { if (superClassId != null && superClassId.length() > 0) {
@ -1367,6 +1419,4 @@ public class ToolChain extends BuildObject implements IToolChain {
} }
return null; return null;
} }
} }

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfigurationV2; import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
import org.eclipse.cdt.managedbuilder.core.IInputType; import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath; import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
@ -31,6 +32,7 @@ import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator; import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -440,6 +442,12 @@ public class ToolReference implements IToolReference {
IOption[] opts = getOptions(); IOption[] opts = getOptions();
for (int index = 0; index < opts.length; index++) { for (int index = 0; index < opts.length; index++) {
IOption option = opts[index]; IOption option = opts[index];
// check to see if the option has an applicability calculator
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
if (applicabilityCalculator == null
|| applicabilityCalculator.isOptionUsedInCommandLine(getTool())) {
switch (option.getValueType()) { switch (option.getValueType()) {
case IOption.BOOLEAN : case IOption.BOOLEAN :
String boolCmd; String boolCmd;
@ -503,6 +511,7 @@ public class ToolReference implements IToolReference {
} }
} }
}
return buf.toString().trim(); return buf.toString().trim();
} }
@ -811,7 +820,7 @@ public class ToolReference implements IToolReference {
*/ */
public String[] getCommandFlags() throws BuildException { public String[] getCommandFlags() throws BuildException {
if( parent == null ) return null; if( parent == null ) return null;
return parent.getCommandFlags(); return parent.getToolCommandFlags(null, null);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1174,4 +1183,16 @@ public class ToolReference implements IToolReference {
public IEnvVarBuildPath[] getEnvVarBuildPaths(){ public IEnvVarBuildPath[] getEnvVarBuildPaths(){
return null; return null;
} }
public PluginVersionIdentifier getVersion() {
return null;
}
public void setVersion(PluginVersionIdentifier version) {
// TODO Auto-generated method stub
}
public String getManagedBuildRevision() {
return null;
}
} }

View file

@ -256,6 +256,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
private static final String POSTBUILD = "post-build"; //$NON-NLS-1$ private static final String POSTBUILD = "post-build"; //$NON-NLS-1$
private static final String SECONDARY_OUTPUTS = "secondary-outputs"; //$NON-NLS-1$ private static final String SECONDARY_OUTPUTS = "secondary-outputs"; //$NON-NLS-1$
// Enumerations
public static final int
PROJECT_RELATIVE = 1,
PROJECT_SUBDIR_RELATIVE = 2,
ABSOLUTE = 3;
// Local variables needed by generator // Local variables needed by generator
private String buildTargetName; private String buildTargetName;
private String buildTargetExt; private String buildTargetExt;
@ -1838,12 +1844,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
varName = getSourceMacroName(ext).toString(); varName = getSourceMacroName(ext).toString();
// Add the resource to the list of all resources associated with a variable. // Add the resource to the list of all resources associated with a variable.
List varList = (List)buildSrcVars.get(varName); List varList = (List)buildSrcVars.get(varName);
varList.add(resource.getFullPath()); // Since we don't know how these files will be used, we store them using a "location"
// path rather than a relative path
varList.add(resource.getLocation());
} else { } else {
// Add the resource to the list of all resources associated with a variable. // Add the resource to the list of all resources associated with a variable.
List varList = (List)buildOutVars.get(varName); List varList = (List)buildOutVars.get(varName);
if (varList != null) { if (varList != null) {
varList.add(resource.getFullPath()); // Since we don't know how these files will be used, we store them using a "location"
// path rather than a relative path
varList.add(resource.getLocation());
} }
} }
if (!buildVarToRuleStringMap.containsKey(varName)) { if (!buildVarToRuleStringMap.containsKey(varName)) {
@ -2796,14 +2806,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
} }
/* (non-javadoc) /* (non-javadoc)
* Returns the list of files associated with the build variable * Returns the (String) list of files associated with the build variable
* *
* @param variable the variable name * @param variable the variable name
* @param locationType the format in which we want the filenames returned
* @param directory project relative directory path used with locationType == DIRECTORY_RELATIVE
* @param getAll only return the list if all tools that are going to contrubute to this * @param getAll only return the list if all tools that are going to contrubute to this
* variable have done so. * variable have done so.
* @return List * @return List
*/ */
public List getBuildVariableList(String variable, boolean getAll) { public List getBuildVariableList(String variable, int locationType, IPath directory, boolean getAll) {
boolean done = true; boolean done = true;
for (int i=0; i<gnuToolInfos.length; i++) { for (int i=0; i<gnuToolInfos.length; i++) {
if (!gnuToolInfos[i].areOutputVariablesCalculated()) { if (!gnuToolInfos[i].areOutputVariablesCalculated()) {
@ -2812,7 +2824,33 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
} }
if (!done && getAll) return null; if (!done && getAll) return null;
List list = (List)buildSrcVars.get(variable); List list = (List)buildSrcVars.get(variable);
return (list != null) ? list : (List)buildOutVars.get(variable); if (list == null) {
list = (List)buildOutVars.get(variable);
}
List fileList = null;
if (list != null) {
// Convert the items in the list to the location-type wanted by the caller,
// and to a string list
IPath dirLocation = null;
if (locationType != ABSOLUTE) {
dirLocation = project.getLocation();
if (locationType == PROJECT_SUBDIR_RELATIVE) {
dirLocation = dirLocation.append(directory);
}
}
for (int i=0; i<list.size(); i++) {
IPath path = (IPath)list.get(i);
if (locationType != ABSOLUTE) {
if (dirLocation.isPrefixOf(path)) {
path = path.removeFirstSegments(dirLocation.matchingFirstSegments(path));
}
}
fileList.add(path.toString());
}
}
return fileList;
} }
/* (non-javadoc) /* (non-javadoc)

View file

@ -200,7 +200,8 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
} }
// If there is an output variable with the same name, get // If there is an output variable with the same name, get
// the files associated with it. // the files associated with it.
List outMacroList = makeGen.getBuildVariableList(variable, true); List outMacroList = makeGen.getBuildVariableList(variable, GnuMakefileGenerator.PROJECT_SUBDIR_RELATIVE,
makeGen.getBuildWorkingDir(), true);
if (outMacroList != null) { if (outMacroList != null) {
myEnumeratedInputs.addAll(outMacroList); myEnumeratedInputs.addAll(outMacroList);
} else { } else {
@ -229,7 +230,6 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
String fileExt = projResources[j].getFileExtension(); String fileExt = projResources[j].getFileExtension();
for (int k=0; k<exts.length; k++) { for (int k=0; k<exts.length; k++) {
if (fileExt.equals(exts[k])) { if (fileExt.equals(exts[k])) {
// TODO - is project relative correct?
if (!useFileExts) { if (!useFileExts) {
if(!handledInputExtensions.contains(fileExt)) { if(!handledInputExtensions.contains(fileExt)) {
handledInputExtensions.add(fileExt); handledInputExtensions.add(fileExt);
@ -243,7 +243,13 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
} }
} }
if (type.getMultipleOfType() || myEnumeratedInputs.size() == 0) { if (type.getMultipleOfType() || myEnumeratedInputs.size() == 0) {
myEnumeratedInputs.add(projResources[j].getProjectRelativePath().toString()); // Return a path that is relative to the build directory
IPath resPath = projResources[j].getLocation();
IPath bldLocation = project.getLocation().append(makeGen.getBuildWorkingDir());
if (bldLocation.isPrefixOf(resPath)) {
resPath = resPath.removeFirstSegments(bldLocation.matchingFirstSegments(resPath));
}
myEnumeratedInputs.add(resPath.toString());
} }
break; break;
} }