Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Addition of archList attribute to target object in Managed Builder manifest

Hi,

There are patches for org.eclipse.cdt.managedbuilder.core,
org.eclipse.cdt.managedbuilder.core.tests, and
org.eclipse.cdt.managedbuilder.ui.

The ISV documentation for the new feature is:

The archList attribute of the target object specifies the list of
architectures that the target is supported on.  The valid list of
architectures is the string values returned by BootLoader.getOSArch().
If the archList attribute is not specified, or if the value is "all",
then the target is supported on all architectures.  Otherwise, the
target is only displayed when CDT is running on one of the specified
architectures, unless the user has requested to see all targets.

Thanks,
Leo

========================================================================
=============================================

Index: schema/ManagedBuildTools.exsd
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools
.exsd,v
retrieving revision 1.13
diff -u -r1.13 ManagedBuildTools.exsd
--- schema/ManagedBuildTools.exsd	4 May 2004 15:06:51 -0000
1.13
+++ schema/ManagedBuildTools.exsd	7 May 2004 18:39:29 -0000
@@ -486,6 +486,13 @@
                </documentation>
             </annotation>
          </attribute>
+          <attribute name="archList" type="string">
+            <annotation>
+               <documentation>
+                  This field is used by the managed build system to
decide when to show the user the target. The value should be a
comma-separated list. Current values include &quot;x86&quot;,
&quot;sparc&quot;, &quot;ppc&quot; or &quot;all&quot;.
+               </documentation>
+            </annotation>
+         </attribute>
          <attribute name="errorParsers" type="string">
             <annotation>
                <documentation>
Index: src/org/eclipse/cdt/managedbuilder/core/ITarget.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/mana
gedbuilder/core/ITarget.java,v
retrieving revision 1.9
diff -u -r1.9 ITarget.java
--- src/org/eclipse/cdt/managedbuilder/core/ITarget.java	22 Apr
2004 18:04:54 -0000	1.9
+++ src/org/eclipse/cdt/managedbuilder/core/ITarget.java	7 May
2004 18:39:29 -0000
@@ -29,6 +29,7 @@
 	public static final String MAKE_COMMAND = "makeCommand";
//$NON-NLS-1$
 	public static final String MAKE_ARGS = "makeArguments";
//$NON-NLS-1$
 	public static final String OS_LIST = "osList";	//$NON-NLS-1$
+	public static final String ARCH_LIST = "archList";
//$NON-NLS-1$
 	public static final String PARENT = "parent";	//$NON-NLS-1$
 	
 	/**
@@ -160,6 +161,13 @@
 	 * @return String[]
 	 */
 	public String[] getTargetOSList();
+	
+	/**
+	 * Answers an array of architectures the target can be created
on.
+	 * 
+	 * @return String[]
+	 */
+	public String[] getTargetArchList();
 
 	/**
 	 * Returns the list of platform specific tools associated with
this
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/mana
gedbuilder/internal/core/Target.java,v
retrieving revision 1.18
diff -u -r1.18 Target.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
4 May 2004 19:51:49 -0000	1.18
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
7 May 2004 18:39:29 -0000
@@ -51,6 +51,7 @@
 	private IResource owner;
 	private ITarget parent;
 	private List targetOSList;
+	private List targetArchList;
 	private Map toolMap;
 	private List toolList;
 	private List toolReferences;
@@ -158,6 +159,16 @@
 
targetOSList.add(tokens.nextToken().trim());
 			}
 		}
+
+		// Get the comma-separated list of valid Architectures
+		String arch = element.getAttribute(ARCH_LIST);
+		if (arch != null) {
+			targetArchList = new ArrayList();
+			StringTokenizer tokens = new
StringTokenizer(arch, ","); //$NON-NLS-1$
+			while (tokens.hasMoreTokens()) {
+
targetArchList.add(tokens.nextToken().trim());
+			}
+		}
 		
 		// Load any tool references we might have
 		IManagedConfigElement[] toolRefs =
element.getChildren(IConfiguration.TOOLREF_ELEMENT_NAME);
@@ -464,6 +475,22 @@
 			}
 		}
 		return (String[]) targetOSList.toArray(new
String[targetOSList.size()]);
+	}
+	
+	/* (non-Javadoc)
+	 * @see
org.eclipse.cdt.managedbuilder.core.ITarget#getTargetArchList()
+	 */
+	public String[] getTargetArchList() {
+		if (targetArchList == null) {
+			// Ask parent for its list
+			if (parent != null) {
+				return parent.getTargetArchList();
+			} else {
+				// I have no parent and no defined list
+				return new String[] {"all"};
//$NON-NLS-1$
+			}
+		}
+		return (String[]) targetArchList.toArray(new
String[targetArchList.size()]);
 	}
 
 	/* (non-Javadoc)

Index:
src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/manage
dbuilder/ui/wizards/CProjectPlatformPage.java,v
retrieving revision 1.6
diff -u -r1.6 CProjectPlatformPage.java
---
src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
4 May 2004 15:06:54 -0000	1.6
+++
src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
7 May 2004 18:26:27 -0000
@@ -291,6 +291,7 @@
 		ITarget[] allTargets =
ManagedBuildManager.getDefinedTargets(null);
 		targets = new ArrayList();
 		String os = BootLoader.getOS();
+		String arch = BootLoader.getOSArch();
 		// Add all of the concrete targets to the target list
 		for (int index = 0; index < allTargets.length; ++index)
{
 			ITarget target = allTargets[index];
@@ -299,9 +300,13 @@
 				if (showAll != null &&
showAll.getSelection() == true) {
 					targets.add(target);
 				} else {
+					// Apply the OS and ARCH filters
to determine if the target should be shown
 					List targetOSList =
Arrays.asList(target.getTargetOSList());
 					if (targetOSList.contains("all")
|| targetOSList.contains(os)) {	//$NON-NLS-1$
-						targets.add(target);
+						List targetArchList =
Arrays.asList(target.getTargetArchList());
+						if
(targetArchList.contains("all") || targetArchList.contains(arch)) {
//$NON-NLS-1$
+
targets.add(target);
+						}
 					}
 				}
 			}

Index: plugin.xml
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml,v
retrieving revision 1.2
diff -u -r1.2 plugin.xml
--- plugin.xml	4 May 2004 15:06:46 -0000	1.2
+++ plugin.xml	7 May 2004 18:26:01 -0000
@@ -210,7 +210,8 @@
             binaryParser="org.eclipse.cdt.core.PE"
             makeArguments="-d"
             parent="test.root"
-            osList="win32,linux,solaris">
+            osList="win32,linux,solaris"
+            archList="x86,ppc">
          <configuration
                name="Sub Config"
                id="sub.config">
Index:
tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/
cdt/managedbuild/core/tests/ManagedBuildCoreTests.java,v
retrieving revision 1.2
diff -u -r1.2 ManagedBuildCoreTests.java
---
tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
4 May 2004 15:06:46 -0000	1.2
+++
tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
7 May 2004 18:26:03 -0000
@@ -794,6 +794,7 @@
 		String expectedCleanCmd = "del /myworld";
 		String expectedParserId = "org.eclipse.cdt.core.PE";
 		String[] expectedOSList = {"win32"};
+		String[] expectedArchList = {"all"};
 		assertTrue(target.isTestTarget());
 		if (target.getArtifactName().equals("ManagedBuildTest"))
{
 			assertEquals(target.getArtifactExtension(),
newExt);
@@ -804,6 +805,7 @@
 		assertEquals("make", target.getMakeCommand());
 		assertEquals(expectedParserId,
target.getBinaryParserId());
 		assertTrue(Arrays.equals(expectedOSList,
target.getTargetOSList()));
+		assertTrue(Arrays.equals(expectedArchList,
target.getTargetArchList()));
 		// This target defines no errors parsers.
 		assertNull(target.getErrorParserIds());
 		assertTrue(Arrays.equals(target.getErrorParserList(),
CCorePlugin.getDefault().getAllErrorParsersIDs()));
@@ -1016,7 +1018,6 @@
 		final String chainedOptName = "Boolean in Chained";
 		final String freeOptValue = "Live free or die";
 		final String newCmd = "Let the Wookie win";
-		
 		// Check the inherited clean command
 		assertEquals("rm -yourworld", target.getCleanCommand());
 		// Check that the make command is overridden from parent
@@ -1026,6 +1027,9 @@
 		// Make sure the list is inherited
 		String[] expectedOSList = {"win32","linux","solaris"};
 		assertTrue(Arrays.equals(expectedOSList,
target.getTargetOSList()));
+		// Make sure the list is inherited
+		String[] expectedArchList = {"x86", "ppc"}; 
+		assertTrue(Arrays.equals(expectedArchList,
target.getTargetArchList()));
 
 		// Get the 4 configurations
 		IConfiguration[] configs = target.getConfigurations();
@@ -1100,6 +1104,9 @@
 		assertEquals("org.eclipse.cdt.core.PE",
target.getBinaryParserId());
 		String[] expectedOSList = {"win32","linux","solaris"};
 		assertTrue(Arrays.equals(expectedOSList,
target.getTargetOSList()));
+		// Make sure the list is overridden
+		String[] expectedArchList = {"x86", "ppc"}; 
+		assertTrue(Arrays.equals(expectedArchList,
target.getTargetArchList()));
 
 		// Make sure this is a test target
 		assertTrue(target.isTestTarget());


Back to the top