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

crecoskie Oct 14, 2005

- Adding macro support to buildDefinitions markup.  See Bugzilla 111203
This commit is contained in:
Chris Recoskie 2005-10-14 13:29:04 +00:00
parent 8c41743dc7
commit de026bcfe6
9 changed files with 384 additions and 5 deletions

View file

@ -4143,6 +4143,77 @@
</toolChain> </toolChain>
</configuration> </configuration>
</projectType> </projectType>
<projectType
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportProjectType"
isAbstract="false"
isTest="true"
name="Build Definitions Macro Support Project Type">
<configuration
artifactExtension="tar"
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportConfiguration"
name="Default">
<toolChain
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportToolchain"
isAbstract="false"
name="Build Definition Macro Support Toolchain"
targetTool="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportBarTool">
<builder
arguments="-k"
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
command="make"
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportBuilder"
isAbstract="false"
name="GNU Make"
superClass="cdt.managedbuild.target.gnu.builder"/>
<tool
command="cp"
commandLinePattern="${command} ${inputs} ${output}"
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportFooTool"
isAbstract="false"
name="Foo Tool"
natureFilter="both">
<inputType
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportFooInputType"
multipleOfType="false"
name="Foo Files"
primaryInput="true"
sources="foo"/>
<outputType
buildVariable="BAR_FILES"
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportBarOutputType"
multipleOfType="false"
name="Bar Files"
outputPrefix="this_is_a_test_prefix_with_a_macro_for_the_project_name_between_here_${ProjName}_and_here"
outputs="bar"
primaryInputType="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportFooInputType"
primaryOutput="true"/>
</tool>
<tool
command="tar"
commandLinePattern="${command} cvf ${OutputFileRelPath} ${inputs}"
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportBarTool"
isAbstract="false"
name="Bar Tool"
natureFilter="both">
<inputType
buildVariable="BAR_FILES"
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportBarInputType"
multipleOfType="true"
name="Bar Files"
primaryInput="true"
sources="bar"/>
<outputType
id="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportTarOutputType"
multipleOfType="false"
name="Tar File"
outputPrefix=" "
outputs="tar"
primaryInputType="org.eclipse.cdt.managedbuilder.core.tests.BDMacroSupportBarInputType"
primaryOutput="true"/>
</tool>
</toolChain>
</configuration>
</projectType>
</extension> </extension>

View file

@ -79,6 +79,7 @@ public class ManagedProject30MakefileTests extends TestCase {
suite.addTest(new ManagedProject30MakefileTests("CDTFortranTest1")); suite.addTest(new ManagedProject30MakefileTests("CDTFortranTest1"));
suite.addTest(new ManagedProject30MakefileTests("CDTFortranTest2")); suite.addTest(new ManagedProject30MakefileTests("CDTFortranTest2"));
suite.addTest(new ManagedProject30MakefileTests("TestATO")); suite.addTest(new ManagedProject30MakefileTests("TestATO"));
suite.addTest(new ManagedProject30MakefileTests("testMacroSupportInBuildDefinitions"));
return suite; return suite;
} }
@ -584,4 +585,16 @@ public class ManagedProject30MakefileTests extends TestCase {
IProject[] projects = createProjects("TestATO", null, null, true); IProject[] projects = createProjects("TestATO", null, null, true);
buildProjects(projects, makefiles); buildProjects(projects, makefiles);
} }
public void testMacroSupportInBuildDefinitions() {
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk")};
IProject[] projects = createProjects("testMacroSupportInBuildDefinitions", null, null, true);
buildProjects(projects, makefiles);
}
} }

View file

@ -121,7 +121,7 @@
<attribute name="configurationNameProvider" type="string"> <attribute name="configurationNameProvider" type="string">
<annotation> <annotation>
<documentation> <documentation>
Contains the name of a class that implements an interface with a method for returning a default name for a configuration. The configuration names in a user's project must be unique. A projectType can contain configuration children with the same name. In this case, a configurationNameProvider must be specified to make the names unique before they are displayed to the user in the New Project and New Configuration dialog boxes. Contains the name of a class that implements an interface with a method for returning a default name for a configuration. The configuration names in a user&apos;s project must be unique. A projectType can contain configuration children with the same name. In this case, a configurationNameProvider must be specified to make the names unique before they are displayed to the user in the New Project and New Configuration dialog boxes.
</documentation> </documentation>
<appInfo> <appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider"/> <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider"/>
@ -570,14 +570,14 @@
<attribute name="command" type="string"> <attribute name="command" type="string">
<annotation> <annotation>
<documentation> <documentation>
The command that invokes the tool. For example, gcc for the Gnu C compiler, or g++ for the Gnu C++ compiler. The command that invokes the tool. For example, gcc for the Gnu C compiler, or g++ for the Gnu C++ compiler. This attribute supports MBS file context macros.
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="commandLinePattern" type="string"> <attribute name="commandLinePattern" type="string">
<annotation> <annotation>
<documentation> <documentation>
Specifies the command &quot;pattern&quot; that indicates how the parts of the command line are used to create the entire command line. The pattern consists of the replaceable variables COMMAND, FLAGS, OUTPUT_FLAG, OUTPUT_PREFIX, OUTPUT and INPUTS. The default command line pattern is ${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}, except when customBuildStep is true, where the default is $(COMMAND). White space and other characters are significant and are copied to the generated command. Specifies the command &quot;pattern&quot; that indicates how the parts of the command line are used to create the entire command line. The pattern consists of the replaceable variables COMMAND, FLAGS, OUTPUT_FLAG, OUTPUT_PREFIX, OUTPUT and INPUTS. The default command line pattern is ${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}, except when customBuildStep is true, where the default is $(COMMAND). White space and other characters are significant and are copied to the generated command. This attribute supports MBS file context macros.
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
@ -899,7 +899,7 @@
<attribute name="outputPrefix" type="string"> <attribute name="outputPrefix" type="string">
<annotation> <annotation>
<documentation> <documentation>
Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be libtarget.a, so &apos;lib&apos; would be the prefix. The default is to use the Tool “outputPrefix” attribute if primaryOutput is True, otherwise the default is an empty string. Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be libtarget.a, so &apos;lib&apos; would be the prefix. The default is to use the Tool “outputPrefix” attribute if primaryOutput is True, otherwise the default is an empty string. This attribute supports the use of MBS configuration macros.
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
@ -1141,7 +1141,7 @@ Additional special types exist to flag options of special relevance to the build
<attribute name="valueHandler" type="string"> <attribute name="valueHandler" type="string">
<annotation> <annotation>
<documentation> <documentation>
The id of a class that implements the IManagedOptionValueHandler interface. This interface is used to dynamically manage the value of an option. The id of a class that implements the IManagedOptionValueHandler interface. This interface is used to dynamically manage the value of an option.
</documentation> </documentation>
<appInfo> <appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler"/> <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler"/>

View file

@ -383,6 +383,57 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
if(targetTool != null){ if(targetTool != null){
IOutputType pot = targetTool.getPrimaryOutputType(); IOutputType pot = targetTool.getPrimaryOutputType();
String prefix = pot.getOutputPrefix(); String prefix = pot.getOutputPrefix();
// Resolve any macros in the outputPrefix
// Note that we cannot use file macros because if we do a clean
// we need to know the actual
// name of the file to clean, and cannot use any builder
// variables such as $@. Hence
// we use the next best thing, i.e. configuration context.
// figure out the configuration we're using
IBuildObject toolParent = targetTool.getParent();
IConfiguration config = null;
// if the parent is a config then we're done
if (toolParent instanceof IConfiguration)
config = (IConfiguration) toolParent;
else if (toolParent instanceof IToolChain) {
// must be a toolchain
config = (IConfiguration) ((IToolChain) toolParent)
.getParent();
}
else if (toolParent instanceof IResourceConfiguration) {
config = (IConfiguration) ((IResourceConfiguration) toolParent)
.getParent();
}
else {
// bad
throw new AssertionError(
"tool parent must be one of configuration, toolchain, or resource configuration");
}
if (config != null) {
try {
prefix = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
prefix,
"", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION,
config);
}
catch (BuildMacroException e) {
}
}
if(prefix != null && !EMPTY_STRING.equals(prefix)) if(prefix != null && !EMPTY_STRING.equals(prefix))
name = prefix + name; name = prefix + name;
} }
@ -393,6 +444,55 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
if(targetTool != null){ if(targetTool != null){
IOutputType pot = targetTool.getPrimaryOutputType(); IOutputType pot = targetTool.getPrimaryOutputType();
String prefix = pot.getOutputPrefix(); String prefix = pot.getOutputPrefix();
// Resolve any macros in the outputPrefix
// Note that we cannot use file macros because if we do a clean
// we need to know the actual
// name of the file to clean, and cannot use any builder
// variables such as $@. Hence
// we use the next best thing, i.e. configuration context.
// figure out the configuration we're using
IBuildObject toolParent = targetTool.getParent();
IConfiguration config = null;
// if the parent is a config then we're done
if (toolParent instanceof IConfiguration)
config = (IConfiguration) toolParent;
else if (toolParent instanceof IToolChain) {
// must be a toolchain
config = (IConfiguration) ((IToolChain) toolParent)
.getParent();
}
else if (toolParent instanceof IResourceConfiguration) {
config = (IConfiguration) ((IResourceConfiguration) toolParent)
.getParent();
}
else {
// bad
throw new AssertionError(
"tool parent must be one of configuration, toolchain, or resource configuration");
}
if (config != null) {
try {
prefix = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
prefix,
"", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION,
config);
}
catch (BuildMacroException e) {
}
}
if(prefix == null) if(prefix == null)
prefix = EMPTY_STRING; prefix = EMPTY_STRING;
macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,prefix); macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,prefix);

View file

@ -26,13 +26,17 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/** /**
* @since 2.0 * @since 2.0
*/ */
public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerator { public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerator {
private static final String EMPTY_STRING = new String();
private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] EMPTY_STRING_ARRAY = new String[0];
public final String WHITESPACE = " "; //$NON-NLS-1$
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
@ -149,6 +153,21 @@ public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerat
cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix, cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
outputFile, inputs, tool.getCommandLinePattern() ); outputFile, inputs, tool.getCommandLinePattern() );
buildCmd = cmdLInfo.getCommandLine(); buildCmd = cmdLInfo.getCommandLine();
// resolve any remaining macros in the command after it has been generated
try{
String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(buildCmd,
EMPTY_STRING,
WHITESPACE,
IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(resource.getLocation(), null, null, info.getDefaultConfiguration().getToolChain()));
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
buildCmd = resolvedCommand;
} catch (BuildMacroException e){
}
} else { } else {
String cmd = info.getToolForSource(inputExtension); String cmd = info.getToolForSource(inputExtension);
//try to resolve the build macros in the tool command //try to resolve the build macros in the tool command

View file

@ -11,9 +11,16 @@
package org.eclipse.cdt.managedbuilder.makegen.gnu; package org.eclipse.cdt.managedbuilder.makegen.gnu;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider; import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider;
import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator; import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
@ -79,6 +86,55 @@ public class GnuLinkOutputNameProvider implements IManagedOutputNameProvider {
} else { } else {
// Add the outputPrefix // Add the outputPrefix
String outputPrefix = tool.getPrimaryOutputType().getOutputPrefix(); String outputPrefix = tool.getPrimaryOutputType().getOutputPrefix();
// Resolve any macros in the outputPrefix
// Note that we cannot use file macros because if we do a clean
// we need to know the actual
// name of the file to clean, and cannot use any builder
// variables such as $@. Hence
// we use the next best thing, i.e. configuration context.
// figure out the configuration we're using
IBuildObject toolParent = tool.getParent();
IConfiguration config = null;
// if the parent is a config then we're done
if (toolParent instanceof IConfiguration)
config = (IConfiguration) toolParent;
else if (toolParent instanceof IToolChain) {
// must be a toolchain
config = (IConfiguration) ((IToolChain) toolParent)
.getParent();
}
else if (toolParent instanceof IResourceConfiguration) {
config = (IConfiguration) ((IResourceConfiguration) toolParent)
.getParent();
}
else {
// bad
throw new AssertionError(
"tool parent must be one of configuration, toolchain, or resource configuration");
}
if (config != null) {
try {
outputPrefix = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
outputPrefix,
"", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION,
config);
}
catch (BuildMacroException e) {
}
}
if (outputPrefix != null && outputPrefix.length() > 0) { if (outputPrefix != null && outputPrefix.length() > 0) {
fileName = outputPrefix + fileName; fileName = outputPrefix + fileName;
} }

View file

@ -1542,6 +1542,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
IManagedCommandLineGenerator gen = tool.getCommandLineGenerator(); IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo( tool, command, IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo( tool, command,
flags, outflag, outputPrefix, primaryOutputs, cmdInputs, tool.getCommandLinePattern() ); flags, outflag, outputPrefix, primaryOutputs, cmdInputs, tool.getCommandLinePattern() );
// The command to build // The command to build
String buildCmd = null; String buildCmd = null;
if( cmdLInfo == null ) { if( cmdLInfo == null ) {
@ -1555,6 +1556,26 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO; buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO;
} }
else buildCmd = cmdLInfo.getCommandLine(); else buildCmd = cmdLInfo.getCommandLine();
// resolve any remaining macros in the command after it has been
// generated
try {
String resolvedCommand = ManagedBuildManager
.getBuildMacroProvider().resolveValueToMakefileFormat(
buildCmd,
EMPTY_STRING,
WHITESPACE,
IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(null, null, null, info
.getDefaultConfiguration()
.getToolChain()));
if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
buildCmd = resolvedCommand;
} catch (BuildMacroException e) {
}
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE); buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
buffer.append(TAB + AT + buildCmd); buffer.append(TAB + AT + buildCmd);
@ -2265,6 +2286,28 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), tool.getCommandLinePattern() ); OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), tool.getCommandLinePattern() );
String buildCmd = cmdLInfo.getCommandLine(); String buildCmd = cmdLInfo.getCommandLine();
// resolve any remaining macros in the command after it has been
// generated
try {
String resolvedCommand = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
buildCmd,
EMPTY_STRING,
WHITESPACE,
IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(sourceLocation,
outputLocation, null, info
.getDefaultConfiguration()
.getToolChain()));
if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
buildCmd = resolvedCommand;
} catch (BuildMacroException e) {
}
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE); buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
buffer.append(TAB + AT + buildCmd); buffer.append(TAB + AT + buildCmd);
} else { } else {
@ -2542,6 +2585,56 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
boolean primaryOutput = (type == tool.getPrimaryOutputType()); boolean primaryOutput = (type == tool.getPrimaryOutputType());
//if (primaryOutput && ignorePrimary) continue; //if (primaryOutput && ignorePrimary) continue;
String outputPrefix = type.getOutputPrefix(); String outputPrefix = type.getOutputPrefix();
// Resolve any macros in the outputPrefix
// Note that we cannot use file macros because if we do a clean
// we need to know the actual name of the file to clean, and
// cannot use any builder variables such as $@. Hence we use the
// next best thing, i.e. configuration context.
// figure out the configuration we're using
IBuildObject toolParent = tool.getParent();
IConfiguration config = null;
// if the parent is a config then we're done
if (toolParent instanceof IConfiguration)
config = (IConfiguration) toolParent;
else if (toolParent instanceof IToolChain) {
// must be a toolchain
config = (IConfiguration) ((IToolChain) toolParent)
.getParent();
}
else if (toolParent instanceof IResourceConfiguration) {
config = (IConfiguration) ((IResourceConfiguration) toolParent)
.getParent();
}
else {
// bad
throw new AssertionError(
"tool parent must be one of configuration, toolchain, or resource configuration");
}
if (config != null) {
try {
outputPrefix = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
outputPrefix,
"", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION,
config);
}
catch (BuildMacroException e) {
}
}
boolean multOfType = type.getMultipleOfType(); boolean multOfType = type.getMultipleOfType();
IOption option = tool.getOptionBySuperClassId(type.getOptionId()); IOption option = tool.getOptionBySuperClassId(type.getOptionId());
IManagedOutputNameProvider nameProvider = type.getNameProvider(); IManagedOutputNameProvider nameProvider = type.getNameProvider();

View file

@ -20,6 +20,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput; import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IInputType; import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IOutputType; import org.eclipse.cdt.managedbuilder.core.IOutputType;
@ -27,6 +28,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider; import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException; import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider; import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
@ -434,6 +436,31 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
Vector typeEnumeratedOutputs = new Vector(); Vector typeEnumeratedOutputs = new Vector();
IOutputType type = outTypes[i]; IOutputType type = outTypes[i];
String outputPrefix = type.getOutputPrefix(); String outputPrefix = type.getOutputPrefix();
// Resolve any macros in the outputPrefix
// Note that we cannot use file macros because if we do a clean
// we need to know the actual name of the file to clean, and
// cannot use any builder variables such as $@. Hence we use the
// next best thing, i.e. configuration context.
if (config != null) {
try {
outputPrefix = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
outputPrefix,
"", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION,
config);
}
catch (BuildMacroException e) {
}
}
String variable = type.getBuildVariable(); String variable = type.getBuildVariable();
boolean multOfType = type.getMultipleOfType(); boolean multOfType = type.getMultipleOfType();
boolean primaryOutput = (type == tool.getPrimaryOutputType()); boolean primaryOutput = (type == tool.getPrimaryOutputType());