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:
parent
f8dc010214
commit
107015f427
25 changed files with 1033 additions and 184 deletions
|
@ -118,6 +118,16 @@
|
|||
</appInfo>
|
||||
</annotation>
|
||||
</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>
|
||||
</element>
|
||||
|
||||
|
@ -236,6 +246,13 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
</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>
|
||||
</element>
|
||||
|
||||
|
@ -358,6 +375,20 @@
|
|||
</appInfo>
|
||||
</annotation>
|
||||
</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>
|
||||
</element>
|
||||
|
||||
|
@ -563,6 +594,20 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
</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>
|
||||
</element>
|
||||
|
||||
|
@ -1035,6 +1080,16 @@ Additional special types exist to flag options of special relevance to the build
|
|||
</documentation>
|
||||
</annotation>
|
||||
</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>
|
||||
</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:
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</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:
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
|
@ -1289,6 +1342,20 @@ If this attribute is not specified, MBS will assume that there are no reserved m
|
|||
</documentation>
|
||||
</annotation>
|
||||
</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>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -10,12 +10,16 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.core;
|
||||
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
|
||||
public interface IBuildObject {
|
||||
// Schema element names
|
||||
public static final String ID = "id"; //$NON-NLS-1$
|
||||
public static final String NAME = "name"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public String getId();
|
||||
public String getName();
|
||||
|
||||
public PluginVersionIdentifier getVersion();
|
||||
public void setVersion(PluginVersionIdentifier version);
|
||||
public String getManagedBuildRevision();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* 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 LIST_VALUE = "listOptionValue"; //$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_ENUM = "enumerated"; //$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);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* defined for a stringList, includePaths, definedSymbols, or libs
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -291,9 +291,9 @@ public interface ITarget extends IBuildObject {
|
|||
/**
|
||||
* Converts a CDT V2.0 target into a ProjectType + Configuration + Toolchain +
|
||||
* Builder + TargetPlatform.
|
||||
*
|
||||
* @param managedBuildRevision
|
||||
*/
|
||||
public void convertToProjectType();
|
||||
public void convertToProjectType(String managedBuildRevision);
|
||||
|
||||
/**
|
||||
* Returns the <code>ProjectType</code> that this Target has been converted to,
|
||||
|
|
|
@ -1342,7 +1342,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
NodeList nodes = document.getElementsByTagName(ROOT_NODE_NAME);
|
||||
if (nodes.getLength() > 0) {
|
||||
Node node = nodes.item(0);
|
||||
buildInfo = new ManagedBuildInfo(project, (Element)node);
|
||||
buildInfo = new ManagedBuildInfo(project, (Element)node, fileVersion);
|
||||
if (fileVersion != null) {
|
||||
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
|
||||
// declaring plug-in's manifest (plugin.xml) file.
|
||||
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.
|
||||
|
@ -1541,6 +1554,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID_V2);
|
||||
if( extensionPoint != null) {
|
||||
IExtension[] extensions = extensionPoint.getExtensions();
|
||||
String revision = null;
|
||||
|
||||
if (extensions != null) {
|
||||
if (extensions.length > 0) {
|
||||
|
||||
|
@ -1554,8 +1569,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
//The version of the Plug-in is greater than what the manager thinks it understands
|
||||
throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
|
||||
}
|
||||
IConfigurationElement[] elements = extension.getConfigurationElements();
|
||||
loadConfigElementsV2(DefaultManagedConfigElement.convertArray(elements));
|
||||
IConfigurationElement[] elements = extension.getConfigurationElements();
|
||||
|
||||
// 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
|
||||
Iterator targetIter = getExtensionTargetMap().values().iterator();
|
||||
|
@ -1586,7 +1613,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
Target target = (Target)targetIter.next();
|
||||
// Check to see if it has already been converted - if not, do it
|
||||
if (target.getCreatedProjectType() == null) {
|
||||
target.convertToProjectType();
|
||||
target.convertToProjectType(revision);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// 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) {
|
||||
try {
|
||||
IManagedConfigElement element = elements[toolIndex];
|
||||
// Load the top level elements, which in turn load their children
|
||||
if (element.getName().equals(IProjectType.PROJECTTYPE_ELEMENT_NAME)) {
|
||||
new ProjectType(element);
|
||||
new ProjectType(element, revision);
|
||||
} 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)) {
|
||||
new ToolChain((Configuration)null, element);
|
||||
new ToolChain((Configuration)null, element, revision);
|
||||
} 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)) {
|
||||
new TargetPlatform((ToolChain)null, element);
|
||||
new TargetPlatform((ToolChain)null, element, revision);
|
||||
} 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)) {
|
||||
// don't allow nested config providers.
|
||||
if (element instanceof DefaultManagedConfigElement) {
|
||||
|
@ -1649,7 +1676,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
IManagedConfigElementProvider provider = createConfigProvider(
|
||||
(DefaultManagedConfigElement)element);
|
||||
providedConfigs = provider.getConfigElements();
|
||||
loadConfigElements(providedConfigs); // This must use the current build model
|
||||
loadConfigElements(providedConfigs, revision); // This must use the current build model
|
||||
}
|
||||
} else {
|
||||
// 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) {
|
||||
try {
|
||||
IManagedConfigElement element = elements[toolIndex];
|
||||
// Load the top level elements, which in turn load their children
|
||||
if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
|
||||
new Tool(element);
|
||||
new Tool(element, revision);
|
||||
} else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
|
||||
new Target(element);
|
||||
new Target(element,revision);
|
||||
} else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) {
|
||||
// don't allow nested config providers.
|
||||
if (element instanceof DefaultManagedConfigElement) {
|
||||
|
@ -1677,7 +1704,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
IManagedConfigElementProvider provider = createConfigProvider(
|
||||
(DefaultManagedConfigElement)element);
|
||||
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) {
|
||||
|
@ -2050,6 +2077,54 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
public static IEnvironmentVariableProvider getEnvironmentVariableProvider(){
|
||||
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
|
||||
|
@ -2059,5 +2134,4 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
public static IBuildMacroProvider getBuildMacroProvider(){
|
||||
return BuildMacroProvider.getDefault();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,18 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
|||
|
||||
|
||||
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 {
|
||||
|
||||
protected String id;
|
||||
protected String name;
|
||||
|
||||
protected PluginVersionIdentifier version = null;
|
||||
protected String managedBuildRevision = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
|
||||
*/
|
||||
|
@ -52,4 +58,57 @@ public class BuildObject implements IBuildObject {
|
|||
public String toString() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,18 +66,22 @@ public class Builder extends BuildObject implements IBuilder {
|
|||
* This constructor is called to create a builder defined by an extension point in
|
||||
* a plugin manifest file, or returned by a dynamic element provider
|
||||
*
|
||||
* @param parent The IToolChain parent of this builder, or <code>null</code> if
|
||||
* defined at the top level
|
||||
* @param element The builder definition from the manifest file or a dynamic element
|
||||
* provider
|
||||
* @param parent The IToolChain parent of this builder, or <code>null</code> if
|
||||
* defined at the top level
|
||||
* @param element The builder definition from the manifest file or a dynamic element
|
||||
* 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;
|
||||
isExtensionBuilder = true;
|
||||
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
// Set the managedBuildRevision
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
loadFromManifest(element);
|
||||
|
||||
// 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) {
|
||||
this.parent = parent;
|
||||
this.superClass = superClass;
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
if (this.superClass != null) {
|
||||
superClassId = this.superClass.getId();
|
||||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionBuilder = isExtensionElement;
|
||||
if (isExtensionElement) {
|
||||
// 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 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;
|
||||
isExtensionBuilder = false;
|
||||
|
||||
// Set the managedBuildRevision
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// Initialize from the XML attributes
|
||||
loadFromProject(element);
|
||||
}
|
||||
|
@ -142,9 +153,20 @@ public class Builder extends BuildObject implements IBuilder {
|
|||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
// Set the managedBuildRevision & the version
|
||||
setManagedBuildRevision(builder.getManagedBuildRevision());
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionBuilder = false;
|
||||
|
||||
// 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) {
|
||||
unusedChildren = new String(builder.unusedChildren);
|
||||
}
|
||||
|
@ -200,6 +222,9 @@ public class Builder extends BuildObject implements IBuilder {
|
|||
// Get the name
|
||||
setName(element.getAttribute(IBuildObject.NAME));
|
||||
|
||||
// Set the version after extracting from 'id' attribute
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
|
||||
|
@ -273,6 +298,9 @@ public class Builder extends BuildObject implements IBuilder {
|
|||
setName(element.getAttribute(IBuildObject.NAME));
|
||||
}
|
||||
|
||||
// Set the version after extracting from 'id' attribute
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
if (superClassId != null && superClassId.length() > 0) {
|
||||
|
@ -720,5 +748,4 @@ public class Builder extends BuildObject implements IBuilder {
|
|||
return superClass.getReservedMacroNameSupplier();
|
||||
return reservedMacroNameSupplier;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
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 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;
|
||||
isExtensionConfig = true;
|
||||
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// Initialize from the XML attributes
|
||||
loadFromManifest(element);
|
||||
|
||||
|
@ -108,9 +112,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
for (int l = 0; l < configElements.length; ++l) {
|
||||
IManagedConfigElement configElement = configElements[l];
|
||||
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)) {
|
||||
ResourceConfiguration resConfig = new ResourceConfiguration(this, configElement);
|
||||
ResourceConfiguration resConfig = new ResourceConfiguration(this, configElement, managedBuildRevision);
|
||||
addResourceConfiguration(resConfig);
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +149,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
|
||||
// Hook me up to the ProjectType
|
||||
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
|
||||
if (projectType != null) {
|
||||
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 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;
|
||||
isExtensionConfig = false;
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// Initialize from the XML attributes
|
||||
loadFromProject(element);
|
||||
|
||||
|
@ -194,9 +204,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||
Node configElement = configElements.item(i);
|
||||
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)) {
|
||||
ResourceConfiguration resConfig = new ResourceConfiguration(this, (Element)configElement);
|
||||
ResourceConfiguration resConfig = new ResourceConfiguration(this, (Element)configElement, managedBuildRevision);
|
||||
addResourceConfiguration(resConfig);
|
||||
}
|
||||
}
|
||||
|
@ -216,10 +226,13 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
this.managedProject = managedProject;
|
||||
isExtensionConfig = false;
|
||||
|
||||
// set managedBuildRevision
|
||||
setManagedBuildRevision(cloneConfig.getManagedBuildRevision());
|
||||
|
||||
// If this contructor is called to clone an existing
|
||||
// configuration, the parent of the cloning config should be stored.
|
||||
parent = cloneConfig.getParent() == null ? cloneConfig : cloneConfig.getParent();
|
||||
|
||||
|
||||
// Copy the remaining attributes
|
||||
projectType = cloneConfig.projectType;
|
||||
if (cloneConfig.artifactName != null) {
|
||||
|
@ -251,22 +264,37 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
// Tool Chain
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
String subId;
|
||||
String tmpId;
|
||||
String subName;
|
||||
if (cloneConfig.parent != null) {
|
||||
subId = cloneConfig.parent.getToolChain().getId() + "." + nnn; //$NON-NLS-1$
|
||||
subName = cloneConfig.parent.getToolChain().getName(); //$NON-NLS-1$
|
||||
tmpId = cloneConfig.parent.getToolChain().getId();
|
||||
subName = cloneConfig.parent.getToolChain().getName();
|
||||
|
||||
} else {
|
||||
subId = cloneConfig.getToolChain().getId() + "." + nnn; //$NON-NLS-1$
|
||||
subName = cloneConfig.getToolChain().getName(); //$NON-NLS-1$
|
||||
tmpId = cloneConfig.getToolChain().getId();
|
||||
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) {
|
||||
toolChain = new ToolChain(this, subId, subName, (ToolChain)cloneConfig.getToolChain());
|
||||
} else {
|
||||
// Add a tool-chain element that specifies as its superClass the
|
||||
// tool-chain that is the child of the configuration.
|
||||
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);
|
||||
|
||||
// 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()) {
|
||||
Tool toolChild = (Tool) iter.next();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1356,6 +1390,24 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
return toolChain.getEnvironmentVariableSupplier();
|
||||
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)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildMacroSupplier()
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -122,6 +123,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
isExtensionInputType = isExtensionElement;
|
||||
if (isExtensionElement) {
|
||||
// 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 element The XML element that contains the InputType settings.
|
||||
*
|
||||
*/
|
||||
public InputType(ITool parent, Element element) {
|
||||
this.parent = parent;
|
||||
|
@ -177,6 +180,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
isExtensionInputType = false;
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
|
|||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
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.IManagedCommandLineGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||
|
@ -120,15 +121,16 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
*
|
||||
* @param owner
|
||||
* @param element
|
||||
* @param managedBuildRevision
|
||||
*/
|
||||
public ManagedBuildInfo(IResource owner, Element element) {
|
||||
public ManagedBuildInfo(IResource owner, Element element, String managedBuildRevision) {
|
||||
this(owner);
|
||||
|
||||
// Recreate the managed build project element and its children
|
||||
NodeList projNodes = element.getElementsByTagName(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
|
||||
// TODO: There should only be 1?
|
||||
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())
|
||||
proj.setValid(false);
|
||||
}
|
||||
|
@ -439,15 +441,26 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
IOption option = opts[j];
|
||||
try {
|
||||
if (option.getValueType() == IOption.INCLUDE_PATH) {
|
||||
// Get all the user-defined paths from the option as absolute paths
|
||||
String[] userPaths = option.getIncludePaths();
|
||||
for (int index = 0; index < userPaths.length; ++index) {
|
||||
IPath userPath = new Path(userPaths[index]);
|
||||
if (userPath.isAbsolute()) {
|
||||
paths.add(userPath.toOSString());
|
||||
} else {
|
||||
IPath absPath = root.addTrailingSeparator().append(userPath);
|
||||
paths.add(absPath.makeAbsolute().toOSString());
|
||||
|
||||
// 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();
|
||||
for (int index = 0; index < userPaths.length; ++index) {
|
||||
IPath userPath = new Path(userPaths[index]);
|
||||
if (userPath.isAbsolute()) {
|
||||
paths.add(userPath.toOSString());
|
||||
} else {
|
||||
IPath absPath = root.addTrailingSeparator().append(userPath);
|
||||
paths.add(absPath.makeAbsolute().toOSString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -482,11 +495,19 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
IOption option = opts[i];
|
||||
try {
|
||||
if (option.getValueType() == IOption.LIBRARIES) {
|
||||
String command = option.getCommand();
|
||||
String[] allLibs = option.getLibraries();
|
||||
for (int j = 0; j < allLibs.length; j++) {
|
||||
String string = allLibs[j];
|
||||
libs.add(command + string);
|
||||
|
||||
// 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[] allLibs = option.getLibraries();
|
||||
for (int j = 0; j < allLibs.length; j++)
|
||||
{
|
||||
String string = allLibs[j];
|
||||
libs.add(command + string);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BuildException e) {
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
|
|||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
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$
|
||||
setName(projectType.getName());
|
||||
|
||||
setManagedBuildRevision(projectType.getManagedBuildRevision());
|
||||
|
||||
// Hook me up
|
||||
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
|
||||
buildInfo.setManagedProject(this);
|
||||
|
@ -94,10 +97,13 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
|||
*
|
||||
* @param buildInfo
|
||||
* @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());
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// Initialize from the XML attributes
|
||||
if (loadFromProject(element)) {
|
||||
// Load children
|
||||
|
@ -105,7 +111,7 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
|||
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||
Node configElement = configElements.item(i);
|
||||
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)) {
|
||||
//load user-defined macros
|
||||
userDefinedMacros = new StorableMacros((Element)configElement);
|
||||
|
@ -440,6 +446,22 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
|||
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
|
||||
* macros available for this managed project
|
||||
|
|
|
@ -21,12 +21,16 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
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.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
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.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -58,11 +62,12 @@ public class Option extends BuildObject implements IOption {
|
|||
private Integer valueType;
|
||||
private Boolean isAbstract;
|
||||
private Integer resourceFilter;
|
||||
private IConfigurationElement applicabilityCalculatorElement = null;
|
||||
private IOptionApplicability applicabilityCalculator = null;
|
||||
// Miscellaneous
|
||||
private boolean isExtensionOption = false;
|
||||
private boolean isDirty = false;
|
||||
private boolean resolved = true;
|
||||
|
||||
/*
|
||||
* C O N S T R U C T O R S
|
||||
*/
|
||||
|
@ -211,7 +216,10 @@ public class Option extends BuildObject implements IOption {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
category = option.category;
|
||||
applicabilityCalculatorElement = option.applicabilityCalculatorElement;
|
||||
applicabilityCalculator = option.applicabilityCalculator;
|
||||
|
||||
setDirty(true);
|
||||
}
|
||||
|
@ -284,6 +292,14 @@ public class Option extends BuildObject implements IOption {
|
|||
} else if (resFilterStr.equals(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)
|
||||
|
@ -670,6 +686,12 @@ public class Option extends BuildObject implements IOption {
|
|||
}
|
||||
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
|
||||
isDirty = false;
|
||||
|
@ -761,6 +783,45 @@ public class Option extends BuildObject implements IOption {
|
|||
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)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
|
||||
*/
|
||||
|
@ -1420,5 +1481,33 @@ 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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
|||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
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.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
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -16,11 +16,13 @@ import java.util.List;
|
|||
import java.util.ListIterator;
|
||||
|
||||
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.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -688,6 +690,15 @@ public class OptionReference implements IOption {
|
|||
return FILTER_ALL;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#getApplicabilityCalculator()
|
||||
*/
|
||||
public IOptionApplicability getApplicabilityCalculator() {
|
||||
return option.getApplicabilityCalculator();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#setResourceFilter(int)
|
||||
*/
|
||||
|
@ -720,5 +731,17 @@ public class OptionReference implements IOption {
|
|||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
|
||||
|
||||
public class ProjectType extends BuildObject implements IProjectType {
|
||||
|
||||
private static final String EMPTY_STRING = new String();
|
||||
|
@ -52,7 +54,7 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
|
||||
// Miscellaneous
|
||||
private boolean resolved = true;
|
||||
|
||||
|
||||
/*
|
||||
* C O N S T R U C T O R S
|
||||
*/
|
||||
|
@ -62,11 +64,14 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
* a plugin manifest file.
|
||||
*
|
||||
* @param element
|
||||
* @param managedBuildRevision
|
||||
*/
|
||||
public ProjectType(IManagedConfigElement element) {
|
||||
public ProjectType(IManagedConfigElement element, String managedBuildRevision) {
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
loadFromManifest(element);
|
||||
|
||||
// Hook me up to the Managed Build Manager
|
||||
|
@ -82,14 +87,14 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
// Tool Integrator provided 'ConfigurationNameProvider' class
|
||||
// to get configuration names dynamically based architecture, os, toolchain version etc.
|
||||
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);
|
||||
config.setName(newConfigName);
|
||||
usedConfigNames[n] = newConfigName;
|
||||
}
|
||||
} else {
|
||||
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 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
|
||||
resolved = false;
|
||||
|
||||
|
@ -112,6 +117,10 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// Hook me up to the Managed Build Manager
|
||||
ManagedBuildManager.addExtensionProjectType(this);
|
||||
}
|
||||
|
@ -134,6 +143,9 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
// Get the name
|
||||
setName(element.getAttribute(NAME));
|
||||
|
||||
// version
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(SUPERCLASS);
|
||||
|
||||
|
@ -473,7 +485,7 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the plugin.xml element of the projectMacroSupplier extension or <code>null</code> if none.
|
||||
*
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
|
|||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
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 element The resource configuration definition from the manifest file
|
||||
* or a dynamic element provider
|
||||
* @param managedBuildRevision
|
||||
*/
|
||||
public ResourceConfiguration(IConfiguration parent, IManagedConfigElement element) {
|
||||
public ResourceConfiguration(IConfiguration parent, IManagedConfigElement element, String managedBuildRevision) {
|
||||
this.parent = parent;
|
||||
isExtensionResourceConfig = true;
|
||||
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
loadFromManifest(element);
|
||||
|
||||
// Hook me up to the Managed Build Manager
|
||||
|
@ -74,7 +77,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
// Load the tool children
|
||||
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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 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;
|
||||
isExtensionResourceConfig = false;
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
// Initialize from the XML attributes
|
||||
loadFromProject(element);
|
||||
|
||||
|
@ -98,7 +103,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||
Node configElement = configElements.item(i);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +115,9 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
setId(id);
|
||||
setName(resourceName);
|
||||
|
||||
if ( parent != null)
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
|
||||
resPath = path;
|
||||
isDirty = false;
|
||||
isExcluded = new Boolean(false);
|
||||
|
@ -128,6 +136,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
this.parent = parent;
|
||||
isExtensionResourceConfig = false;
|
||||
|
||||
setManagedBuildRevision(cloneConfig.getManagedBuildRevision());
|
||||
|
||||
// Copy the remaining attributes
|
||||
if (cloneConfig.resPath != null) {
|
||||
resPath = new String(cloneConfig.resPath);
|
||||
|
@ -143,14 +153,24 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
Tool toolChild = (Tool) iter.next();
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
String subId;
|
||||
String tmpId;
|
||||
String subName;
|
||||
String version;
|
||||
|
||||
if (toolChild.getSuperClass() != null) {
|
||||
subId = toolChild.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
|
||||
tmpId = toolChild.getSuperClass().getId();
|
||||
subName = toolChild.getSuperClass().getName();
|
||||
} else {
|
||||
subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$
|
||||
tmpId = toolChild.getId();
|
||||
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 superclasses reside in different configurations.
|
||||
ITool toolSuperClass = null;
|
||||
|
@ -620,4 +640,22 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
public IResource 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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
|||
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -70,8 +71,9 @@ public class Target extends BuildObject implements ITarget {
|
|||
* a plugin manifest file.
|
||||
*
|
||||
* @param element
|
||||
* @param managedBuildRevision the fileVersion of Managed Build System
|
||||
*/
|
||||
public Target(IManagedConfigElement element) {
|
||||
public Target(IManagedConfigElement element, String managedBuildRevision) {
|
||||
// setup for resolving
|
||||
ManagedBuildManager.putConfigElement(this, element);
|
||||
resolved = false;
|
||||
|
@ -79,6 +81,9 @@ public class Target extends BuildObject implements ITarget {
|
|||
// id
|
||||
setId(element.getAttribute(ID));
|
||||
|
||||
// managedBuildRevision
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// hook me up
|
||||
ManagedBuildManager.addExtensionTarget(this);
|
||||
|
||||
|
@ -133,7 +138,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
}
|
||||
}
|
||||
|
||||
// Load any tool references we might have
|
||||
// Load any tool references we might have
|
||||
IManagedConfigElement[] toolRefs = element.getChildren(IConfigurationV2.TOOLREF_ELEMENT_NAME);
|
||||
for (int k = 0; k < toolRefs.length; ++k) {
|
||||
new ToolReference(this, toolRefs[k]);
|
||||
|
@ -141,7 +146,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
// Then load any tools defined for the target
|
||||
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
|
||||
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
|
||||
this.addTool(newTool);
|
||||
}
|
||||
|
@ -177,6 +182,9 @@ public class Target extends BuildObject implements ITarget {
|
|||
int id = ManagedBuildManager.getRandomNumber();
|
||||
setId(owner.getName() + "." + parent.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
setName(parent.getName());
|
||||
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
|
||||
setArtifactName(parent.getArtifactName());
|
||||
this.binaryParserId = parent.getBinaryParserId();
|
||||
this.errorParserIds = parent.getErrorParserIds();
|
||||
|
@ -959,7 +967,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#convertToProjectType()
|
||||
*/
|
||||
public void convertToProjectType() {
|
||||
public void convertToProjectType(String managedBuildRevision) {
|
||||
// Create a ProjectType + Configuration + Toolchain + Builder + TargetPlatform
|
||||
// from the Target
|
||||
|
||||
|
@ -969,11 +977,11 @@ public class Target extends BuildObject implements ITarget {
|
|||
if (parent != null) {
|
||||
parentProj = parent.getCreatedProjectType();
|
||||
if (parentProj == null) {
|
||||
parent.convertToProjectType();
|
||||
parent.convertToProjectType(managedBuildRevision);
|
||||
parentProj = parent.getCreatedProjectType();
|
||||
}
|
||||
}
|
||||
ProjectType projectType = new ProjectType(parentProj, getId(), getName());
|
||||
ProjectType projectType = new ProjectType(parentProj, getId(), getName(), managedBuildRevision);
|
||||
createdProjectType = projectType;
|
||||
// Set the project type attributes
|
||||
projectType.setIsAbstract(isAbstract);
|
||||
|
@ -1146,4 +1154,20 @@ public class Target extends BuildObject implements ITarget {
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|||
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
@ -56,14 +57,16 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
|
|||
* defined at the top level
|
||||
* @param element The TargetPlatform definition from the manifest file or a dynamic element
|
||||
* 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;
|
||||
isExtensionTargetPlatform = true;
|
||||
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
loadFromManifest(element);
|
||||
|
||||
// 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) {
|
||||
this.parent = parent;
|
||||
this.superClass = superClass;
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
if (this.superClass != null) {
|
||||
superClassId = this.superClass.getId();
|
||||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
isExtensionTargetPlatform = isExtensionElement;
|
||||
if (isExtensionElement) {
|
||||
// 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 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;
|
||||
isExtensionTargetPlatform = false;
|
||||
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
// Initialize from the XML attributes
|
||||
loadFromProject(element);
|
||||
}
|
||||
|
@ -129,6 +136,9 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
|
|||
setId(Id);
|
||||
setName(name);
|
||||
isExtensionTargetPlatform = false;
|
||||
|
||||
if ( targetPlatform != null)
|
||||
setManagedBuildRevision(targetPlatform.getManagedBuildRevision());
|
||||
|
||||
// Copy the remaining attributes
|
||||
if (targetPlatform.unusedChildren != null) {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
|
|||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
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.IManagedCommandLineGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||
|
@ -117,13 +118,17 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
* manifest.
|
||||
*
|
||||
* @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;
|
||||
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
// Set the managedBuildRevision
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
loadFromManifest(element);
|
||||
|
||||
// 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
|
||||
* ResourceConfiguration.
|
||||
* @param element The element containing the information about the tool.
|
||||
* @param managedBuildRevision the fileVersion of Managed Build System
|
||||
*/
|
||||
public Tool(IBuildObject parent, IManagedConfigElement element) {
|
||||
this(element);
|
||||
public Tool(IBuildObject parent, IManagedConfigElement element, String managedBuildRevision) {
|
||||
this(element, managedBuildRevision);
|
||||
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) {
|
||||
this.parent = parent;
|
||||
this.superClass = superClass;
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
if (this.superClass != null) {
|
||||
superClassId = this.superClass.getId();
|
||||
}
|
||||
|
||||
setId(Id);
|
||||
setName(name);
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionTool = isExtensionElement;
|
||||
if (isExtensionElement) {
|
||||
// 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) {
|
||||
this.parent = parent;
|
||||
this.superClass = superClass;
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
if (this.superClass != null) {
|
||||
superClassId = this.superClass.getId();
|
||||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionTool = isExtensionElement;
|
||||
if (isExtensionElement) {
|
||||
// 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>
|
||||
* the tool will be added to.
|
||||
* @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;
|
||||
isExtensionTool = false;
|
||||
|
||||
// Set the managedBuildRevsion
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// Initialize from the XML attributes
|
||||
loadFromProject(element);
|
||||
|
||||
|
@ -277,9 +294,20 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
// Set the managedBuildRevision & the version
|
||||
setManagedBuildRevision(tool.getManagedBuildRevision());
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionTool = false;
|
||||
|
||||
// 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) {
|
||||
unusedChildren = new String(tool.unusedChildren);
|
||||
}
|
||||
|
@ -407,6 +435,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
|
||||
// name
|
||||
setName(element.getAttribute(ITool.NAME));
|
||||
|
||||
// version
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
|
@ -519,6 +550,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
if (element.hasAttribute(IBuildObject.NAME)) {
|
||||
setName(element.getAttribute(IBuildObject.NAME));
|
||||
}
|
||||
|
||||
// version
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
|
@ -2187,90 +2221,102 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
* @return
|
||||
* @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();
|
||||
ArrayList flags = new ArrayList();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int index = 0; index < opts.length; index++) {
|
||||
IOption option = opts[index];
|
||||
sb.setLength( 0 );
|
||||
try{
|
||||
switch (option.getValueType()) {
|
||||
case IOption.BOOLEAN :
|
||||
String boolCmd;
|
||||
if (option.getBooleanValue()) {
|
||||
boolCmd = option.getCommand();
|
||||
} else {
|
||||
// Note: getCommandFalse is new with CDT 2.0
|
||||
boolCmd = option.getCommandFalse();
|
||||
}
|
||||
if (boolCmd != null && boolCmd.length() > 0) {
|
||||
sb.append(boolCmd);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.ENUMERATED :
|
||||
String enumVal = option.getEnumCommand(option.getSelectedEnum());
|
||||
if (enumVal.length() > 0) {
|
||||
sb.append(enumVal);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.STRING :
|
||||
String strCmd = option.getCommand();
|
||||
String val = option.getStringValue();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent()));
|
||||
if (val.length() > 0 && (val = MacroResolver.resolveToString(val,macroSubstitutor)).length() > 0) {
|
||||
sb.append( evaluateCommand( strCmd, val ) );
|
||||
}
|
||||
break;
|
||||
|
||||
// check to see if the option has an applicability calculator
|
||||
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(this)) {
|
||||
try{
|
||||
switch (option.getValueType()) {
|
||||
case IOption.BOOLEAN :
|
||||
String boolCmd;
|
||||
if (option.getBooleanValue()) {
|
||||
boolCmd = option.getCommand();
|
||||
} else {
|
||||
// Note: getCommandFalse is new with CDT 2.0
|
||||
boolCmd = option.getCommandFalse();
|
||||
}
|
||||
if (boolCmd != null && boolCmd.length() > 0) {
|
||||
sb.append(boolCmd);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.STRING_LIST :
|
||||
String listCmd = option.getCommand();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent()));
|
||||
String[] list = MacroResolver.resolveStringListValues(option.getStringListValue(),macroSubstitutor,true);
|
||||
case IOption.ENUMERATED :
|
||||
String enumVal = option.getEnumCommand(option.getSelectedEnum());
|
||||
if (enumVal.length() > 0) {
|
||||
sb.append(enumVal);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.STRING :
|
||||
String strCmd = option.getCommand();
|
||||
String val = option.getStringValue();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
|
||||
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
|
||||
if (val.length() > 0
|
||||
&& (val = MacroResolver.resolveToString(val, macroSubstitutor)).length() > 0) {
|
||||
sb.append( evaluateCommand( strCmd, val ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.STRING_LIST :
|
||||
String listCmd = option.getCommand();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
|
||||
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
|
||||
String[] list = MacroResolver.resolveStringListValues(option.getStringListValue(), macroSubstitutor, true);
|
||||
if(list != null){
|
||||
for (int j = 0; j < list.length; j++) {
|
||||
String temp = list[j];
|
||||
for (int j = 0; j < list.length; j++) {
|
||||
String temp = list[j];
|
||||
if(temp.length() > 0)
|
||||
sb.append( evaluateCommand( listCmd, temp ) + WHITE_SPACE );
|
||||
}
|
||||
sb.append( evaluateCommand( listCmd, temp ) + WHITE_SPACE );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.INCLUDE_PATH :
|
||||
String incCmd = option.getCommand();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent()));
|
||||
String[] paths = MacroResolver.resolveStringListValues(option.getIncludePaths(),macroSubstitutor,true);
|
||||
break;
|
||||
|
||||
case IOption.INCLUDE_PATH :
|
||||
String incCmd = option.getCommand();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
|
||||
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
|
||||
String[] paths = MacroResolver.resolveStringListValues(option.getIncludePaths(), macroSubstitutor, true);
|
||||
if(paths != null){
|
||||
for (int j = 0; j < paths.length; j++) {
|
||||
String temp = paths[j];
|
||||
for (int j = 0; j < paths.length; j++) {
|
||||
String temp = paths[j];
|
||||
if(temp.length() > 0)
|
||||
sb.append( evaluateCommand( incCmd, temp ) + WHITE_SPACE);
|
||||
}
|
||||
sb.append( evaluateCommand( incCmd, temp ) + WHITE_SPACE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IOption.PREPROCESSOR_SYMBOLS :
|
||||
String defCmd = option.getCommand();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,new FileContextData(inputFileLocation,outputFileLocation,option,getParent()));
|
||||
String[] symbols = MacroResolver.resolveStringListValues(option.getDefinedSymbols(),macroSubstitutor,true);
|
||||
break;
|
||||
|
||||
case IOption.PREPROCESSOR_SYMBOLS :
|
||||
String defCmd = option.getCommand();
|
||||
macroSubstitutor.setMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE,
|
||||
new FileContextData(inputFileLocation, outputFileLocation, option, getParent()));
|
||||
String[] symbols = MacroResolver.resolveStringListValues(option.getDefinedSymbols(), macroSubstitutor, true);
|
||||
if(symbols != null){
|
||||
for (int j = 0; j < symbols.length; j++) {
|
||||
String temp = symbols[j];
|
||||
for (int j = 0; j < symbols.length; j++) {
|
||||
String temp = symbols[j];
|
||||
if(temp.length() > 0)
|
||||
sb.append( evaluateCommand( defCmd, temp ) + WHITE_SPACE);
|
||||
}
|
||||
sb.append( evaluateCommand( defCmd, temp ) + WHITE_SPACE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
if( sb.toString().trim().length() > 0 ) flags.add( sb.toString().trim() );
|
||||
} catch (BuildMacroException e) {
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
if (sb.toString().trim().length() > 0)
|
||||
flags.add(sb.toString().trim());
|
||||
} catch (BuildMacroException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
String[] f = new String[ flags.size() ];
|
||||
|
|
|
@ -88,14 +88,18 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
* defined at the top level
|
||||
* @param element The tool-chain definition from the manifest file or a dynamic element
|
||||
* 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;
|
||||
isExtensionToolChain = true;
|
||||
|
||||
// setup for resolving
|
||||
resolved = false;
|
||||
|
||||
// Set the managedBuildRevision
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
loadFromManifest(element);
|
||||
|
||||
// Hook me up to the Managed Build Manager
|
||||
|
@ -108,7 +112,7 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
// TODO: Report error
|
||||
}
|
||||
if (targetPlatforms.length > 0) {
|
||||
targetPlatform = new TargetPlatform(this, targetPlatforms[0]);
|
||||
targetPlatform = new TargetPlatform(this, targetPlatforms[0], managedBuildRevision);
|
||||
}
|
||||
|
||||
// Load the Builder child
|
||||
|
@ -118,13 +122,13 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
// TODO: Report error
|
||||
}
|
||||
if (builders.length > 0) {
|
||||
builder = new Builder(this, builders[0]);
|
||||
builder = new Builder(this, builders[0], managedBuildRevision);
|
||||
}
|
||||
|
||||
// Load the tool children
|
||||
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -142,11 +146,15 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
public ToolChain(Configuration parent, IToolChain superClass, String Id, String name, boolean isExtensionElement) {
|
||||
this.parent = parent;
|
||||
this.superClass = superClass;
|
||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||
|
||||
if (this.superClass != null) {
|
||||
superClassId = this.superClass.getId();
|
||||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionToolChain = isExtensionElement;
|
||||
if (isExtensionElement) {
|
||||
// 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 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;
|
||||
isExtensionToolChain = false;
|
||||
|
||||
// Set the managedBuildRevision
|
||||
setManagedBuildRevision(managedBuildRevision);
|
||||
|
||||
// Initialize from the XML attributes
|
||||
loadFromProject(element);
|
||||
|
||||
|
@ -175,21 +187,22 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||
Node configElement = configElements.item(i);
|
||||
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);
|
||||
}else if (configElement.getNodeName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
|
||||
if (targetPlatform != null) {
|
||||
// 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)) {
|
||||
if (builder != null) {
|
||||
// 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)) {
|
||||
//load user-defined macros
|
||||
userDefinedMacros = new StorableMacros((Element)configElement);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,9 +223,21 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
}
|
||||
setId(Id);
|
||||
setName(name);
|
||||
|
||||
// Set the managedBuildRevision and the version
|
||||
setManagedBuildRevision(toolChain.getManagedBuildRevision());
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
isExtensionToolChain = false;
|
||||
|
||||
// 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) {
|
||||
unusedChildren = new String(toolChain.unusedChildren);
|
||||
}
|
||||
|
@ -250,14 +275,24 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
if (toolChain.builder != null) {
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
String subId;
|
||||
String tmpId;
|
||||
String version;
|
||||
String subName;
|
||||
|
||||
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();
|
||||
} else {
|
||||
subId = toolChain.builder.getId() + "." + nnn; //$NON-NLS-1$
|
||||
tmpId = toolChain.builder.getId(); //$NON-NLS-1$
|
||||
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);
|
||||
}
|
||||
if (toolChain.targetPlatform != null) {
|
||||
|
@ -279,14 +314,24 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
Tool toolChild = (Tool) iter.next();
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
String subId;
|
||||
String tmpId;
|
||||
String subName;
|
||||
String version;
|
||||
|
||||
if (toolChild.getSuperClass() != null) {
|
||||
subId = toolChild.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
|
||||
tmpId = toolChild.getSuperClass().getId();
|
||||
subName = toolChild.getSuperClass().getName();
|
||||
} else {
|
||||
subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$
|
||||
tmpId = toolChild.getId();
|
||||
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);
|
||||
addTool(newTool);
|
||||
}
|
||||
|
@ -314,6 +359,9 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
// Get the name
|
||||
setName(element.getAttribute(IBuildObject.NAME));
|
||||
|
||||
// version
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
|
||||
|
@ -384,6 +432,7 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Initialize the tool-chain information from the XML element
|
||||
* specified in the argument
|
||||
|
@ -399,7 +448,10 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
if (element.hasAttribute(IBuildObject.NAME)) {
|
||||
setName(element.getAttribute(IBuildObject.NAME));
|
||||
}
|
||||
|
||||
|
||||
// version
|
||||
setVersion(getVersionFromId());
|
||||
|
||||
// superClass
|
||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||
if (superClassId != null && superClassId.length() > 0) {
|
||||
|
@ -1367,6 +1419,4 @@ public class ToolChain extends BuildObject implements IToolChain {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
|||
import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
|
||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||
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.IOption;
|
||||
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.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -440,6 +442,12 @@ public class ToolReference implements IToolReference {
|
|||
IOption[] opts = getOptions();
|
||||
for (int index = 0; index < opts.length; 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()) {
|
||||
case IOption.BOOLEAN :
|
||||
String boolCmd;
|
||||
|
@ -503,6 +511,7 @@ public class ToolReference implements IToolReference {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return buf.toString().trim();
|
||||
}
|
||||
|
@ -811,7 +820,7 @@ public class ToolReference implements IToolReference {
|
|||
*/
|
||||
public String[] getCommandFlags() throws BuildException {
|
||||
if( parent == null ) return null;
|
||||
return parent.getCommandFlags();
|
||||
return parent.getToolCommandFlags(null, null);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1174,4 +1183,16 @@ public class ToolReference implements IToolReference {
|
|||
public IEnvVarBuildPath[] getEnvVarBuildPaths(){
|
||||
return null;
|
||||
}
|
||||
|
||||
public PluginVersionIdentifier getVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setVersion(PluginVersionIdentifier version) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public String getManagedBuildRevision() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,6 +256,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
private static final String POSTBUILD = "post-build"; //$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
|
||||
private String buildTargetName;
|
||||
private String buildTargetExt;
|
||||
|
@ -1838,12 +1844,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
varName = getSourceMacroName(ext).toString();
|
||||
// Add the resource to the list of all resources associated with a variable.
|
||||
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 {
|
||||
// Add the resource to the list of all resources associated with a variable.
|
||||
List varList = (List)buildOutVars.get(varName);
|
||||
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)) {
|
||||
|
@ -2796,14 +2806,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
}
|
||||
|
||||
/* (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 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
|
||||
* variable have done so.
|
||||
* @return List
|
||||
*/
|
||||
public List getBuildVariableList(String variable, boolean getAll) {
|
||||
public List getBuildVariableList(String variable, int locationType, IPath directory, boolean getAll) {
|
||||
boolean done = true;
|
||||
for (int i=0; i<gnuToolInfos.length; i++) {
|
||||
if (!gnuToolInfos[i].areOutputVariablesCalculated()) {
|
||||
|
@ -2812,7 +2824,33 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
}
|
||||
if (!done && getAll) return null;
|
||||
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)
|
||||
|
|
|
@ -200,7 +200,8 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
|
|||
}
|
||||
// If there is an output variable with the same name, get
|
||||
// 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) {
|
||||
myEnumeratedInputs.addAll(outMacroList);
|
||||
} else {
|
||||
|
@ -229,7 +230,6 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
|
|||
String fileExt = projResources[j].getFileExtension();
|
||||
for (int k=0; k<exts.length; k++) {
|
||||
if (fileExt.equals(exts[k])) {
|
||||
// TODO - is project relative correct?
|
||||
if (!useFileExts) {
|
||||
if(!handledInputExtensions.contains(fileExt)) {
|
||||
handledInputExtensions.add(fileExt);
|
||||
|
@ -243,7 +243,13 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
|
|||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue