[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Bug fix for 41720, UI behaviour fix, and new project wizard mods
|
Details are in the change log. 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.
Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.103
diff -u -r1.103 ChangeLog
--- ChangeLog 19 Sep 2003 16:00:44 -0000 1.103
+++ ChangeLog 19 Sep 2003 18:19:49 -0000
@@ -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
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/plugin.xml,v
retrieving revision 1.9
diff -u -r1.9 plugin.xml
--- plugin.xml 17 Sep 2003 03:07:51 -0000 1.9
+++ plugin.xml 19 Sep 2003 18:19:49 -0000
@@ -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">
Index: build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java,v
retrieving revision 1.5
diff -u -r1.5 ManagedBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java 16 Sep 2003 21:27:50 -0000 1.5
+++ build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java 19 Sep 2003 18:19:49 -0000
@@ -533,10 +533,12 @@
// 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 @@
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 @@
// 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());
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/ChangeLog,v
retrieving revision 1.2
diff -u -r1.2 ChangeLog
--- ChangeLog 16 Sep 2003 21:27:58 -0000 1.2
+++ ChangeLog 19 Sep 2003 18:20:01 -0000
@@ -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
Index: schema/ManagedBuildTools.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd,v
retrieving revision 1.1
diff -u -r1.1 ManagedBuildTools.exsd
--- schema/ManagedBuildTools.exsd 15 Sep 2003 20:44:24 -0000 1.1
+++ schema/ManagedBuildTools.exsd 19 Sep 2003 18:20:01 -0000
@@ -142,8 +142,8 @@
<attribute name="valueType" use="default" value="string">
<annotation>
<documentation>
- General options can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
-
+ General options can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
+
Two additional types exist to flag options of special relevance to the build model; 'include', and 'definedSymbols'. You can pre-populate with optionValues, and they will display in the UI the same way the 'StringList' options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines.
</documentation>
</annotation>
@@ -387,6 +387,13 @@
</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>
@@ -459,48 +466,48 @@
<meta.section type="examples"/>
</appInfo>
<documentation>
- The following is an example of the extension point usage:
-<p>
-<pre>
- <extension
- id="buildExample"
- name="Tools for Build Example"
- point="org.eclipse.cdt.core.ManagedBuildInfo">
- <target
- makeFlags="-k"
- isTest="false"
- cleanCommand="rm -rf"
- name="Executable"
- defaultExtension=".exe"
- isAbstract="false"
- makeCommand="make"
- id="example.target.executable">
- <tool
- sources="C"
- name="Compiler"
- outputFlag="-o"
- outputs="exe"
- command="g++"
- id="executable.compiler">
- <optionCategory
- owner="executable.compiler"
- name="Flags"
- id="compiler.category.flags">
- </optionCategory>
- <option
- defaultValue="-c"
- name="Compiler Flags"
- category="compiler.category.flags"
- valueType="string"
- id="category.flags.comp_flags">
- </option>
- </tool>
- <configuration
- name="Default"
- id="example.config.default">
- </configuration>
- </target>
- </extension>
+ The following is an example of the extension point usage:
+<p>
+<pre>
+ <extension
+ id="buildExample"
+ name="Tools for Build Example"
+ point="org.eclipse.cdt.core.ManagedBuildInfo">
+ <target
+ makeFlags="-k"
+ isTest="false"
+ cleanCommand="rm -rf"
+ name="Executable"
+ defaultExtension=".exe"
+ isAbstract="false"
+ makeCommand="make"
+ id="example.target.executable">
+ <tool
+ sources="C"
+ name="Compiler"
+ outputFlag="-o"
+ outputs="exe"
+ command="g++"
+ id="executable.compiler">
+ <optionCategory
+ owner="executable.compiler"
+ name="Flags"
+ id="compiler.category.flags">
+ </optionCategory>
+ <option
+ defaultValue="-c"
+ name="Compiler Flags"
+ category="compiler.category.flags"
+ valueType="string"
+ id="category.flags.comp_flags">
+ </option>
+ </tool>
+ <configuration
+ name="Default"
+ id="example.config.default">
+ </configuration>
+ </target>
+ </extension>
</pre>
</documentation>
</annotation>
@@ -528,7 +535,7 @@
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2003 IBM Corporation and others.
+ Copyright (c) 2003 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 on the <a href="http://www.eclipse.org/legal/cpl-v10.html"> Eclipse</a> website.
</documentation>
</annotation>
Index: src/org/eclipse/cdt/managedbuilder/core/ITarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java,v
retrieving revision 1.1
diff -u -r1.1 ITarget.java
--- src/org/eclipse/cdt/managedbuilder/core/ITarget.java 15 Sep 2003 20:44:24 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/core/ITarget.java 19 Sep 2003 18:20:01 -0000
@@ -18,7 +18,15 @@
*/
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
@@ -46,6 +54,13 @@
* @return
*/
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
Index: src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java,v
retrieving revision 1.2
diff -u -r1.2 GeneratedMakefileBuilder.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java 16 Sep 2003 21:27:58 -0000 1.2
+++ src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java 19 Sep 2003 18:20:01 -0000
@@ -18,19 +18,17 @@
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 @@
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 @@
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 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;
}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java,v
retrieving revision 1.2
diff -u -r1.2 MakefileGenerator.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java 16 Sep 2003 21:27:58 -0000 1.2
+++ src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java 19 Sep 2003 18:20:02 -0000
@@ -80,6 +80,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
// 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 @@
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();
+ } 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 ....
+ }
+
+ // Write out the all target first in case someone just runs make
+ buffer.append("all: deps" + WHITESPACE + outputPrefix + target + NEWLINE);
+ buffer.append(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);
}
- } 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(NEWLINE);
- 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);
+ /*
+ * 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(NEWLINE);
+ buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + "$@" + WHITESPACE + "$(OBJS) $(LIBS)");
+ buffer.append(NEWLINE + NEWLINE);
- // We only have one target, 'all'
- buffer.append("all: " + outputPrefix + target + NEWLINE);
- buffer.append(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("include ${patsubst %, %/module.dep, $(MODULES)}" + NEWLINE);
+ buffer.append(".PHONY: all clean deps" + NEWLINE + NEWLINE);
- buffer.append(NEWLINE);
+ buffer.append(ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
+ buffer.append("include ${patsubst %, %/module.dep, $(MODULES)}" + NEWLINE);
return buffer;
}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java,v
retrieving revision 1.1
diff -u -r1.1 Target.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Target.java 15 Sep 2003 20:44:24 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Target.java 19 Sep 2003 18:20:02 -0000
@@ -32,6 +32,7 @@
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 @@
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 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 @@
}
// 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 @@
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 @@
* @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);
}
@@ -318,6 +327,13 @@
}
/* (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()
*/
public IConfiguration getConfiguration(String id) {
@@ -367,5 +383,6 @@
public void setBuildArtifact(String name) {
artifactName = name;
}
+
}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/ChangeLog,v
retrieving revision 1.2
diff -u -r1.2 ChangeLog
--- ChangeLog 16 Sep 2003 21:27:54 -0000 1.2
+++ ChangeLog 19 Sep 2003 18:20:13 -0000
@@ -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
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/plugin.xml,v
retrieving revision 1.3
diff -u -r1.3 plugin.xml
--- plugin.xml 16 Sep 2003 19:23:37 -0000 1.3
+++ plugin.xml 19 Sep 2003 18:20:13 -0000
@@ -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">
@@ -336,25 +338,26 @@
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"
command="-l"
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">
Index: src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties,v
retrieving revision 1.1
diff -u -r1.1 PluginResources.properties
--- src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties 15 Sep 2003 20:44:43 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties 19 Sep 2003 18:20:13 -0000
@@ -33,7 +33,7 @@
# -- 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:
Index: src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java,v
retrieving revision 1.2
diff -u -r1.2 BuildOptionListFieldEditor.java
--- src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java 16 Sep 2003 21:27:54 -0000 1.2
+++ src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java 19 Sep 2003 18:20:13 -0000
@@ -98,6 +98,7 @@
list.add(input, 0);
list.setSelection(0);
}
+ selectionChanged();
}
}
@@ -374,6 +375,7 @@
int index = list.getSelectionIndex();
if (index >= 0) {
list.remove(index);
+ list.setSelection(index - 1);
selectionChanged();
}
}
@@ -387,7 +389,7 @@
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
Index: src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java,v
retrieving revision 1.1
diff -u -r1.1 NewManagedProjectOptionPage.java
--- src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java 15 Sep 2003 20:44:43 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java 19 Sep 2003 18:20:13 -0000
@@ -11,9 +11,7 @@
* 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 @@
protected void addTabs() {
addTab(new ReferenceBlock());
- addTab(new BinaryParserBlock(ManagedBuilderCorePlugin.getDefault().getPluginPreferences()));
}
}
Index: src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java,v
retrieving revision 1.1
diff -u -r1.1 NewManagedProjectWizard.java
--- src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java 15 Sep 2003 20:44:43 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java 19 Sep 2003 18:20:14 -0000
@@ -103,9 +103,10 @@
}
// 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 @@
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
}