1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

Apply patches:

1.  Bob Monteleone - initial Discrete Custom Build Step support
2.  Mikhail Sennikovsky - initial isSupported support
3.  Norbert Pleott - support list of binary parsers in targetPlatform binaryParser attribute
This commit is contained in:
Leo Treggiari 2005-04-18 04:15:07 +00:00
parent 9d949fe555
commit ec7b7d4076
29 changed files with 1108 additions and 167 deletions

View file

@ -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>

View file

@ -76,6 +76,7 @@ public class ManagedBuildCoreTests extends TestCase {
int expectedSizeOSList = 5;
String[] expectedArchList = {"all"};
String expectedBinaryParser = "org.eclipse.cdt.core.ELF";
String expectedBinaryParser2 = "org.eclipse.cdt.core.PE";
String[] expectedPlatformName = {"Dbg Platform",
"Rel Platform"};
String expectedCommand = "make";
@ -146,8 +147,11 @@ public class ManagedBuildCoreTests extends TestCase {
expectedOSListarr.add(expectedOSListTokens[i].trim());
}
assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
String[] binaryParsers = platform.getBinaryParserList();
assertEquals(binaryParsers.length, 2);
assertEquals(binaryParsers[0], expectedBinaryParser);
assertEquals(binaryParsers[1], expectedBinaryParser2);
assertEquals(platform.getName(), expectedPlatformName[iconfig]);
// Fetch and check builder
@ -339,7 +343,9 @@ public class ManagedBuildCoreTests extends TestCase {
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);
String[] binaryParsers = platform.getBinaryParserList();
assertEquals(binaryParsers.length, 1);
assertEquals(binaryParsers[0], expectedBinaryParser);
assertEquals(platform.getName(), expectedPlatformName[iconfig]);
// Fetch and check builder
@ -536,7 +542,9 @@ public class ManagedBuildCoreTests extends TestCase {
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);
String[] binaryParsers = platform.getBinaryParserList();
assertEquals(binaryParsers.length, 1);
assertEquals(binaryParsers[0], expectedBinaryParser);
assertEquals(platform.getName(), expectedPlatformName[iconfig]);
// Fetch and check builder

View file

@ -890,7 +890,9 @@ public class ManagedBuildCoreTests20 extends TestCase {
assertEquals("make", configs[0].getBuildCommand());
IToolChain toolChain = configs[0].getToolChain();
ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
String[] binaryParsers = targetPlatform.getBinaryParserList();
assertEquals(binaryParsers.length, 1);
assertEquals(binaryParsers[0], expectedParserId);
assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
// This configuration defines no errors parsers.
@ -1114,7 +1116,9 @@ public class ManagedBuildCoreTests20 extends TestCase {
assertEquals("make", configs[0].getBuildCommand());
IToolChain toolChain = configs[0].getToolChain();
ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
String[] binaryParsers = targetPlatform.getBinaryParserList();
assertEquals(binaryParsers.length, 1);
assertEquals(binaryParsers[0], expectedParserId);
assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
// This configuration defines no errors parsers.
@ -1382,7 +1386,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
// Make sure we get the proper binary parser
IToolChain toolChain = configs[0].getToolChain();
ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
assertEquals("org.eclipse.cdt.core.ELF", targetPlatform.getBinaryParserId());
assertEquals("org.eclipse.cdt.core.ELF", targetPlatform.getBinaryParserList()[0]);
// Make sure the os list is inherited
String[] expectedOSList = {"win32","linux","solaris"};
assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
@ -1536,7 +1540,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
// Make sure the binary parser is hard-coded and available
IToolChain toolChain = configs[0].getToolChain();
ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
assertEquals("org.eclipse.cdt.core.PE", targetPlatform.getBinaryParserId());
assertEquals("org.eclipse.cdt.core.PE", targetPlatform.getBinaryParserList()[0]);
String[] expectedOSList = {"win32","linux","solaris"};
assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
// Make sure the list is overridden
@ -1833,7 +1837,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
IConfiguration[] configs = proj.getConfigurations();
IToolChain toolChain = configs[0].getToolChain();
ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
assertEquals(expectedBinParserId, targetPlatform.getBinaryParserId());
assertEquals(expectedBinParserId, targetPlatform.getBinaryParserList()[0]);
// This target defines errors parsers. Check that the error parsers
// have been assigned.
assertEquals("org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser", configs[0].getErrorParserIds());

View file

@ -188,6 +188,34 @@
</documentation>
</annotation>
</attribute>
<attribute name="prebuildStep" type="string">
<annotation>
<documentation>
Specifies the pre-build command, which runs prior to the standard MBS build.
</documentation>
</annotation>
</attribute>
<attribute name="postbuildStep" type="string">
<annotation>
<documentation>
Specifies the post-build command, which runs after the standard MBS build.
</documentation>
</annotation>
</attribute>
<attribute name="preannouncebuildStep" type="string">
<annotation>
<documentation>
Specifies the string to be displayed when the pre-build command step is run.
</documentation>
</annotation>
</attribute>
<attribute name="postannouncebuildStep" type="string">
<annotation>
<documentation>
Specifies the string to be displayed when the post-build command step is run.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
@ -266,6 +294,16 @@
</documentation>
</annotation>
</attribute>
<attribute name="isToolChainSupported" type="string">
<annotation>
<documentation>
Specifies the name of the class that implements IManagedIsToolChainSupported
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2004 IBM Corporation and others.
* Copyright (c) 2003, 2005 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 at
@ -28,6 +28,10 @@ import org.eclipse.core.resources.IResource;
public interface IConfiguration extends IBuildObject {
public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$
public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$
public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$
public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$
// Schema element names
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
@ -83,6 +87,34 @@ public interface IConfiguration extends IBuildObject {
public String getBuildCommand();
/**
* Returns the prebuild step from this configuration's builder
*
* @return String
*/
public String getPrebuildStep();
/**
* Returns the postbuild step from this configuration's builder
*
* @return String
*/
public String getPostbuildStep();
/**
* Returns the display string associated with the prebuild step from this configuration's builder
*
* @return String
*/
public String getPreannouncebuildStep();
/**
* Returns the display string associated with the postbuild step from this configuration's builder
*
* @return String
*/
public String getPostannouncebuildStep();
/**
* Answers the OS-specific command to remove files created by the build
* of this configuration.
*
@ -266,6 +298,34 @@ public interface IConfiguration extends IBuildObject {
public void setBuildCommand(String command);
/**
* Sets the prebuild step for the receiver to the value in the argument.
*
* @param step
*/
public void setPrebuildStep(String step);
/**
* Sets the postbuild step for the receiver to the value in the argument.
*
* @param step
*/
public void setPostbuildStep(String step);
/**
* Sets the prebuild step display string for the receiver to the value in the argument.
*
* @param announceStep
*/
public void setPreannouncebuildStep(String announceStep);
/**
* Sets the postbuild step display string for the receiver to the value in the argument.
*
* @param announceStep
*/
public void setPostannouncebuildStep(String announceStep);
/**
* Sets the command used to clean the outputs of this configuration.
*
* @param name
@ -350,4 +410,12 @@ public interface IConfiguration extends IBuildObject {
* @param command The command
*/
public void setToolCommand(ITool tool, String command);
/**
* Returns <code>true</code> if the configuration's tool-chain is supported on the system
* otherwise returns <code>false</code>
*
* @return boolean
*/
public boolean isSupported();
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2003,2004 Rational Software Corporation and others.
* Copyright (c) 2003,2005 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -97,6 +97,34 @@ public interface IManagedBuildInfo {
public String getBuildCommand();
/**
* Answers the prebuild step for the default configuration
*
* @return String
*/
public String getPrebuildStep();
/**
* Answers the postbuild step for the default configuration
*
* @return String
*/
public String getPostbuildStep();
/**
* Answers the display string associated with the prebuild step for the default configuration
*
* @return String
*/
public String getPreannouncebuildStep();
/**
* Answers the display string associated with the postbuild step for the default configuration
*
* @return String
*/
public String getPostannouncebuildStep();
/**
* Answers the command needed to remove files on the build machine
*
* @return

View file

@ -0,0 +1,28 @@
/**********************************************************************
* Copyright (c) 2005 Intel 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 at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.core.runtime.PluginVersionIdentifier;
/**
*
* @since 3.0
*/
public interface IManagedIsToolChainSupported {
/**
*
* @return <code>true</code> if the given tool-chain is supported on the system
* otherwise returns <code>false</code>
*/
public boolean isSupported(IToolChain toolChain,
PluginVersionIdentifier version,
String instance);
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -128,4 +128,11 @@ public interface IProjectType extends IBuildObject {
*/
public boolean isTestProjectType();
/**
* Returns <code>true</code> if at least one project-type contiguration is supported on the system
* otherwise returns <code>false</code>
*
* @return boolean
*/
public boolean isSupported();
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -94,16 +94,32 @@ public interface ITargetPlatform extends IBuildObject {
* Returns the unique ID of the binary parser associated with the target platform.
*
* @return String
* @deprecated Use getBinaryParserList
*/
public String getBinaryParserId();
/**
* Returns the unique IDs of the binary parsers associated with the target platform.
*
* @return String[]
*/
public String[] getBinaryParserList();
/**
* Sets the string id of the binary parser for this target platform.
*
* @param id
* @deprecated Use setBinaryParserList
*/
public void setBinaryParserId(String id);
/**
* Sets the string ids of the binary parsers for this target platform.
*
* @param ids
*/
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>.

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -32,6 +32,7 @@ public interface IToolChain extends IBuildObject {
public static final String OS_LIST = "osList"; //$NON-NLS-1$
public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
public static final String IS_TOOL_CHAIN_SUPPORTED = "isToolChainSupported"; //$NON-NLS-1$
// The attribute name for the scanner info collector
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
@ -247,4 +248,11 @@ public interface IToolChain extends IBuildObject {
*/
public boolean isExtensionElement();
/**
* Returns <code>true</code> if the tool-chain support is installed on the system
* otherwise returns <code>false</code>
*
* @return boolean
*/
public boolean isSupported();
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2003,2004 IBM Rational Software and others.
* Copyright (c) 2003,2005 IBM Rational Software 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 at
@ -60,6 +60,10 @@ public class Configuration extends BuildObject implements IConfiguration {
private String cleanCommand;
private String artifactExtension;
private String errorParserIds;
private String prebuildStep;
private String postbuildStep;
private String preannouncebuildStep;
private String postannouncebuildStep;
// Miscellaneous
private boolean isExtensionConfig = false;
private boolean isDirty = false;
@ -225,9 +229,21 @@ public class Configuration extends BuildObject implements IConfiguration {
if (cloneConfig.errorParserIds != null) {
errorParserIds = new String(cloneConfig.errorParserIds);
}
if (cloneConfig.prebuildStep != null) {
prebuildStep = new String(cloneConfig.prebuildStep);
}
if (cloneConfig.postbuildStep != null) {
postbuildStep = new String(cloneConfig.postbuildStep);
}
if (cloneConfig.preannouncebuildStep != null) {
preannouncebuildStep = new String(cloneConfig.preannouncebuildStep);
}
if (cloneConfig.postannouncebuildStep != null) {
postannouncebuildStep = new String( cloneConfig.postannouncebuildStep);
}
// Clone the configuration's children
// Tool Chain
// Tool Chain
int nnn = ManagedBuildManager.getRandomNumber();
String subId;
String subName;
@ -316,6 +332,14 @@ public class Configuration extends BuildObject implements IConfiguration {
// Get the clean command
cleanCommand = element.getAttribute(CLEAN_COMMAND);
// Get the pre-build and post-build commands
prebuildStep = element.getAttribute(PREBUILD_STEP);
postbuildStep = element.getAttribute(POSTBUILD_STEP);
// Get the pre-build and post-build announcements
preannouncebuildStep = element.getAttribute(PREANNOUNCEBUILD_STEP);
postannouncebuildStep = element.getAttribute(POSTANNOUNCEBUILD_STEP);
}
/* (non-Javadoc)
@ -362,6 +386,25 @@ public class Configuration extends BuildObject implements IConfiguration {
if (element.hasAttribute(CLEAN_COMMAND)) {
cleanCommand = element.getAttribute(CLEAN_COMMAND);
}
// Get the pre-build and post-build commands
if (element.hasAttribute(PREBUILD_STEP)) {
prebuildStep = element.getAttribute(PREBUILD_STEP);
}
if (element.hasAttribute(POSTBUILD_STEP)) {
postbuildStep = element.getAttribute(POSTBUILD_STEP);
}
// Get the pre-build and post-build announcements
if (element.hasAttribute(PREANNOUNCEBUILD_STEP)) {
preannouncebuildStep = element.getAttribute(PREANNOUNCEBUILD_STEP);
}
if (element.hasAttribute(POSTANNOUNCEBUILD_STEP)) {
postannouncebuildStep = element
.getAttribute(POSTANNOUNCEBUILD_STEP);
}
}
/**
@ -390,7 +433,19 @@ public class Configuration extends BuildObject implements IConfiguration {
if (cleanCommand != null)
element.setAttribute(CLEAN_COMMAND, cleanCommand);
if (prebuildStep != null)
element.setAttribute(PREBUILD_STEP, prebuildStep);
if (postbuildStep != null)
element.setAttribute(POSTBUILD_STEP, postbuildStep);
if (preannouncebuildStep != null)
element.setAttribute(PREANNOUNCEBUILD_STEP, preannouncebuildStep);
if (postannouncebuildStep != null)
element.setAttribute(POSTANNOUNCEBUILD_STEP, postannouncebuildStep);
// Serialize my children
Element toolChainElement = doc.createElement(IToolChain.TOOL_CHAIN_ELEMENT_NAME);
element.appendChild(toolChainElement);
@ -783,7 +838,85 @@ public class Configuration extends BuildObject implements IConfiguration {
return new String("make"); //$NON-NLS-1$
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPrebuildStep()
*/
public String getPrebuildStep() {
if (prebuildStep == null) {
// If I have a parent, ask it
if (parent != null) {
return parent.getPrebuildStep();
} else {
// I'm it
return EMPTY_STRING;
}
} else {
return prebuildStep;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPostbuildStep()
*/
public String getPostbuildStep() {
if (postbuildStep == null) {
// If I have a parent, ask it
if (parent != null) {
return parent.getPostbuildStep();
} else {
// I'm it
return EMPTY_STRING;
}
} else {
return postbuildStep;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPreannouncebuildStep()
*/
public String getPreannouncebuildStep() {
if (preannouncebuildStep == null) {
// If I have a parent, ask it
if (parent != null) {
return parent.getPreannouncebuildStep();
} else {
// I'm it
return EMPTY_STRING;
}
} else {
return preannouncebuildStep;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPostannouncebuildStep()
*/
public String getPostannouncebuildStep() {
if (postannouncebuildStep == null) {
// If I have a parent, ask it
if (parent != null) {
return parent.getPostannouncebuildStep();
} else {
// I'm it
return EMPTY_STRING;
}
} else {
return postannouncebuildStep;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getCleanCommand()
*/
public String getCleanCommand() {
@ -805,7 +938,9 @@ public class Configuration extends BuildObject implements IConfiguration {
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserIds()
*/
public String getErrorParserIds() {
@ -817,7 +952,8 @@ public class Configuration extends BuildObject implements IConfiguration {
if (parent != null) {
errorParsers = parent.getErrorParserIds();
}
// If no error parsers are specified by the configuration, the default is
// If no error parsers are specified by the configuration, the default
// is
// the error parsers from the tool-chain
if (errorParsers == null && toolChain != null) {
errorParsers = toolChain.getErrorParserIds(this);
@ -928,8 +1064,66 @@ public class Configuration extends BuildObject implements IConfiguration {
}
builder.setCommand(command);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPrebuildStep(java.lang.String)
*/
public void setPrebuildStep(String step) {
if (step == null && prebuildStep == null) return;
if (prebuildStep == null || step == null || !prebuildStep.equals(step)) {
prebuildStep = step;
setRebuildState(true);
isDirty = true;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPostbuildStep(java.lang.String)
*/
public void setPostbuildStep(String step) {
if (step == null && postbuildStep == null) return;
if (postbuildStep == null || step == null || !postbuildStep.equals(step)) {
postbuildStep = step;
setRebuildState(true);
isDirty = true;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPreannouncebuildStep(java.lang.String)
*/
public void setPreannouncebuildStep(String announceStep) {
if (announceStep == null && preannouncebuildStep == null) return;
if (preannouncebuildStep == null || announceStep == null || !preannouncebuildStep.equals(announceStep)) {
preannouncebuildStep = announceStep;
setRebuildState(true);
isDirty = true;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPostannouncebuildStep(java.lang.String)
*/
public void setPostannouncebuildStep(String announceStep) {
if (announceStep == null && postannouncebuildStep == null) return;
if (postannouncebuildStep == null || announceStep == null || !postannouncebuildStep.equals(announceStep)) {
postannouncebuildStep = announceStep;
setRebuildState(true);
isDirty = true;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isSupported()
*/
public boolean isSupported(){
IToolChain toolChain = getToolChain();
if(toolChain != null)
return toolChain.isSupported();
return false;
}
/*
* O B J E C T S T A T E M A I N T E N A N C E
*/

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2005 IBM Corporation and others.
* Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.IMarkerGenerator;
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.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
@ -166,6 +167,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
private static final String TYPE_CLEAN = "ManagedMakeBuilder.type.clean"; //$NON-NLS-1$
private static final String TYPE_FULL = "ManagedMakeBuilder.type.full"; //$NON-NLS-1$
private static final String TYPE_INC = "ManagedMakeBuider.type.incremental"; //$NON-NLS-1$
private static final String WARNING_UNSUPPORTED_CONFIGURATION = "ManagedMakeBuilder.warning.unsupported.configuration"; //$NON-NLS-1$
public static boolean VERBOSE = false;
// Local variables
@ -431,6 +433,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
/* (non-javadoc)
* Answers an array of strings with the proper make targets
* for a build with no custom prebuild/postbuild steps
*
* @param fullBuild
* @return
@ -541,9 +544,10 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
/* (non-Javadoc)
* @param fullBuild
* @param buildType
* @param buildDir
* @param info
* @param generator
* @param monitor
*/
protected void invokeMake(int buildType, IPath buildDir, IManagedBuildInfo info, IManagedBuilderMakefileGenerator generator, IProgressMonitor monitor) {
@ -601,23 +605,18 @@ public class GeneratedMakefileBuilder extends ACBuilder {
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
IConfiguration cfg = info.getDefaultConfiguration();
if(!cfg.isSupported()){
buf.append(ManagedMakeMessages.getFormattedString(WARNING_UNSUPPORTED_CONFIGURATION,new String[] {cfg.getName(),cfg.getToolChain().getName()}));
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
}
consoleOutStream.write(buf.toString().getBytes());
consoleOutStream.flush();
// Remove all markers for this project
removeAllMarkers(currentProject);
// Get the arguments to be passed to make from build model
ArrayList makeArgs = new ArrayList();
String arg = info.getBuildArguments();
if (arg.length() > 0) {
String[] args = arg.split("\\s"); //$NON-NLS-1$
for (int i = 0; i < args.length; ++i) {
makeArgs.add(args[i]);
}
}
makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);
// Get a launcher for the make command
String errMsg = null;
@ -646,58 +645,173 @@ public class GeneratedMakefileBuilder extends ACBuilder {
OutputStream stdout = epm.getOutputStream();
OutputStream stderr = epm.getOutputStream();
// Launch make
Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
if (proc != null) {
try {
// Close the input of the process since we will never write to it
proc.getOutputStream().close();
} catch (IOException e) {
// Get the arguments to be passed to make from build model
ArrayList makeArgs = new ArrayList();
String arg = info.getBuildArguments();
if (arg.length() > 0) {
String[] args = arg.split("\\s"); //$NON-NLS-1$
for (int i = 0; i < args.length; ++i) {
makeArgs.add(args[i]);
}
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
}
String[] makeTargets;
String prebuildStep = info.getPrebuildStep();
boolean prebuildStepPresent = (prebuildStep.length() > 0);
Process proc = null;
boolean isuptodate = false;
if (prebuildStepPresent) {
ArrayList premakeArgs = (ArrayList) makeArgs.clone();
String[] premakeTargets;
switch (buildType) {
case INCREMENTAL_BUILD: {
// For an incremental build with a prebuild step:
// Check the status of the main build with "make -q main-build"
// If up to date:
// then: don't invoke the prebuild step, which should be run only if
// something needs to be built in the main build
// else: invoke the prebuild step and the main build step
boolean quit = false;
premakeArgs.add("-q"); //$NON-NLS-1$
premakeArgs.add("main-build"); //$NON-NLS-1$
premakeTargets = (String[]) premakeArgs
.toArray(new String[premakeArgs.size()]);
proc = launcher.execute(makeCommand, premakeTargets,
env, workingDirectory);
if (proc != null) {
try {
// Close the input of the process since we will never write to it
proc.getOutputStream().close();
} catch (IOException e) {
}
if (launcher.waitAndRead(stdout, stderr,
new SubProgressMonitor(monitor,
IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
errMsg = launcher.getErrorMessage();
}
} else {
errMsg = launcher.getErrorMessage();
}
if ((errMsg != null && errMsg.length() > 0)
|| proc == null) {
// Can't tell if the build is needed, so assume it is, and let any errors be triggered
// when the "real" build is invoked below
makeArgs.add("pre-build"); //$NON-NLS-1$
makeArgs.add("main-build"); //$NON-NLS-1$
} else {
// The "make -q" command launch was successful
if (proc.exitValue() == 0) {
// If the status value returned from "make -q" is 0, then the build state is up-to-date
isuptodate = true;
// Report that the build was up to date, and thus nothing needs to be built
String uptodateMsg = ManagedMakeMessages
.getFormattedString(NOTHING_BUILT,
currentProject.getName());
buf.append(uptodateMsg);
buf.append(System.getProperty(
"line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
// Write message on the console
consoleOutStream.write(buf.toString()
.getBytes());
consoleOutStream.flush();
consoleOutStream.close();
stdout.close();
stderr.close();
} else {
// The status value was other than 0, so press on with the build process
makeArgs.add("pre-build"); //$NON-NLS-1$
makeArgs.add("main-build"); //$NON-NLS-1$
}
}
break;
}
case FULL_BUILD: {
makeArgs.add("clean"); //$NON-NLS-1$
makeArgs.add("pre-build"); //$NON-NLS-1$
makeArgs.add("main-build"); //$NON-NLS-1$
break;
}
case CLEAN_BUILD: {
makeArgs.add("clean"); //$NON-NLS-1$
break;
}
}
} else {
// No prebuild step
//
makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
}
makeTargets = (String[]) makeArgs.toArray(new String[makeArgs
.size()]);
// Launch make - main invocation
if (!isuptodate) {
proc = launcher.execute(makeCommand, makeTargets, env,
workingDirectory);
if (proc != null) {
try {
// Close the input of the process since we will never write to it
proc.getOutputStream().close();
} catch (IOException e) {
}
if (launcher.waitAndRead(stdout, stderr,
new SubProgressMonitor(monitor,
IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
errMsg = launcher.getErrorMessage();
}
// Force a resync of the projects without allowing the user to cancel.
// This is probably unkind, but short of this there is no way to insure
// the UI is up-to-date with the build results
monitor.subTask(ManagedMakeMessages
.getResourceString(REFRESH));
try {
currentProject.refreshLocal(
IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
monitor.subTask(ManagedMakeMessages
.getResourceString(REFRESH_ERROR));
}
} else {
errMsg = launcher.getErrorMessage();
}
// Force a resync of the projects without allowing the user to cancel.
// This is probably unkind, but short of this there is no way to insure
// the UI is up-to-date with the build results
monitor.subTask(ManagedMakeMessages.getResourceString(REFRESH));
try {
currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
monitor.subTask(ManagedMakeMessages.getResourceString(REFRESH_ERROR));
// Report either the success or failure of our mission
buf = new StringBuffer();
if (errMsg != null && errMsg.length() > 0) {
String errorDesc = ManagedMakeMessages
.getResourceString(BUILD_ERROR);
buf.append(errorDesc);
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
buf.append("(").append(errMsg).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
// Report a successful build
String successMsg = ManagedMakeMessages
.getFormattedString(BUILD_FINISHED,
currentProject.getName());
buf.append(successMsg);
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
}
} else {
errMsg = launcher.getErrorMessage();
}
// Report either the success or failure of our mission
buf = new StringBuffer();
if (errMsg != null && errMsg.length() > 0) {
String errorDesc = ManagedMakeMessages.getResourceString(BUILD_ERROR);
buf.append(errorDesc);
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
buf.append("(").append(errMsg).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
// Report a successful build
String successMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED, currentProject.getName());
buf.append(successMsg);
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
}
// Write message on the console
consoleOutStream.write(buf.toString().getBytes());
consoleOutStream.flush();
stdout.close();
stderr.close();
// Write message on the console
consoleOutStream.write(buf.toString().getBytes());
consoleOutStream.flush();
stdout.close();
stderr.close();
// Generate any error markers that the build has discovered
monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
addBuilderMarkers(epm);
epm.reportProblems();
consoleOutStream.close();
}
// Generate any error markers that the build has discovered
monitor.subTask(ManagedMakeMessages
.getResourceString(MARKERS));
addBuilderMarkers(epm);
epm.reportProblems();
consoleOutStream.close();
}
}
} catch (Exception e) {
forgetLastBuiltState();
} finally {

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2005 IBM Software Corporation and others.
* Copyright (c) 2002, 2005 IBM Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -240,7 +240,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
if (defaultConfig == null) {
IConfiguration[] configs = managedProject.getConfigurations();
if (configs.length > 0) {
for (int i = 0; i < configs.length; i++){
if (configs[i].isSupported()){
defaultConfig = configs[i];
defaultConfigId = defaultConfig.getId();
break;
}
}
if (defaultConfig == null && configs.length > 0) {
defaultConfig = configs[0];
defaultConfigId = defaultConfig.getId();
}
@ -514,7 +521,69 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return EMPTY_STRING;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPrebuildStep()
*/
public String getPrebuildStep() {
// Get the default configuration and use its value
String name = new String();
IConfiguration config = getDefaultConfiguration();
if (config != null) {
name = config.getPrebuildStep();
}
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPostbuildStep()
*/
public String getPostbuildStep() {
// Get the default configuration and use its value
String name = new String();
IConfiguration config = getDefaultConfiguration();
if (config != null) {
name = config.getPostbuildStep();
}
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPreannouncebuildStep()
*/
public String getPreannouncebuildStep() {
// Get the default configuration and use its value
String name = new String();
IConfiguration config = getDefaultConfiguration();
if (config != null) {
name = config.getPreannouncebuildStep();
}
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPostannouncebuildStep()
*/
public String getPostannouncebuildStep() {
// Get the default configuration and use its value
String name = new String();
IConfiguration config = getDefaultConfiguration();
if (config != null) {
name = config.getPostannouncebuildStep();
}
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputExtension(java.lang.String)
*/
public String getOutputExtension(String resourceExtension) {
@ -530,7 +599,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return null;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputFlag()
*/
public String getOutputFlag(String outputExt) {

View file

@ -1,5 +1,5 @@
##########################################################################
# Copyright (c) 2002,2003 Rational Software Corporation and others.
# Copyright (c) 2002, 2005 Rational Software Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v0.5
# which accompanies this distribution, and is available at
@ -29,6 +29,7 @@ ManagedMakeBuilder.message.clean.build.clean=Trying a make clean in {0}
ManagedMakeBuilder.type.clean = Clean-only build
ManagedMakeBuilder.type.full = Full rebuild
ManagedMakeBuider.type.incremental = Incremental build
ManagedMakeBuilder.warning.unsupported.configuration=**** WARNING: The "{0}" Configuration may not build ****\n**** because it uses the "{1}" ****\n**** tool-chain that is unsupported on this system. ****\n\n**** Attempting to build... ****
# Option exception messages
Option.error.bad_value_type=Bad value for type

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -338,4 +338,16 @@ public class ProjectType extends BuildObject implements IProjectType {
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IProjectType#isSupported()
*/
public boolean isSupported(){
Iterator configIter = getConfigurationList().iterator();
while (configIter.hasNext()) {
Configuration current = (Configuration)configIter.next();
if(current.isSupported())
return true;
}
return false;
}
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2003,2004 IBM Corporation and others.
* Copyright (c) 2003, 2005 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 at
@ -1034,7 +1034,7 @@ public class Target extends BuildObject implements ITarget {
targetPlatform.setIsAbstract(isAbstract);
targetPlatform.setOSList(getTargetOSList());
targetPlatform.setArchList(getTargetArchList());
targetPlatform.setBinaryParserId(getBinaryParserId());
targetPlatform.setBinaryParserList(new String[]{getBinaryParserId()}); // Older projects will always have only one binary parser set.
// Handle ConfigurationV2 children (ToolReference)
// The tools references fetched here are strictly local to the configuration,

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -38,7 +38,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
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 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
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);
}
setDirty(true);
@ -204,8 +204,15 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
}
}
// Get the ID of the binary parser
binaryParserId = element.getAttribute(BINARY_PARSER);
// Get the IDs of the binary parsers from a semi-colon-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,16 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
}
}
// binaryParserId
// Get the semi-colon-separated list of binaryParserIds
if (element.hasAttribute(BINARY_PARSER)) {
binaryParserId = element.getAttribute(BINARY_PARSER);
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 +315,17 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
}
if (binaryParserId != null) {
element.setAttribute(BINARY_PARSER, binaryParserId);
if (binaryParserList != null) {
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) {
@ -386,18 +409,28 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserI()
* @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserId()
* @deprecated
*/
public String getBinaryParserId() {
if (binaryParserId == null) {
String[] ids = getBinaryParserList();
if (ids.length > 0) return ids[0];
return EMPTY_STRING;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserList()
*/
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)
@ -434,13 +467,26 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserId(String)
* @deprecated
*/
public void setBinaryParserId(String id) {
if (id == null && binaryParserId == null) return;
if (binaryParserId == null || id == null || !id.equals(binaryParserId)) {
binaryParserId = id;
setDirty(true);
String[] ids = new String[]{id};
setBinaryParserList(ids);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserList(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)

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -21,11 +21,14 @@ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -51,6 +54,8 @@ public class ToolChain extends BuildObject implements IToolChain {
private List archList;
private Boolean isAbstract;
private String scannerConfigDiscoveryProfileId;
private IConfigurationElement managedIsToolChainSupportedElement = null;
private IManagedIsToolChainSupported managedIsToolChainSupported = null;
// Miscellaneous
private boolean isExtensionToolChain = false;
private boolean isDirty = false;
@ -208,6 +213,8 @@ public class ToolChain extends BuildObject implements IToolChain {
if (toolChain.scannerConfigDiscoveryProfileId != null) {
scannerConfigDiscoveryProfileId = new String(toolChain.scannerConfigDiscoveryProfileId);
}
managedIsToolChainSupportedElement = toolChain.managedIsToolChainSupportedElement;
managedIsToolChainSupported = toolChain.managedIsToolChainSupported;
// Clone the children
if (toolChain.builder != null) {
@ -314,6 +321,12 @@ public class ToolChain extends BuildObject implements IToolChain {
archList.add(archTokens[j].trim());
}
}
// Get the isToolchainSupported configuration element
String managedIsToolChainSupported = element.getAttribute(IS_TOOL_CHAIN_SUPPORTED);
if (managedIsToolChainSupported != null && element instanceof DefaultManagedConfigElement) {
managedIsToolChainSupportedElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
}
/* (non-Javadoc)
@ -467,6 +480,12 @@ public class ToolChain extends BuildObject implements IToolChain {
tool.serialize(doc, toolElement);
}
// Note: isToolChainSupported cannot be specified in a project file because
// an IConfigurationElement is needed to load it!
if (managedIsToolChainSupportedElement != null) {
// TODO: issue warning?
}
// I am clean now
isDirty = false;
}
@ -974,4 +993,33 @@ public class ToolChain extends BuildObject implements IToolChain {
}
}
private IManagedIsToolChainSupported getIsToolChainSupported(){
if(managedIsToolChainSupported == null && managedIsToolChainSupportedElement != null){
try{
if(managedIsToolChainSupportedElement.getAttribute(IS_TOOL_CHAIN_SUPPORTED) != null)
managedIsToolChainSupported =
(IManagedIsToolChainSupported)managedIsToolChainSupportedElement.createExecutableExtension(IS_TOOL_CHAIN_SUPPORTED);
}
catch(CoreException e){
}
}
return managedIsToolChainSupported;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#isSupported()
*/
public boolean isSupported(){
IManagedIsToolChainSupported isSupported = getIsToolChainSupported();
if(isSupported != null){
//TODO: pass the version to the "isSupported" method
return isSupported.isSupported(this,null,null);
}
else if(superClass != null)
return superClass.isSupported();
else
return true;
}
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* Copyright (c) 2004, 2005 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 at
@ -28,9 +28,11 @@ public interface IManagedBuilderMakefileGenerator {
public final String COLON = ":"; //$NON-NLS-1$
public final int COLS_PER_LINE = 80;
public final String COMMENT_SYMBOL = "#"; //$NON-NLS-1$
public final String DOLLAR_SYMBOL = "$"; //$NON-NLS-1$
public final String DEP_EXT = "d"; //$NON-NLS-1$
public final String DEPFILE_NAME = "subdir.dep"; //$NON-NLS-1$
public final String DOT = "."; //$NON-NLS-1$
public final String DASH = "-"; //$NON-NLS-1$
public final String ECHO = "echo"; //$NON-NLS-1$
public final String IN_MACRO = "$<"; //$NON-NLS-1$
public final String LINEBREAK = "\\\n"; //$NON-NLS-1$
@ -39,6 +41,8 @@ public interface IManagedBuilderMakefileGenerator {
public final String MAKEFILE_INIT = "makefile.init"; //$NON-NLS-1$
public final String MAKEFILE_NAME = "makefile"; //$NON-NLS-1$
public final String MAKEFILE_TARGETS = "makefile.targets"; //$NON-NLS-1$
public final String MAKE = "$(MAKE)"; //$NON-NLS-1$
public final String NO_PRINT_DIR = "--no-print-directory"; //$NON-NLS-1$
public final String MODFILE_NAME = "subdir.mk"; //$NON-NLS-1$
public final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2003,2005 IBM Corporation and others.
* Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -601,6 +601,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String flags = info.getFlagsForConfiguration(extension);
String outflag = info.getOutputFlag(extension);
String outputPrefix = info.getOutputPrefix(extension);
String prebuildStep = info.getPrebuildStep();
prebuildStep.trim(); // Remove leading and trailing whitespace (and control characters)
String postbuildStep = info.getPostbuildStep();
postbuildStep.trim(); // Remove leading and trailing whitespace (and control characters)
String preannouncebuildStep = info.getPreannouncebuildStep();
String postannouncebuildStep = info.getPostannouncebuildStep();
String prebuild = "pre-build"; //$NON-NLS-1$
String mainbuild = "main-build"; //$NON-NLS-1$
String postbuild = "post-build"; //$NON-NLS-1$
String targets = rebuild ? "clean all" : "all"; //$NON-NLS-1$ //$NON-NLS-2$
// Get all the projects the build target depends on
@ -612,9 +621,32 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// and neither conditions apply if we are building for it ....
}
// Write out the all target first in case someone just runs make
// all: targ_<target_name>
// If a prebuild step exists, redefine the all target to be
// all: {pre-build} main-build
// and then reset the "traditional" all target to main-build
// This will allow something meaningful to happen if the generated
// makefile is
// extracted and run standalone via "make all"
//
String defaultTarget = "all:"; //$NON-NLS-1$
if (prebuildStep.length() > 0) {
buffer.append(defaultTarget + WHITESPACE);
buffer.append(prebuild + WHITESPACE);
// Reset defaultTarget for now and for subsequent use, below
defaultTarget = mainbuild;
buffer.append(defaultTarget);
// Update the defaultTarget, main-build, by adding a colon, which is
// needed below
defaultTarget = defaultTarget.concat(COLON);
buffer.append(NEWLINE + NEWLINE);
}
// Write out the all target first in case someone just runs make
// all: <target_name> or mainbuild: <target_name>
buffer.append(defaultTarget + WHITESPACE + outputPrefix + buildTargetName);
if (extension.length() > 0) {
buffer.append(DOT + extension);
@ -622,10 +654,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(NEWLINE + 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]>
* 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]>
*/
Vector managedProjectOutputs = new Vector(refdProjects.length);
if (refdProjects.length > 0) {
@ -671,7 +702,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
* @echo 'Building target: $@'
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG)$@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
* @echo 'Finished building: $@'
* @echo
* $(MAKE) --no-print-directory post-build //if postbuild step present
*/
buffer.append(outputPrefix + buildTargetName);
if (extension.length() > 0) {
@ -685,18 +716,65 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + OUT_MACRO + WHITESPACE + "$(OBJS) $(USER_OBJS) $(LIBS)" + NEWLINE); //$NON-NLS-1$
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE + NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
// If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
// Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
// the makefile originally
if (postbuildStep.length() > 0) {
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE);
buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + postbuild + NEWLINE);
}
buffer.append(NEWLINE);
// Always add a clean target
buffer.append("clean:" + NEWLINE); //$NON-NLS-1$
buffer.append(TAB + "-$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + "$(DEPS)" + WHITESPACE + outputPrefix + buildTargetName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
buffer.append(TAB
+ "-$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + "$(DEPS)" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WHITESPACE + outputPrefix + buildTargetName);
if (extension.length() > 0) {
buffer.append(DOT + extension);
}
buffer.append(NEWLINE + NEWLINE);
buffer.append(NEWLINE);
buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
// Add the prebuild step target, if specified
if (prebuildStep.length() > 0) {
buffer.append(prebuild + COLON + NEWLINE);
if (preannouncebuildStep.length() > 0) {
buffer.append(TAB + DASH + AT + ECHO + WHITESPACE
+ SINGLE_QUOTE + preannouncebuildStep + SINGLE_QUOTE
+ NEWLINE);
}
buffer.append(TAB + DASH + prebuildStep + NEWLINE);
buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
}
// Add the postbuild step, if specified
if (postbuildStep.length() > 0) {
buffer.append(postbuild + COLON + NEWLINE);
if (postannouncebuildStep.length() > 0) {
buffer.append(TAB + DASH + AT + ECHO + WHITESPACE
+ SINGLE_QUOTE + postannouncebuildStep + SINGLE_QUOTE
+ NEWLINE);
}
buffer.append(TAB + DASH + postbuildStep + NEWLINE);
buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
}
// Add all the eneded dummy and phony targets
buffer.append(".PHONY: all clean dependents" + NEWLINE); //$NON-NLS-1$
buffer.append(".PHONY: all clean dependents"); //$NON-NLS-1$
if (prebuildStep.length() > 0) {
buffer.append(WHITESPACE + mainbuild + WHITESPACE + prebuild);
}
if (postbuildStep.length() > 0) {
buffer.append(WHITESPACE + postbuild);
}
buffer.append(NEWLINE);
refIter = managedProjectOutputs.listIterator();
while(refIter.hasNext()) {
buffer.append((String)refIter.next() + COLON + NEWLINE);

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 Intel 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 at
@ -244,7 +244,7 @@ class UpdateManagedProject20 {
String builderName = targetPlatform.getName() + "." + newConfig.getName(); //$NON-NLS-1$
toolChain.createTargetPlatform(targetPlatform,subId,builderName,false);
}
targetPlatform.setBinaryParserId(binaryParser);
targetPlatform.setBinaryParserList(new String[]{binaryParser}); // Older projects have only a single binary parser.
}
if(targetEl.hasAttribute(ITarget.MAKE_COMMAND)){

View file

@ -1650,6 +1650,7 @@
osList="win32"
name="%ToolChainName.Dbg"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug">
<targetPlatform
id="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug"
@ -1720,6 +1721,7 @@
osList="win32"
name="%ToolChainName.Rel"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
id="cdt.managedbuild.toolchain.gnu.cygwin.exe.release">
<targetPlatform
id="cdt.managedbuild.target.gnu.platform.cygwin.exe.release"
@ -1797,6 +1799,7 @@
osList="win32"
name="%ToolChainName.Dbg"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
id="cdt.managedbuild.toolchain.gnu.cygwin.so.debug">
<targetPlatform
id="cdt.managedbuild.target.gnu.platform.cygwin.so.debug"
@ -1877,6 +1880,7 @@
osList="win32"
name="%ToolChainName.Rel"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
id="cdt.managedbuild.toolchain.gnu.cygwin.so.release">
<targetPlatform
id="cdt.managedbuild.target.gnu.platform.cygwin.so.release"
@ -1964,6 +1968,7 @@
osList="win32"
name="%ToolChainName.Dbg"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
id="cdt.managedbuild.toolchain.gnu.cygwin.lib.debug">
<targetPlatform
id="cdt.managedbuild.target.gnu.platform.cygwin.lib.debug"
@ -2030,6 +2035,7 @@
osList="win32"
name="%ToolChainName.Rel"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
id="cdt.managedbuild.toolchain.gnu.cygwin.lib.release">
<targetPlatform
id="cdt.managedbuild.target.gnu.platform.cygwin.lib.release"

View file

@ -35,6 +35,7 @@ PlatformBlock.tip.platform=Select the type of project for the build goal
PlatformBlock.label.platform=Project Type:
PlatformBlock.label.configs=Configurations:
PlatformBlock.label.showall=Show All Project Types
PlatformBlock.label.showall.config=Show All Configurations
PlatformBlock.message.error.noconfigs=You must select at least one configuration
# -- Strings for the additional options tab
@ -60,6 +61,9 @@ BuildPropertyPage.defaults.message=This action will reset all of the tools in th
BuildPropertyPage.changes.save.title=Apply Configuration Changes
BuildPropertyPage.changes.save.question=You have made changes to the {0} configuration.\n\nDo you want to apply these changes before switching to the {1} configuration?
BuildPropertyPage.changes.save.error=The configuration changes could not be applied.
BuildPropertyPage.unsupported.proj=The project support is not installed on the system
BuildPropertyPage.unsupported.config=The configuration support is not installed on the system
BuildPropertyPage.config.notselected=No configurations selected
#--------------- Resource Configuration Selection Page --------------
ResourceBuildPropertyPage.defaults.title=Reset Resource Configuration Tool
@ -103,6 +107,7 @@ NewConfiguration.label.name=Name:
NewConfiguration.label.group=Copy settings from
NewConfiguration.label.copy=Default configuration:
NewConfiguration.label.clone=Existing configuration:
NewConfiguration.label.showall=Show unsupported configurations
NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
NewConfiguration.error.caseName=A configuration name that differs only in case to "{0}" exists.
NewConfiguration.error.invalidName=The name "{0}" is invalid.

View file

@ -0,0 +1,26 @@
/**********************************************************************
* Copyright (c) 2005 Intel 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 at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin;
import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.core.runtime.PluginVersionIdentifier;
public class IsGnuCygwinToolChainSupported implements
IManagedIsToolChainSupported {
public boolean isSupported(IToolChain toolChain,
PluginVersionIdentifier version, String instance) {
// TODO implement
return true;
}
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2004 Rational Software Corporation and others.
* Copyright (c) 2002, 2005 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -29,6 +29,7 @@ import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@ -78,6 +79,10 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
private static final String ID_SEPARATOR = "."; //$NON-NLS-1$
private static final String MSG_CLOSEDPROJECT = "MngMakeProjectPropertyPage.closedproject"; //$NON-NLS-1$
private static final String MSG_UNSUPPORTED_PROJ = PREFIX + ".unsupported.proj"; //$NON-NLS-1$
private static final String MSG_UNSUPPORTED_CONFIG = PREFIX + ".unsupported.config"; //$NON-NLS-1$
private static final String MSG_CONFIG_NOTSELECTED = PREFIX + ".config.notselected"; //$NON-NLS-1$
/*
* Dialog widgets
*/
@ -454,9 +459,28 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// TODO: Set the appropriate error parsers...
// TODO: Binary parsers too?
fOptionBlock.updateValues();
doUpdateMessage();
}
}
}
private void doUpdateMessage(){
if(selectedProjectType != null && !selectedProjectType.isSupported()){
setMessage(ManagedBuilderUIMessages.getResourceString(MSG_UNSUPPORTED_PROJ),IMessageProvider.WARNING);
}
else if(selectedConfiguration != null){
if(selectedConfiguration.isSupported()){
setMessage(null,IMessageProvider.NONE);
}
else{
setMessage(ManagedBuilderUIMessages.getResourceString(MSG_UNSUPPORTED_CONFIG),IMessageProvider.WARNING);
}
}
else
setMessage(ManagedBuilderUIMessages.getResourceString(MSG_CONFIG_NOTSELECTED),IMessageProvider.WARNING);
getContainer().updateMessage();
}
// Event handler for the manage configuration button event
private void handleManageConfig () {

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2003,2004 IBM Corporation and others.
* Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -45,6 +45,7 @@ public class NewConfigurationDialog extends StatusDialog {
private static final String GROUP = LABEL + ".group"; //$NON-NLS-1$
private static final String COPY = LABEL + ".copy"; //$NON-NLS-1$
private static final String CLONE = LABEL + ".clone"; //$NON-NLS-1$
private static final String SHOWALL = LABEL + ".showall"; //$NON-NLS-1$
private static final String DUPLICATE = ERROR + ".duplicateName"; //$NON-NLS-1$
private static final String CASE = ERROR + ".caseName"; //$NON-NLS-1$
private static final String INVALID = ERROR + ".invalidName"; //$NON-NLS-1$
@ -55,6 +56,7 @@ public class NewConfigurationDialog extends StatusDialog {
private Text configName;
private Combo copyConfigSelector;
private Combo cloneConfigSelector;
private Button btnShowAll;
// Bookeeping
private boolean clone;
@ -201,7 +203,6 @@ public class NewConfigurationDialog extends StatusDialog {
copyConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
copyConfigSelector.setFont(group.getFont());
copyConfigSelector.setItems(getDefaultConfigNames());
int index = copyConfigSelector.indexOf(newName);
copyConfigSelector.select(index < 0 ? 0 : index);
gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
@ -238,6 +239,22 @@ public class NewConfigurationDialog extends StatusDialog {
}
});
// Create a "show all configurations" button
btnShowAll = new Button(composite, SWT.CHECK);
btnShowAll.setFont(composite.getFont());
btnShowAll.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
btnShowAll.setLayoutData(gd);
btnShowAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateDefaultConfigs();
}
});
updateComboState();
updateDefaultConfigs();
return composite;
}
@ -250,18 +267,45 @@ public class NewConfigurationDialog extends StatusDialog {
return parentConfig;
}
/*
* Returns the array of configuration names defined for all projects
* of this type in the plugin manifest. This list will be used to
* populate the the configurations to copy default settings from.
/**
* updates the list of default configurations
*/
private String [] getDefaultConfigNames() {
String [] names = new String[defaultConfigs.length];
for (int index = 0; index < defaultConfigs.length; ++index) {
IConfiguration config = defaultConfigs[index];
names[index] = config.getName();
private void updateDefaultConfigs(){
IConfiguration cfgs[] = managedProject.getProjectType().getConfigurations();
boolean showAll = btnShowAll != null ? btnShowAll.getSelection() : false;
if(showAll)
defaultConfigs = cfgs;
else {
ArrayList list = new ArrayList();
for (int i = 0; i < cfgs.length; i++){
if(cfgs[i].isSupported())
list.add(cfgs[i]);
}
defaultConfigs = (IConfiguration[])list.toArray(new IConfiguration[list.size()]);
}
return names;
if(defaultConfigs.length != 0){
String names[] = new String[defaultConfigs.length];
for (int i = 0; i < defaultConfigs.length; ++i)
names[i] = defaultConfigs[i].getName();
int selectionIndex = copyConfigSelector.getSelectionIndex();
String oldSelection = null;
if(selectionIndex != -1)
oldSelection = copyConfigSelector.getItem(selectionIndex);
copyConfigSelector.setItems(names);
if(oldSelection != null)
selectionIndex = copyConfigSelector.indexOf(oldSelection);
if(selectionIndex == -1)
selectionIndex = 0;
copyConfigSelector.select(selectionIndex);
}
else{
copyConfigSelector.removeAll();
}
validateState();
}
/*
@ -338,6 +382,8 @@ public class NewConfigurationDialog extends StatusDialog {
protected void updateComboState() {
cloneConfigSelector.setEnabled(clone);
copyConfigSelector.setEnabled(!clone);
btnShowAll.setVisible(!clone);
validateState();
}
/* (non-Javadoc)
@ -385,6 +431,9 @@ public class NewConfigurationDialog extends StatusDialog {
if (nameLength == 0) {
// Not an error
status.setError(""); //$NON-NLS-1$
} else if(clone ? definedConfigs.length == 0 : defaultConfigs.length == 0) {
// Not an error
status.setError(""); //$NON-NLS-1$
} else if (isDuplicateName(currentName)) {
status.setError(ManagedBuilderUIMessages.getFormattedString(DUPLICATE, currentName));
} else if (isSimilarName(currentName)) {

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2004 IBM Corporation and others.
* Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -59,6 +59,7 @@ public class CProjectPlatformPage extends WizardPage {
private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
private static final String CONFIG_LABEL = LABEL + ".configs"; //$NON-NLS-1$
private static final String SHOWALL_LABEL = LABEL + ".showall"; //$NON-NLS-1$
private static final String SHOWALL_CONFIG_LABEL = LABEL + ".showall.config"; //$NON-NLS-1$
private static final String TARGET_LABEL = LABEL + ".platform"; //$NON-NLS-1$
private static final String TARGET_TIP = TIP + ".platform"; //$NON-NLS-1$
@ -66,10 +67,12 @@ public class CProjectPlatformPage extends WizardPage {
protected Combo platformSelection;
private ArrayList selectedConfigurations;
protected IProjectType selectedProjectType;
protected Button showAll;
protected Button showAllProjTypes;
protected Button showAllConfigs;
protected CheckboxTableViewer tableViewer;
protected String[] projectTypeNames;
protected ArrayList projectTypes;
protected IConfiguration configurations[];
/**
* Constructor.
@ -163,19 +166,33 @@ public class CProjectPlatformPage extends WizardPage {
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
showAll = new Button(composite, SWT.CHECK | SWT.LEFT);
showAll.setFont(composite.getFont());
showAll.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_LABEL));
showAll.addListener(SWT.Selection, new Listener() {
showAllProjTypes = new Button(composite, SWT.CHECK | SWT.LEFT);
showAllProjTypes.setFont(composite.getFont());
showAllProjTypes.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_LABEL));
showAllProjTypes.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
populateTypes();
platformSelection.select(0);
handleTypeSelection();
}
});
showAll.addDisposeListener(new DisposeListener() {
showAllProjTypes.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
showAll = null;
showAllProjTypes = null;
}
});
showAllConfigs = new Button(composite, SWT.CHECK | SWT.LEFT);
showAllConfigs.setFont(composite.getFont());
showAllConfigs.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_CONFIG_LABEL));
showAllConfigs.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
populateConfigurations();
}
});
showAllConfigs.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
showAllConfigs = null;
}
});
}
@ -267,16 +284,44 @@ public class CProjectPlatformPage extends WizardPage {
}
/**
* Populate the table viewer with the known configurations.
* By default, all the configurations are selected.
* Populate the table viewer with either all known configurations
* or only with the supported configurations depending on whether a user
* has chosen to diaplay unsupported configurations or not
* By default, only supported configurations are selected.
*/
private void populateConfigurations() {
// Make the root of the content provider the new project type
tableViewer.setInput(selectedProjectType);
tableViewer.setAllChecked(true);
if(selectedProjectType == null)
return;
boolean showAll = showAllConfigs != null ? showAllConfigs.getSelection() : false;
IConfiguration selected[] = null;
if(showAll){
configurations = selectedProjectType.getConfigurations();
selected = filterSupportedConfigurations(configurations);
}
else{
configurations = filterSupportedConfigurations(selectedProjectType.getConfigurations());
selected = configurations;
}
tableViewer.setInput(configurations);
tableViewer.setCheckedElements(selected);
handleConfigurationSelectionChange();
}
/**
* Returns the array of supported configurations found in the configuurations
* passes to this method
*/
IConfiguration[] filterSupportedConfigurations(IConfiguration cfgs[]){
ArrayList supported = new ArrayList();
for(int i = 0; i < cfgs.length; i++){
if(cfgs[i].isSupported())
supported.add(cfgs[i]);
}
return (IConfiguration[])supported.toArray(new IConfiguration[supported.size()]);
}
/* (non-Javadoc)
* Extracts the names from the project types that are valid for the wizard
* session and populates the combo widget with them.
@ -308,9 +353,9 @@ public class CProjectPlatformPage extends WizardPage {
IProjectType type = allProjectTypes[index];
if (!type.isAbstract() && !type.isTestProjectType()) {
// If the check box is selected show all the targets
if (showAll != null && showAll.getSelection() == true) {
if (showAllProjTypes != null && showAllProjTypes.getSelection() == true) {
projectTypes.add(type);
} else {
} else if (type.isSupported()) {
// Apply the OS and ARCH filters to determine if the target should be shown
// Determine if the project type has any configuration with a tool-chain
// that supports this OS & Architecture.

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2004 IBM Corporation and others.
* Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -10,17 +10,15 @@
***********************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
public class ConfigurationContentProvider implements IStructuredContentProvider {
// The contents of the parent of the table is a list of configurations
public Object[] getElements(Object parent) {
// The content is a list of configurations
IConfiguration[] configs = ((IProjectType) parent).getConfigurations();
return (configs.length == 0) ? new Object[0] : configs;
// The content is an array of configurations
Object array[] = (Object[])parent;
return (array == null || array.length == 0) ? new Object[0] : array;
}
public void dispose() {

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2005 IBM Corporation and others.
* Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@ -143,11 +143,22 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
IConfiguration newConfig = newManagedProject.createConfiguration(config, config.getId() + "." + id); //$NON-NLS-1$
newConfig.setArtifactName(newManagedProject.getDefaultArtifactName());
}
// Now add the first config in the list as the default
// Now add the first supported config in the list as the default
IConfiguration defaultCfg = null;
IConfiguration[] newConfigs = newManagedProject.getConfigurations();
if (newConfigs.length > 0) {
ManagedBuildManager.setDefaultConfiguration(newProject, newConfigs[0]);
ManagedBuildManager.setSelectedConfiguration(newProject, newConfigs[0]);
for(int i = 0; i < newConfigs.length; i++) {
if(newConfigs[i].isSupported()){
defaultCfg = newConfigs[i];
break;
}
}
if(defaultCfg == null && newConfigs.length > 0)
defaultCfg = newConfigs[0];
if(defaultCfg != null) {
ManagedBuildManager.setDefaultConfiguration(newProject, defaultCfg);
ManagedBuildManager.setSelectedConfiguration(newProject, defaultCfg);
}
ManagedBuildManager.setNewProjectVersion(newProject);
ICDescriptor desc = null;
@ -155,12 +166,16 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
desc = CCorePlugin.getDefault().getCProjectDescription(newProject, true);
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
// TODO: The binary parser setting is currently per-project in the rest of CDT.
// In the MBS, it is per-coonfiguration. For now, select the binary parser of the
// In the MBS, it is per-coonfiguration. For now, select the binary parsers of the
// first configuration.
if (newConfigs.length > 0) {
IToolChain tc = newConfigs[0].getToolChain();
ITargetPlatform targetPlatform = tc.getTargetPlatform();
desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, targetPlatform.getBinaryParserId());
// Create entries for all binary parsers
String[] binaryParsers = targetPlatform.getBinaryParserList();
for (int i=0; i<binaryParsers.length; i++) {
desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, binaryParsers[i]);
}
}
} catch (CoreException e) {
ManagedBuilderUIPlugin.log(e);