mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Patch for Sean Evoy:
- I have removed the binary parser selection from the new managed project wizard and hard-coded the proper parser ID in the plugin spec for the build model. There is an updated JUnit test that verifies this change to the build model. - There is also a fix for the library problem on *nix. The makefile pattern was also changed slightly to better capture the dependencies between the build target and the outputs of other managed projects.
This commit is contained in:
parent
e1ef9ffd9f
commit
0abb42e093
15 changed files with 251 additions and 118 deletions
|
@ -1,3 +1,20 @@
|
|||
2003-09-19 Sean Evoy
|
||||
Added a new field to the target specification in the build model to
|
||||
hard-code the binary parser for project creation. There is a new getter
|
||||
method in the interface and the implementor contains additional code to
|
||||
extract the information from a project file or plugin manifest. The
|
||||
interface also contains new strings to make changing the specification
|
||||
easier in the future.
|
||||
* schema/ManagedBuildTools.exsd
|
||||
* src/org/eclipse/cdt/managedbuilder/core/ITarget.java
|
||||
* src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
|
||||
|
||||
Fix for bug 41720: libraries are now found for Solaris and Linux
|
||||
executables. The problem was the executable had no extension and
|
||||
the client of the build model passed null instead of the empty string.
|
||||
* src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
|
||||
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
|
||||
|
||||
2003-09-16 Sean Evoy
|
||||
Patch contains a fix for bug 43017. Renamed the "addDeps" method to a
|
||||
more descriptive "addSourceDependencies". Added a flag when the
|
||||
|
|
|
@ -387,6 +387,13 @@ Two additional types exist to flag options of special relevance to the build mod
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="binaryParser" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Set this to the ID of the binary parser for the output format of your target. Currently there are only 2 choices: org.eclipse.cdt.core.ELF for *nix targets, and "org.eclipse.cdt.core.PE" for targets that build for Windows, like Cygwin.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -18,7 +18,15 @@ import org.eclipse.core.resources.IResource;
|
|||
*/
|
||||
public interface ITarget extends IBuildObject {
|
||||
public static final String TARGET_ELEMENT_NAME = "target"; //$NON-NLS-1$
|
||||
|
||||
public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
|
||||
public static final String BINARY_PARSER = "binaryParser"; //$NON-NLS-1$
|
||||
public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
|
||||
public static final String DEFAULT_EXTENSION = "defaultExtension"; //$NON-NLS-1$
|
||||
public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
|
||||
public static final String IS_TEST = "isTest"; //$NON-NLS-1$
|
||||
public static final String MAKE_COMMAND = "makeCommand"; //$NON-NLS-1$
|
||||
public static final String PARENT = "parent"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Creates a configuration for the target populated with the tools and
|
||||
* options settings from the parent configuration. As options and tools
|
||||
|
@ -47,6 +55,13 @@ public interface ITarget extends IBuildObject {
|
|||
*/
|
||||
public String getArtifactName();
|
||||
|
||||
/**
|
||||
* Answers the unique ID of the binary parser associated with the target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getBinaryParserId();
|
||||
|
||||
/**
|
||||
* Answers the OS-specific command to remove files created by the build
|
||||
*
|
||||
|
|
|
@ -18,19 +18,17 @@ import java.util.Enumeration;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CommandLauncher;
|
||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.core.resources.MakeUtil;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -208,18 +206,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
if (fullBuild) {
|
||||
args.add("clean");
|
||||
}
|
||||
// Add each target
|
||||
String sessionTarget = MakeUtil.getSessionTarget(getProject());
|
||||
StringTokenizer tokens = new StringTokenizer(sessionTarget);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String target = tokens.nextToken().trim();
|
||||
if (!args.contains(target)) {
|
||||
args.add(target);
|
||||
}
|
||||
}
|
||||
if (args.isEmpty() || !args.contains("all")) {
|
||||
args.add("all");
|
||||
}
|
||||
args.add("all");
|
||||
return (String[])args.toArray(new String[args.size()]);
|
||||
}
|
||||
|
||||
|
@ -233,7 +220,10 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
return resourcesToBuild;
|
||||
}
|
||||
|
||||
/**
|
||||
/* (non-javadoc)
|
||||
* Answers the list of build rules that have been assembled. If there are none,
|
||||
* answers an empty list, never <code>null</code>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected List getRuleList() {
|
||||
|
@ -248,9 +238,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
*/
|
||||
public IPath getWorkingDirectory() {
|
||||
IProject currProject = getProject();
|
||||
IPath workingDirectory = new Path(MakeUtil.getSessionBuildDir((IResource) currProject));
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = currProject.getLocation();
|
||||
IPath workingDirectory = currProject.getLocation();
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,9 @@ public class MakefileGenerator {
|
|||
protected IPath topBuildDir;
|
||||
protected boolean shouldRunBuild;
|
||||
|
||||
private String target;
|
||||
|
||||
private String extension;
|
||||
/**
|
||||
* This class is used to recursively walk the project and determine which
|
||||
* modules contribute buildable source files.
|
||||
|
@ -211,6 +214,13 @@ public class MakefileGenerator {
|
|||
this.info = info;
|
||||
// By default a build never runs
|
||||
shouldRunBuild = false;
|
||||
// Get the name of the build target
|
||||
target = info.getBuildArtifactName();
|
||||
// Get its extension
|
||||
extension = (new Path(target)).getFileExtension();
|
||||
if (extension == null) {
|
||||
extension = new String();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-javadoc)
|
||||
|
@ -289,12 +299,22 @@ public class MakefileGenerator {
|
|||
|
||||
buffer.append(ManagedBuilderCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
|
||||
buffer.append("C_SRCS := " + NEWLINE);
|
||||
buffer.append("CC_SRCS := " + NEWLINE + NEWLINE);
|
||||
buffer.append("CC_SRCS := " + NEWLINE);
|
||||
buffer.append("CXX_SRCS := " + NEWLINE);
|
||||
buffer.append("CAPC_SRCS := " + NEWLINE);
|
||||
buffer.append("CPP_SRCS := " + NEWLINE + NEWLINE);
|
||||
|
||||
// Add the libraries this project depends on
|
||||
buffer.append("LIBS := ");
|
||||
String[] libs = info.getLibsForTarget(extension);
|
||||
for (int i = 0; i < libs.length; i++) {
|
||||
String string = libs[i];
|
||||
buffer.append(LINEBREAK + NEWLINE + string);
|
||||
}
|
||||
buffer.append(NEWLINE + NEWLINE);
|
||||
return buffer;
|
||||
|
||||
buffer.append("OBJS = $(C_SRCS:$(ROOT)/%.c=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o) $(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CAPC_SRCS:$(ROOT)/%.C=%.o) $(CPP_SRCS:$(ROOT)/%.cpp=%.o)" + NEWLINE);
|
||||
return (buffer.append(NEWLINE));
|
||||
}
|
||||
|
||||
/* (non-javadoc)
|
||||
|
@ -347,6 +367,12 @@ public class MakefileGenerator {
|
|||
cBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
|
||||
StringBuffer ccBuffer = new StringBuffer("CC_SRCS += \\" + NEWLINE);
|
||||
ccBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
|
||||
StringBuffer cxxBuffer = new StringBuffer("CXX_SRCS += \\" + NEWLINE);
|
||||
cxxBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
|
||||
StringBuffer capcBuffer = new StringBuffer("CAPC_SRCS += \\" + NEWLINE);
|
||||
capcBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
|
||||
StringBuffer cppBuffer = new StringBuffer("CPP_SRCS += \\" + NEWLINE);
|
||||
cppBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
|
||||
StringBuffer ruleBuffer = new StringBuffer(ManagedBuilderCorePlugin.getResourceString(MOD_RULES) + NEWLINE);
|
||||
|
||||
// Put the comment in
|
||||
|
@ -359,8 +385,18 @@ public class MakefileGenerator {
|
|||
if (resource.getType() == IResource.FILE) {
|
||||
String ext = resource.getFileExtension();
|
||||
if (info.buildsFileType(ext)) {
|
||||
// TODO use build model to determine what list the file goes in
|
||||
ccBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
|
||||
if (new String("c").equals(ext)) {
|
||||
cBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
|
||||
} else if (new String("cc").equalsIgnoreCase(ext)) {
|
||||
ccBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
|
||||
} else if (new String("cxx").equalsIgnoreCase(ext)) {
|
||||
cxxBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
|
||||
} else if (new String("C").equals(ext)) {
|
||||
capcBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
|
||||
} else {
|
||||
cppBuffer.append(resource.getName() + WHITESPACE + LINEBREAK + NEWLINE);
|
||||
}
|
||||
|
||||
// Try to add the rule for the file
|
||||
addRule(relativePath, ruleBuffer, resource);
|
||||
}
|
||||
|
@ -368,12 +404,13 @@ public class MakefileGenerator {
|
|||
}
|
||||
|
||||
// Finish the commands in the buffers
|
||||
cBuffer.append("}" + NEWLINE + NEWLINE);
|
||||
ccBuffer.append("}" + NEWLINE + NEWLINE);
|
||||
buffer.append(cBuffer.append("}" + NEWLINE + NEWLINE));
|
||||
buffer.append(ccBuffer.append("}" + NEWLINE + NEWLINE));
|
||||
buffer.append(cxxBuffer.append("}" + NEWLINE + NEWLINE));
|
||||
buffer.append(capcBuffer.append("}" + NEWLINE + NEWLINE));
|
||||
buffer.append(cppBuffer.append("}" + NEWLINE + NEWLINE));
|
||||
|
||||
// Append them all together
|
||||
buffer.append(cBuffer).append(ccBuffer).append(ruleBuffer);
|
||||
return buffer;
|
||||
return buffer.append(ruleBuffer + NEWLINE);
|
||||
}
|
||||
|
||||
/* (non-javadoc)
|
||||
|
@ -383,65 +420,77 @@ public class MakefileGenerator {
|
|||
protected StringBuffer addTargets(boolean rebuild) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
// Get the target and it's extension
|
||||
String target = info.getBuildArtifactName();
|
||||
IPath temp = new Path(target);
|
||||
String extension = temp.getFileExtension();
|
||||
|
||||
/*
|
||||
* Write out the target rule as:
|
||||
* <prefix><target>.<extension>: $(CC_SRCS:$(ROOT)/%.cpp=%.o) $(C_SRCS:$(ROOT)/%.c=%.o)
|
||||
* <cd <Proj_Dep_1/build_dir>; $(MAKE) all>
|
||||
* <cd <Proj_Dep_.../build_dir>; $(MAKE) all>
|
||||
* <cd <Proj_Dep_n/build_dir>; $(MAKE) all>
|
||||
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $^ $(LIB_DEPS)
|
||||
*/
|
||||
// Assemble the information needed to generate the targets
|
||||
String cmd = info.getToolForTarget(extension);
|
||||
String flags = info.getFlagsForTarget(extension);
|
||||
String outflag = info.getOutputFlag(extension);
|
||||
String outputPrefix = info.getOutputPrefix(extension);
|
||||
String targets = rebuild ? "clean all" : "all";
|
||||
buffer.append(outputPrefix + target + COLON + WHITESPACE + "$(CC_SRCS:$(ROOT)/%.cpp=%.o) $(C_SRCS:$(ROOT)/%.c=%.o)" + NEWLINE);
|
||||
IProject[] deps;
|
||||
|
||||
// Get all the projects the build target depends on
|
||||
IProject[] deps = null;
|
||||
try {
|
||||
deps = project.getReferencedProjects();
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
IProject dep = deps[i];
|
||||
String buildDir = dep.getLocation().toString();
|
||||
if (ManagedBuildManager.manages(dep)) {
|
||||
IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(dep);
|
||||
buildDir += SEPARATOR + depInfo.getConfigurationName();
|
||||
}
|
||||
buffer.append(TAB + "cd" + WHITESPACE + buildDir + SEMI_COLON + WHITESPACE + "$(MAKE) " + targets + NEWLINE);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
// There are 2 exceptions; the project does not exist or it is not open
|
||||
// and neither conditions apply if we are building for it ....
|
||||
}
|
||||
|
||||
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + "$@" + WHITESPACE + "$^");
|
||||
String[] libraries = info.getLibsForTarget(extension);
|
||||
for (int i = 0; i < libraries.length; i++) {
|
||||
String lib = libraries[i];
|
||||
buffer.append(WHITESPACE + lib);
|
||||
}
|
||||
buffer.append(NEWLINE);
|
||||
// Write out the all target first in case someone just runs make
|
||||
buffer.append("all: deps" + WHITESPACE + outputPrefix + target + NEWLINE);
|
||||
buffer.append(NEWLINE);
|
||||
|
||||
// We only have one target, 'all'
|
||||
buffer.append("all: " + outputPrefix + target + NEWLINE);
|
||||
/*
|
||||
* The build target may depend on other projects in the workspace. These are
|
||||
* captured in the deps target:
|
||||
* deps:
|
||||
* <cd <Proj_Dep_1/build_dir>; $(MAKE) [clean all | all]>
|
||||
*/
|
||||
List managedProjectOutputs = new ArrayList();
|
||||
buffer.append("deps:" + NEWLINE);
|
||||
if (deps != null) {
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
IProject dep = deps[i];
|
||||
String buildDir = dep.getLocation().toString();
|
||||
if (ManagedBuildManager.manages(dep)) {
|
||||
// Add the current configuration to the makefile path
|
||||
IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(dep);
|
||||
buildDir += SEPARATOR + depInfo.getConfigurationName();
|
||||
|
||||
// Extract the build artifact to add to the dependency list
|
||||
String depTarget = depInfo.getBuildArtifactName();
|
||||
String depExt = (new Path(depTarget)).getFileExtension();
|
||||
String depPrefix = depInfo.getOutputPrefix(depExt);
|
||||
managedProjectOutputs.add(buildDir + SEPARATOR + depPrefix + depTarget);
|
||||
}
|
||||
buffer.append(TAB + "cd" + WHITESPACE + buildDir + SEMI_COLON + WHITESPACE + "$(MAKE) " + targets + NEWLINE);
|
||||
}
|
||||
}
|
||||
buffer.append(NEWLINE);
|
||||
|
||||
|
||||
/*
|
||||
* Write out the target rule as:
|
||||
* <prefix><target>.<extension>: $(OBJS) [<dep_proj_1_output> ... <dep_proj_n_output>]
|
||||
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $^ $(LIB_DEPS)
|
||||
*/
|
||||
//
|
||||
buffer.append(outputPrefix + target + COLON + WHITESPACE + "$(OBJS)");
|
||||
Iterator iter = managedProjectOutputs.listIterator();
|
||||
while (iter.hasNext()) {
|
||||
buffer.append(WHITESPACE + (String)iter.next());
|
||||
}
|
||||
buffer.append(NEWLINE);
|
||||
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + "$@" + WHITESPACE + "$(OBJS) $(LIBS)");
|
||||
buffer.append(NEWLINE + NEWLINE);
|
||||
|
||||
// Always add a clean target
|
||||
buffer.append(".PHONY: clean" + NEWLINE);
|
||||
buffer.append("clean:" + NEWLINE);
|
||||
buffer.append(TAB + "$(RM)" + WHITESPACE + "${addprefix ., $(CC_SRCS:$(ROOT)%.cpp=%.o)} ${addprefix ., $(C_SRCS:$(ROOT)%.c=%.o)}" + WHITESPACE + outputPrefix + target + NEWLINE);
|
||||
buffer.append(NEWLINE);
|
||||
buffer.append(TAB + "$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + outputPrefix + target + NEWLINE + NEWLINE);
|
||||
|
||||
buffer.append(NEWLINE + ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
|
||||
buffer.append(".PHONY: all clean deps" + NEWLINE + NEWLINE);
|
||||
|
||||
buffer.append(ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
|
||||
buffer.append("include ${patsubst %, %/module.dep, $(MODULES)}" + NEWLINE);
|
||||
|
||||
buffer.append(NEWLINE);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.w3c.dom.Node;
|
|||
public class Target extends BuildObject implements ITarget {
|
||||
|
||||
private String artifactName;
|
||||
private String binaryParserId;
|
||||
private String cleanCommand;
|
||||
private Map configMap;
|
||||
private List configurations;
|
||||
|
@ -66,6 +67,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
setId(parent.getId() + ".1");
|
||||
setName(parent.getName());
|
||||
this.artifactName = parent.getArtifactName();
|
||||
this.binaryParserId = parent.getBinaryParserId();
|
||||
this.defaultExtension = parent.getDefaultExtension();
|
||||
this.isTest = parent.isTestTarget();
|
||||
this.cleanCommand = parent.getCleanCommand();
|
||||
|
@ -83,23 +85,26 @@ public class Target extends BuildObject implements ITarget {
|
|||
*/
|
||||
public Target(IConfigurationElement element) {
|
||||
// id
|
||||
setId(element.getAttribute("id"));
|
||||
setId(element.getAttribute(ID));
|
||||
|
||||
// hook me up
|
||||
ManagedBuildManager.addExtensionTarget(this);
|
||||
|
||||
// Get the target name
|
||||
setName(element.getAttribute("name"));
|
||||
setName(element.getAttribute(NAME));
|
||||
|
||||
// Get the name of the build artifact associated with target (usually
|
||||
// in the plugin specification).
|
||||
artifactName = element.getAttribute("artifactName");
|
||||
artifactName = element.getAttribute(ARTIFACT_NAME);
|
||||
|
||||
// Get the ID of the binary parser
|
||||
binaryParserId = element.getAttribute(BINARY_PARSER);
|
||||
|
||||
// Get the default extension
|
||||
defaultExtension = element.getAttribute("defaultExtension");
|
||||
defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
|
||||
|
||||
// parent
|
||||
String parentId = element.getAttribute("parent");
|
||||
String parentId = element.getAttribute(PARENT);
|
||||
if (parentId != null) {
|
||||
parent = ManagedBuildManager.getTarget(null, parentId);
|
||||
// copy over the parents configs
|
||||
|
@ -109,21 +114,21 @@ public class Target extends BuildObject implements ITarget {
|
|||
}
|
||||
|
||||
// isAbstract
|
||||
if ("true".equals(element.getAttribute("isAbstract")))
|
||||
if ("true".equals(element.getAttribute(IS_ABSTRACT)))
|
||||
isAbstract = true;
|
||||
|
||||
// Is this a test target
|
||||
isTest = ("true".equals(element.getAttribute("isTest")));
|
||||
isTest = ("true".equals(element.getAttribute(IS_TEST)));
|
||||
|
||||
// Get the clean command
|
||||
cleanCommand = element.getAttribute("cleanCommand");
|
||||
cleanCommand = element.getAttribute(CLEAN_COMMAND);
|
||||
if (cleanCommand == null) {
|
||||
// See if it defined in the parent
|
||||
cleanCommand = parent.getCleanCommand();
|
||||
}
|
||||
|
||||
// Get the make command
|
||||
makeCommand = element.getAttribute("makeCommand");
|
||||
makeCommand = element.getAttribute(MAKE_COMMAND);
|
||||
if (makeCommand == null) {
|
||||
// See if it defined in the parent
|
||||
makeCommand = parent.getMakeCommand();
|
||||
|
@ -151,38 +156,41 @@ public class Target extends BuildObject implements ITarget {
|
|||
this(buildInfo.getOwner());
|
||||
|
||||
// id
|
||||
setId(element.getAttribute("id"));
|
||||
setId(element.getAttribute(ID));
|
||||
|
||||
// hook me up
|
||||
buildInfo.addTarget(this);
|
||||
|
||||
// name
|
||||
setName(element.getAttribute("name"));
|
||||
setName(element.getAttribute(NAME));
|
||||
|
||||
// Get the name of the build artifact associated with target (should
|
||||
// contain what the user entered in the UI).
|
||||
artifactName = element.getAttribute("artifactName");
|
||||
artifactName = element.getAttribute(ARTIFACT_NAME);
|
||||
|
||||
// Get the ID of the binary parser
|
||||
binaryParserId = element.getAttribute(BINARY_PARSER);
|
||||
|
||||
// Get the default extension
|
||||
defaultExtension = element.getAttribute("defaultExtension");
|
||||
defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
|
||||
|
||||
// parent
|
||||
String parentId = element.getAttribute("parent");
|
||||
String parentId = element.getAttribute(PARENT);
|
||||
if (parentId != null)
|
||||
parent = ManagedBuildManager.getTarget(null, parentId);
|
||||
|
||||
// isAbstract
|
||||
if ("true".equals(element.getAttribute("isAbstract")))
|
||||
if ("true".equals(element.getAttribute(IS_ABSTRACT)))
|
||||
isAbstract = true;
|
||||
|
||||
// Is this a test target
|
||||
isTest = ("true".equals(element.getAttribute("isTest")));
|
||||
isTest = ("true".equals(element.getAttribute(IS_TEST)));
|
||||
|
||||
// Get the clean command
|
||||
cleanCommand = element.getAttribute("cleanCommand");
|
||||
cleanCommand = element.getAttribute(CLEAN_COMMAND);
|
||||
|
||||
// Get the make command
|
||||
makeCommand = element.getAttribute("makeCommand");
|
||||
makeCommand = element.getAttribute(MAKE_COMMAND);
|
||||
|
||||
Node child = element.getFirstChild();
|
||||
while (child != null) {
|
||||
|
@ -200,21 +208,22 @@ public class Target extends BuildObject implements ITarget {
|
|||
* @param element
|
||||
*/
|
||||
public void serialize(Document doc, Element element) {
|
||||
element.setAttribute("id", getId());
|
||||
element.setAttribute("name", getName());
|
||||
element.setAttribute(ID, getId());
|
||||
element.setAttribute(NAME, getName());
|
||||
if (parent != null)
|
||||
element.setAttribute("parent", parent.getId());
|
||||
element.setAttribute("isAbstract", isAbstract ? "true" : "false");
|
||||
element.setAttribute("artifactName", getArtifactName());
|
||||
element.setAttribute("defaultExtension", getDefaultExtension());
|
||||
element.setAttribute("isTest", isTest ? "true" : "false");
|
||||
element.setAttribute("cleanCommand", getCleanCommand());
|
||||
element.setAttribute("makeCommand", getMakeCommand());
|
||||
element.setAttribute(PARENT, parent.getId());
|
||||
element.setAttribute(IS_ABSTRACT, isAbstract ? "true" : "false");
|
||||
element.setAttribute(ARTIFACT_NAME, getArtifactName());
|
||||
element.setAttribute(BINARY_PARSER, getBinaryParserId());
|
||||
element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension());
|
||||
element.setAttribute(IS_TEST, isTest ? "true" : "false");
|
||||
element.setAttribute(CLEAN_COMMAND, getCleanCommand());
|
||||
element.setAttribute(MAKE_COMMAND, getMakeCommand());
|
||||
|
||||
if (configurations != null)
|
||||
for (int i = 0; i < configurations.size(); ++i) {
|
||||
Configuration config = (Configuration)configurations.get(i);
|
||||
Element configElement = doc.createElement("configuration");
|
||||
Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
|
||||
element.appendChild(configElement);
|
||||
config.serialize(doc, configElement);
|
||||
}
|
||||
|
@ -317,6 +326,13 @@ public class Target extends BuildObject implements ITarget {
|
|||
return artifactName == null ? EMPTY_STRING : artifactName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getBinaryParserId()
|
||||
*/
|
||||
public String getBinaryParserId() {
|
||||
return binaryParserId == null ? EMPTY_STRING : binaryParserId;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
|
||||
*/
|
||||
|
@ -368,4 +384,5 @@ public class Target extends BuildObject implements ITarget {
|
|||
artifactName = name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
2003-09-19 Sean Evoy
|
||||
Removed the binary parser selection tab from the new class wizard. Updated the
|
||||
page description externalized string.
|
||||
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
|
||||
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
|
||||
|
||||
Added the hard-coded binary parser info to the defined targets.
|
||||
* plugin.xml
|
||||
|
||||
Fixed the event handling for add/remove in the list widget for build settings pages.
|
||||
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
|
||||
|
||||
2003-09-16 Sean Evoy
|
||||
Changed the initialization and button status logic so the list buttons are
|
||||
enabled correctly on start-up and that the fist item in the list (if
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
isTest="false"
|
||||
cleanCommand="rm -rf"
|
||||
name="Cygwin"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
isAbstract="true"
|
||||
makeCommand="make"
|
||||
id="cygwin">
|
||||
|
@ -307,6 +308,7 @@
|
|||
isTest="false"
|
||||
name="Cygwin Executable"
|
||||
parent="cygwin"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
defaultExtension="exe"
|
||||
isAbstract="false"
|
||||
id="cygwin.exec">
|
||||
|
@ -335,13 +337,6 @@
|
|||
valueType="string"
|
||||
id="cygwin.link.ld.flags">
|
||||
</option>
|
||||
<option
|
||||
name="Library Paths"
|
||||
category="cygwin.linker.category.general"
|
||||
command="-L"
|
||||
valueType="stringList"
|
||||
id="cygwin.link.ld.paths">
|
||||
</option>
|
||||
<option
|
||||
name="Libraries"
|
||||
category="cygwin.linker.category.general"
|
||||
|
@ -349,12 +344,20 @@
|
|||
valueType="libs"
|
||||
id="cygwin.link.libs">
|
||||
</option>
|
||||
<option
|
||||
name="Library Paths"
|
||||
category="cygwin.linker.category.general"
|
||||
command="-L"
|
||||
valueType="stringList"
|
||||
id="cygwin.link.ld.paths">
|
||||
</option>
|
||||
</tool>
|
||||
</target>
|
||||
<target
|
||||
isTest="false"
|
||||
name="Cygwin Shared Library"
|
||||
parent="cygwin"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
defaultExtension="dll"
|
||||
isAbstract="false"
|
||||
id="cygwin.so">
|
||||
|
@ -405,6 +408,7 @@
|
|||
isTest="true"
|
||||
name="Cygwin Export Library (DLL)"
|
||||
parent="cygwin"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
defaultExtension="dll.a"
|
||||
isAbstract="false"
|
||||
id="cygwin.exp">
|
||||
|
@ -455,6 +459,7 @@
|
|||
isTest="false"
|
||||
name="Cygwin Static Library"
|
||||
parent="cygwin"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
defaultExtension="a"
|
||||
isAbstract="false"
|
||||
id="cygwin.lib">
|
||||
|
@ -491,6 +496,7 @@
|
|||
isTest="false"
|
||||
cleanCommand="rm -rf"
|
||||
name="Linux"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
isAbstract="true"
|
||||
makeCommand="make"
|
||||
id="linux.gnu">
|
||||
|
@ -781,6 +787,7 @@
|
|||
isTest="false"
|
||||
name="Linux Executable"
|
||||
parent="linux.gnu"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
isAbstract="false"
|
||||
id="linux.gnu.exec">
|
||||
<configuration
|
||||
|
@ -874,6 +881,7 @@
|
|||
isTest="false"
|
||||
name="Linux Shared Library"
|
||||
parent="linux.gnu"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
defaultExtension="so"
|
||||
isAbstract="false"
|
||||
id="linux.gnu.so">
|
||||
|
@ -978,6 +986,7 @@
|
|||
isTest="false"
|
||||
name="Linux Static Library"
|
||||
parent="linux.gnu"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
defaultExtension="a"
|
||||
isAbstract="false"
|
||||
id="linux.gnu.lib">
|
||||
|
@ -1015,6 +1024,7 @@
|
|||
isTest="false"
|
||||
cleanCommand="rm -rf"
|
||||
name="Solaris"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
isAbstract="true"
|
||||
makeCommand="make"
|
||||
id="solaris.gnu">
|
||||
|
@ -1297,6 +1307,7 @@
|
|||
isTest="false"
|
||||
name="Solaris Executable"
|
||||
parent="solaris.gnu"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
isAbstract="false"
|
||||
id="solaris.gnu.exec">
|
||||
<configuration
|
||||
|
@ -1390,6 +1401,7 @@
|
|||
isTest="false"
|
||||
name="Solaris Shared Library"
|
||||
parent="solaris.gnu"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
defaultExtension="so"
|
||||
isAbstract="false"
|
||||
id="solaris.gnu.so">
|
||||
|
@ -1494,6 +1506,7 @@
|
|||
isTest="false"
|
||||
name="Solaris Static Library"
|
||||
parent="solaris.gnu"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
defaultExtension="a"
|
||||
isAbstract="false"
|
||||
id="solaris.gnu.lib">
|
||||
|
|
|
@ -33,7 +33,7 @@ PlatformBlock.label.configs=Configurations:
|
|||
|
||||
# -- Strings for the additional options tab
|
||||
MngMakeProjectWizard.options.title=Additional Project Settings
|
||||
MngMakeProjectWizard.options.desc=Defined the binary parser and inter-project dependencies, if any.
|
||||
MngMakeProjectWizard.options.desc=Defined the inter-project dependencies, if any.
|
||||
|
||||
# ----------- Configuration Selection Page -----------
|
||||
BuildPropertyPage.label.Platform=Platform:
|
||||
|
|
|
@ -98,6 +98,7 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
list.add(input, 0);
|
||||
list.setSelection(0);
|
||||
}
|
||||
selectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,6 +375,7 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
int index = list.getSelectionIndex();
|
||||
if (index >= 0) {
|
||||
list.remove(index);
|
||||
list.setSelection(index - 1);
|
||||
selectionChanged();
|
||||
}
|
||||
}
|
||||
|
@ -387,7 +389,7 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
int size = list.getItemCount();
|
||||
|
||||
// Enable the remove button if there is at least one item in the list
|
||||
removeButton.setEnabled(index >= 0);
|
||||
removeButton.setEnabled(size > 0);
|
||||
// Enable the up button IFF there is more than 1 item and selection index is not first item
|
||||
upButton.setEnabled(size > 1 && index > 0);
|
||||
// Enable the down button IFF there is more than 1 item and selection index not last item
|
||||
|
|
|
@ -11,9 +11,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
|||
* IBM Rational Software - Initial API and implementation
|
||||
* **********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
|
||||
import org.eclipse.cdt.ui.dialogs.BinaryParserBlock;
|
||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||
import org.eclipse.cdt.ui.dialogs.ReferenceBlock;
|
||||
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||
|
@ -31,7 +29,6 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
|
|||
|
||||
protected void addTabs() {
|
||||
addTab(new ReferenceBlock());
|
||||
addTab(new BinaryParserBlock(ManagedBuilderCorePlugin.getDefault().getPluginPreferences()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,9 +103,10 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
|||
}
|
||||
|
||||
// Add the target to the project
|
||||
ITarget newTarget = null;
|
||||
try {
|
||||
ITarget parent = targetConfigurationPage.getSelectedTarget();
|
||||
ITarget newTarget = ManagedBuildManager.createTarget(newProject, parent);
|
||||
newTarget = ManagedBuildManager.createTarget(newProject, parent);
|
||||
if (newTarget != null) {
|
||||
// TODO add name entry field to project
|
||||
String artifactName = newProject.getName();
|
||||
|
@ -131,6 +132,10 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
|||
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(newProject);
|
||||
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
|
||||
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
|
||||
|
||||
desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
// org.eclipse.cdt.core.ELF or "org.eclipse.cdt.core.PE"
|
||||
desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, newTarget.getBinaryParserId());
|
||||
} catch (CoreException e) {
|
||||
// TODO Flag the error to the user
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-09-19 Sean Evoy
|
||||
Updated the build test to check the binary parser specification in the
|
||||
target specification.
|
||||
* build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
|
||||
|
||||
2003-09-18 Andrew Niefer
|
||||
- removed testConditionalExpression_Bug43159 from FailedCompleteParseASTExpressionTest
|
||||
and uncommented it (testConditionalExpression) in CompleteParseASTExpressionTest
|
||||
|
|
|
@ -533,10 +533,12 @@ public class ManagedBuildTests extends TestCase {
|
|||
// Target stuff
|
||||
String expectedCleanCmd = "del /myworld";
|
||||
String expectedMakeCommand = "make";
|
||||
String expectedParserId = "org.eclipse.cdt.core.PE";
|
||||
assertTrue(target.isTestTarget());
|
||||
assertEquals(target.getDefaultExtension(), rootExt);
|
||||
assertEquals(expectedCleanCmd, target.getCleanCommand());
|
||||
assertEquals(expectedMakeCommand, target.getMakeCommand());
|
||||
assertEquals(expectedParserId, target.getBinaryParserId());
|
||||
|
||||
// Tools
|
||||
ITool[] tools = target.getTools();
|
||||
|
@ -643,14 +645,14 @@ public class ManagedBuildTests extends TestCase {
|
|||
assertEquals("doIt", tools[0].getToolCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* @param testSubSub
|
||||
*/
|
||||
private void checkSubSubTarget(ITarget target) {
|
||||
// Check the inherited clean command
|
||||
assertEquals("rm -yourworld", target.getCleanCommand());
|
||||
assertEquals("nmake", target.getMakeCommand());
|
||||
|
||||
assertEquals("org.eclipse.cdt.core.ELF", target.getBinaryParserId());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -664,6 +666,7 @@ public class ManagedBuildTests extends TestCase {
|
|||
// Check the overridden clan command
|
||||
assertEquals("rm -yourworld", target.getCleanCommand());
|
||||
assertEquals("gmake", target.getMakeCommand());
|
||||
assertEquals("org.eclipse.cdt.core.PE", target.getBinaryParserId());
|
||||
|
||||
// Make sure this is a test target
|
||||
assertTrue(target.isTestTarget());
|
||||
|
|
|
@ -29,14 +29,15 @@
|
|||
name="Tools for Build Test"
|
||||
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
|
||||
<target
|
||||
makeFlags="-k"
|
||||
isTest="true"
|
||||
cleanCommand="del /myworld"
|
||||
name="Test Root"
|
||||
id="test.root"
|
||||
cleanCommand="del /myworld"
|
||||
isTest="true"
|
||||
defaultExtension="toor"
|
||||
isAbstract="false"
|
||||
makeCommand="make"
|
||||
id="test.root">
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
makeFlags="-k">
|
||||
<tool
|
||||
sources="foo,bar"
|
||||
name="Root Tool"
|
||||
|
@ -126,6 +127,7 @@
|
|||
defaultExtension="bus"
|
||||
isAbstract="false"
|
||||
makeCommand="gmake"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
makeFlags="-d"
|
||||
parent="test.root">
|
||||
<configuration
|
||||
|
@ -180,6 +182,7 @@
|
|||
isTest="true"
|
||||
name="Test Sub Sub"
|
||||
parent="test.sub"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
defaultExtension="tss"
|
||||
makeCommand="nmake"
|
||||
id="test.sub.sub">
|
||||
|
|
Loading…
Add table
Reference in a new issue