From 08c13e8969a6914f48a58420de73389388da0e19 Mon Sep 17 00:00:00 2001 From: Sean Evoy Date: Mon, 10 May 2004 15:44:32 +0000 Subject: [PATCH] External commit for Leo Treggiari. 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. --- .../plugin.xml | 109 +++++++++--------- .../schema/ManagedBuildTools.exsd | 7 ++ .../cdt/managedbuilder/core/ITarget.java | 8 ++ .../managedbuilder/internal/core/Target.java | 17 +++ .../ui/wizards/CProjectPlatformPage.java | 7 +- 5 files changed, 92 insertions(+), 56 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml index a528162d19d..3089dfb884e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml @@ -22,12 +22,12 @@ point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo"> + valueType="string" + id="org.eclipse.cdt.core.tests.option1"> + valueType="boolean" + id="org.eclipse.cdt.core.tests.option2"> + valueType="stringList" + id="list.option"> + value="b" + builtIn="false"> + value="c" + builtIn="true"> @@ -286,8 +287,8 @@ @@ -302,8 +303,8 @@ @@ -359,16 +360,14 @@ id="test.error.parsers"> - - diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd index b7612d3ceb0..bd6dfd96a96 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd +++ b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd @@ -486,6 +486,13 @@ Additional special types exist to flag options of special relevance to the build + + + + 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 "x86", "sparc", "ppc"; or "all". + + + diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java index 7aa0ff9a9f7..c62e85fa60b 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java @@ -29,6 +29,7 @@ public interface ITarget extends IBuildObject { 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 @@ public interface ITarget extends IBuildObject { * @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 diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java index 31a330431c6..f538c1d4cba 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java @@ -51,6 +51,7 @@ public class Target extends BuildObject implements ITarget { private IResource owner; private ITarget parent; private List targetOSList; + private List targetArchList; private Map toolMap; private List toolList; private List toolReferences; @@ -466,6 +467,22 @@ public class Target extends BuildObject implements ITarget { 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) * @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner() */ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java index d46d2f98c4c..81fe232bfed 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java @@ -291,6 +291,7 @@ public class CProjectPlatformPage extends WizardPage { 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 @@ public class CProjectPlatformPage extends WizardPage { 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); + } } } }