[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
AW: [cdt-patch] Patches for Bugzilla 88150 -settingmultiplebinaryparsers in project type
|
Hello Leo and all,
here is a re-play of the patches to CDT 2.1.1 which
eliminate the "entire file problem", and at the same time pick up your other
suggestions (keeping methods, semicolon-separated lists).
Norbert
Hi
Norbert,
There is no documented
guideline that I am aware of. I have been using comma-separated for simple
strings such as file-extensions, os-names, and semi-colons for ids and
paths.
I just looked at your
2.1.1 patches and there is something wrong with them. They appear to
contain entire files. That may have been because of line-ending
differences between the two file versions being compared. You’ll have to
resubmit the 2.1.1 patches.
Regards,
Leo
From:
cdt-patch-bounces@xxxxxxxxxxx [mailto:cdt-patch-bounces@xxxxxxxxxxx] On Behalf Of Ploett Norbert Sent: Monday, April 18, 2005 7:38
AM To: CDT patches and commits
are posted to this list. Subject: AW: [cdt-patch] Patches for
Bugzilla 88150 - settingmultiplebinaryparsers in project
type
Leo,
I don't care about
commas or semicolons and accept your changes.
I was just surprised
because I had looked at the source code in TargetPlatform, immediately before my
changes. The architectures and OS lists are comma-separated. I was also aware
that there are other lists which are semicolon-separated.
Is there a documented
guideline on this?
Regards,
Norbert
Von:
cdt-patch-bounces@xxxxxxxxxxx [mailto:cdt-patch-bounces@xxxxxxxxxxx] Im Auftrag von Treggiari, Leo Gesendet: Montag, 18. April 2005
06:21 An: CDT patches and
commits are posted to this list. Betreff: RE: [cdt-patch] Patches for
Bugzilla 88150 - setting multiplebinaryparsers in project type
Applied to Head with
the following changes:
- Change the list from
comma-separated to semi-colon-separated. All other ID lists are
semi-colon separated.
- Kept the
{get|set}BinaryParserId methods and marked them as deprecated
I will apply the same
changes to 2.1.1 in the next few days.
Thanks,
Leo
From:
cdt-patch-bounces@xxxxxxxxxxx [mailto:cdt-patch-bounces@xxxxxxxxxxx] On Behalf Of Ploett Norbert Sent: Tuesday, April 12, 2005 8:01
AM To:
cdt-patch@xxxxxxxxxxx Subject:
[cdt-patch] Patches for Bugzilla 88150 - setting multiple binaryparsers in
project type
im am suggesting a set of patches to
the managed build system for versions 3.0.0 (M6 candidate from yesterday) and
2.1.1.
The patch aims to allow setting
multiple binary parsers in a project type as a comma-separated list, analogous
to the list of operating systems for target platform.
|
Index: D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.ui/src-mgdbuildui/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
===================================================================
--- D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.ui/src-mgdbuildui/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java (revision 54)
+++ D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.ui/src-mgdbuildui/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java (working copy)
@@ -160,7 +160,11 @@
if (newConfigs.length > 0) {
IToolChain tc = newConfigs[0].getToolChain();
ITargetPlatform targetPlatform = tc.getTargetPlatform();
- desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, targetPlatform.getBinaryParserId());
+ String[] binaryParsers = targetPlatform.getBinaryParserList();
+ // Create binary parser entries for all pre-selected binary parsers (semicolon-separated list).
+ for (int i=0; i<binaryParsers.length; i++) {
+ desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, binaryParsers[i]);
+ }
}
} catch (CoreException e) {
ManagedBuilderUIPlugin.log(e);
Index: D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core/src-mngbuildcore/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java
===================================================================
--- D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core/src-mngbuildcore/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java (revision 54)
+++ D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core/src-mngbuildcore/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java (working copy)
@@ -105,6 +105,20 @@
public void setBinaryParserId(String id);
/**
+ * Returns the unique IDs of the binary parsers associated with the target platform.
+ *
+ * @return String
+ */
+ public String[] getBinaryParserList();
+
+ /**
+ * Sets the string ids of the binary parsers for this target platform.
+ *
+ * @param id
+ */
+ public void setBinaryParserList(String[] ids);
+
+ /**
* Returns <code>true</code> if this element has changes that need to
* be saved in the project file, else <code>false</code>.
*
Index: D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core/src-mngbuildcore/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
===================================================================
--- D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core/src-mngbuildcore/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java (revision 54)
+++ D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core/src-mngbuildcore/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java (working copy)
@@ -38,7 +38,7 @@
private Boolean isAbstract;
private List osList;
private List archList;
- private String binaryParserId;
+ private List binaryParserList;
// Miscellaneous
private boolean isExtensionTargetPlatform = false;
private boolean isDirty = false;
@@ -146,8 +146,8 @@
if (targetPlatform.archList != null) {
archList = new ArrayList(targetPlatform.archList);
}
- if (targetPlatform.binaryParserId != null) {
- binaryParserId = new String(targetPlatform.binaryParserId);
+ if (targetPlatform.binaryParserList != null) {
+ binaryParserList = new ArrayList(targetPlatform.binaryParserList); // A shallow copy is O.K. since String is immutable.
}
setDirty(true);
@@ -204,8 +204,15 @@
}
}
- // Get the ID of the binary parser
- binaryParserId = element.getAttribute(BINARY_PARSER);
+ // Get the ID of the binary parser from a semicolon-separated list.
+ String bpars = element.getAttribute(BINARY_PARSER);
+ if (bpars!=null) {
+ binaryParserList = new ArrayList();
+ String[] bparsTokens = bpars.split(";"); //$NON-NLS-1$
+ for (int j = 0; j < bparsTokens.length; ++j) {
+ binaryParserList.add(bparsTokens[j].trim());
+ }
+ }
}
/* (non-Javadoc)
@@ -270,9 +277,17 @@
}
}
- // binaryParserId
+ // Get the semicolon-separated list of binaryParserIds
if (element.hasAttribute(BINARY_PARSER)) {
- binaryParserId = element.getAttribute(BINARY_PARSER);
+ // Get binary parser Ids from a semicolon-separated list.
+ String bpars = element.getAttribute(BINARY_PARSER);
+ if (bpars != null) {
+ binaryParserList = new ArrayList();
+ String[] bparsTokens = bpars.split(";"); //$NON-NLS-1$
+ for (int j = 0; j < bparsTokens.length; ++j) {
+ binaryParserList.add(bparsTokens[j].trim());
+ }
+ }
}
}
@@ -301,8 +316,18 @@
element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
}
- if (binaryParserId != null) {
- element.setAttribute(BINARY_PARSER, binaryParserId);
+ if (binaryParserList != null) {
+ // Create semicolon-separated list from array ids
+ Iterator bparsIter = binaryParserList.listIterator();
+ String listValue = EMPTY_STRING;
+ while (bparsIter.hasNext()) {
+ String current = (String) bparsIter.next();
+ listValue += current;
+ if ((bparsIter.hasNext())) {
+ listValue += ";"; //$NON-NLS-1$
+ }
+ }
+ element.setAttribute(BINARY_PARSER, listValue);
}
if (osList != null) {
@@ -389,15 +414,25 @@
* @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserI()
*/
public String getBinaryParserId() {
- if (binaryParserId == null) {
+ if ((null==binaryParserList)||(0==binaryParserList.size())) {
+ return EMPTY_STRING ;
+ }
+ return (String) binaryParserList.get(0) ;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserI()
+ */
+ public String[] getBinaryParserList() {
+ if (binaryParserList == null) {
// If I have a superClass, ask it
if (superClass != null) {
- return superClass.getBinaryParserId();
+ return superClass.getBinaryParserList();
} else {
- return EMPTY_STRING;
+ return new String[0];
}
}
- return binaryParserId;
+ return (String[]) binaryParserList.toArray(new String[binaryParserList.size()]);
}
/* (non-Javadoc)
@@ -436,11 +471,22 @@
* @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserId(String)
*/
public void setBinaryParserId(String id) {
- if (id == null && binaryParserId == null) return;
- if (binaryParserId == null || id == null || !id.equals(binaryParserId)) {
- binaryParserId = id;
- setDirty(true);
+ setBinaryParserList(new String[]{id});
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserId(String)
+ */
+ public void setBinaryParserList(String[] ids) {
+ if (binaryParserList == null) {
+ binaryParserList = new ArrayList();
+ } else {
+ binaryParserList.clear();
}
+ for (int i = 0; i < ids.length; i++) {
+ binaryParserList.add(ids[i]);
+ }
+ setDirty(true);
}
/* (non-Javadoc)
Index: D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
===================================================================
--- D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java (revision 54)
+++ D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java (working copy)
@@ -75,7 +75,8 @@
String expectedOSList = "solaris,linux,hpux,aix,qnx";
int expectedSizeOSList = 5;
String[] expectedArchList = {"all"};
- String expectedBinaryParser = "org.eclipse.cdt.core.ELF";
+ String expectedBinaryParserELF = "org.eclipse.cdt.core.ELF";
+ String expectedBinaryParserPE = "org.eclipse.cdt.core.PE";
String[] expectedPlatformName = {"Dbg Platform",
"Rel Platform"};
String expectedCommand = "make";
@@ -147,7 +148,11 @@
}
assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
- assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
+ // Target platform may have several binary parsers.
+ String[] binaryParsers = platform.getBinaryParserList();
+ assertEquals(binaryParsers.length, 2);
+ assertEquals(binaryParsers[0], expectedBinaryParserELF);
+ assertEquals(binaryParsers[1], expectedBinaryParserPE);
assertEquals(platform.getName(), expectedPlatformName[iconfig]);
// Fetch and check builder
@@ -342,7 +347,10 @@
ITargetPlatform platform = toolChain.getTargetPlatform();
assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
- assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
+ // Make the test work as before after introducing multiple binary parsers
+ String[] binaryParsers = platform.getBinaryParserList();
+ assertEquals(binaryParsers.length, 1);
+ assertEquals(binaryParsers[0], expectedBinaryParser);
assertEquals(platform.getName(), expectedPlatformName[iconfig]);
// Fetch and check builder
@@ -542,7 +550,10 @@
ITargetPlatform platform = toolChain.getTargetPlatform();
assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
- assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
+ // Make the test work as before after introducing multiple binary parsers
+ String[] binaryParsers = platform.getBinaryParserList();
+ assertEquals(binaryParsers.length, 1);
+ assertEquals(binaryParsers[0], expectedBinaryParser);
assertEquals(platform.getName(), expectedPlatformName[iconfig]);
// Fetch and check builder
Index: D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
===================================================================
--- D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml (revision 54)
+++ D:/Projekt/RTP/Work/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml (working copy)
@@ -1219,7 +1219,7 @@
<targetPlatform
id="cdt.managedbuild.target.testgnu.platform.exe.debug"
name="Dbg Platform"
- binaryParser="org.eclipse.cdt.core.ELF"
+ binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE"
osList="solaris,linux,hpux,aix,qnx"
archList="all">
</targetPlatform>
@@ -1286,7 +1286,7 @@
<targetPlatform
id="cdt.managedbuild.target.testgnu.platform.exe.release"
name="Rel Platform"
- binaryParser="org.eclipse.cdt.core.ELF"
+ binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE"
osList="solaris,linux,hpux,aix,qnx"
archList="all">
</targetPlatform>