mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
1. Tool anouncement message fixes
2. Target tool calculation fixes 2. test fixes
This commit is contained in:
parent
e2330794b8
commit
31841a2ffe
9 changed files with 167 additions and 36 deletions
|
@ -6708,7 +6708,7 @@
|
|||
</managedBuildRevision>
|
||||
<tool
|
||||
natureFilter="cnature"
|
||||
name="%ToolName.linker.gnu.c"
|
||||
name="Test 4.0 ToolName.linker.gnu.c"
|
||||
outputFlag="-o"
|
||||
isSystem="true"
|
||||
command="gcc"
|
||||
|
@ -6727,12 +6727,12 @@
|
|||
|
||||
<optionCategory
|
||||
owner="test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker"
|
||||
name="%OptionCategory.General"
|
||||
name="Test 4.0 OptionCategory.General"
|
||||
id="test.gnu.c.link.category.general">
|
||||
</optionCategory>
|
||||
<option
|
||||
defaultValue="false"
|
||||
name="%Option.Posix.Linker.NoStartFiles"
|
||||
name="Test 4.0 Option.Posix.Linker.NoStartFiles"
|
||||
category="test.gnu.c.link.category.general"
|
||||
command="-nostartfiles"
|
||||
id="test.gnu.c.link.option.nostart"
|
||||
|
@ -6740,7 +6740,7 @@
|
|||
</option>
|
||||
<option
|
||||
defaultValue="false"
|
||||
name="%Option.Posix.Linker.NoDefLibs"
|
||||
name="Test 4.0 Option.Posix.Linker.NoDefLibs"
|
||||
category="test.gnu.c.link.category.general"
|
||||
command="-nodefaultlibs"
|
||||
id="test.gnu.c.link.option.nodeflibs"
|
||||
|
@ -6748,7 +6748,7 @@
|
|||
</option>
|
||||
<option
|
||||
defaultValue="false"
|
||||
name="%Option.Posix.Linker.NoStdLibs"
|
||||
name="Test 4.0 Option.Posix.Linker.NoStdLibs"
|
||||
category="test.gnu.c.link.category.general"
|
||||
command="-nostdlib"
|
||||
id="test.gnu.c.link.option.nostdlibs"
|
||||
|
@ -6756,7 +6756,7 @@
|
|||
</option>
|
||||
<option
|
||||
defaultValue="false"
|
||||
name="%Option.Posix.Linker.Strip"
|
||||
name="Test 4.0 Option.Posix.Linker.Strip"
|
||||
category="test.gnu.c.link.category.general"
|
||||
command="-s"
|
||||
id="test.gnu.c.link.option.strip"
|
||||
|
@ -6764,7 +6764,7 @@
|
|||
</option>
|
||||
<option
|
||||
defaultValue="false"
|
||||
name="%Option.Posix.Linker.Static"
|
||||
name="Test 4.0 Option.Posix.Linker.Static"
|
||||
category="test.gnu.c.link.category.general"
|
||||
command="-static"
|
||||
id="test.gnu.c.link.option.noshared"
|
||||
|
@ -6772,11 +6772,11 @@
|
|||
</option>
|
||||
<optionCategory
|
||||
owner="test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker"
|
||||
name="%OptionCategory.Libs"
|
||||
name="Test 4.0 OptionCategory.Libs"
|
||||
id="test.gnu.c.link.category.libs">
|
||||
</optionCategory>
|
||||
<option
|
||||
name="%Option.Posix.Libs"
|
||||
name="Test 4.0 Option.Posix.Libs"
|
||||
category="test.gnu.c.link.category.libs"
|
||||
command="-l"
|
||||
id="test.gnu.c.link.option.libs"
|
||||
|
@ -6784,7 +6784,7 @@
|
|||
valueType="libs">
|
||||
</option>
|
||||
<option
|
||||
name="%Option.Posix.Libsearch"
|
||||
name="Test 4.0 Option.Posix.Libsearch"
|
||||
category="test.gnu.c.link.category.libs"
|
||||
command="-L"
|
||||
id="test.gnu.c.link.option.paths"
|
||||
|
@ -6793,17 +6793,17 @@
|
|||
</option>
|
||||
<optionCategory
|
||||
owner="test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker"
|
||||
name="%OptionCategory.Misc"
|
||||
name="Test 4.0 OptionCategory.Misc"
|
||||
id="test.gnu.c.link.category.other">
|
||||
</optionCategory>
|
||||
<option
|
||||
name="%Option.Posix.Linker.Flags"
|
||||
name="Test 4.0 Option.Posix.Linker.Flags"
|
||||
category="test.gnu.c.link.category.other"
|
||||
valueType="string"
|
||||
id="test.gnu.c.link.option.ldflags">
|
||||
</option>
|
||||
<option
|
||||
name="%Option.Posix.Linker.XLinker"
|
||||
name="Test 4.0 Option.Posix.Linker.XLinker"
|
||||
category="test.gnu.c.link.category.other"
|
||||
command="-Xlinker ${VALUE}"
|
||||
valueType="stringList"
|
||||
|
@ -8348,7 +8348,7 @@
|
|||
archList="all"
|
||||
osList="win32"
|
||||
name="Test 4.0 ToolChainName.Cygwin"
|
||||
targetTool="test.four.dot.zero.cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base;cdt.managedbuild.tool.gnu.c.linker.cygwin.base;cdt.managedbuild.tool.gnu.archiver"
|
||||
targetTool="test.four.dot.zero.cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base;test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker.cygwin.base;test.four.dot.zero.cdt.managedbuild.tool.gnu.archiver"
|
||||
isSystem="true"
|
||||
id="test.four.dot.zero.cdt.managedbuild.toolchain.gnu.cygwin.base">
|
||||
<targetPlatform
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,43 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class BasicTestCase extends TestCase {
|
||||
private List fProjList = new LinkedList();
|
||||
|
||||
protected void addProject(IProject project){
|
||||
fProjList.add(project);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
for(Iterator iter = fProjList.iterator(); iter.hasNext();){
|
||||
IProject proj = (IProject)iter.next();
|
||||
try {
|
||||
proj.delete(true, null);
|
||||
} catch (CoreException e){
|
||||
}
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
public class ToolChainModificationTests extends BasicTestCase {
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(ToolChainModificationTests.class);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
// public void testChangeToolChain(){
|
||||
//
|
||||
// }
|
||||
}
|
|
@ -41,6 +41,7 @@ import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
|||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IModificationStatus;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOutputType;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
|
@ -1095,12 +1096,12 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
toolChain.addTool((Tool)added[i]);
|
||||
}
|
||||
|
||||
adjustTargetTools(removed, getTools());
|
||||
adjustTargetTools(removed, added);
|
||||
|
||||
toolChain.propertiesChanged();
|
||||
}
|
||||
|
||||
private void adjustTargetTools(ITool removed[], ITool allTools[]){
|
||||
private void adjustTargetTools(ITool removed[], ITool added[]){
|
||||
if(!isRoot())
|
||||
return;
|
||||
|
||||
|
@ -1110,22 +1111,30 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
set.addAll(Arrays.asList(ids));
|
||||
|
||||
for(int i = 0; i < removed.length; i++){
|
||||
ITool target = getTargetTool(removed[i]);
|
||||
Object[] tInfo = getTargetTool(removed[i]);
|
||||
|
||||
if(target == null)
|
||||
if(tInfo == null)
|
||||
continue;
|
||||
|
||||
List list = BuildSettingsUtil.calcDependentTools(allTools, target, null);
|
||||
ITool target = (ITool)tInfo[0];
|
||||
String tId = (String)tInfo[1];
|
||||
|
||||
List list = BuildSettingsUtil.calcDependentTools(added, target, null);
|
||||
if(list.size() != 0)
|
||||
continue;
|
||||
|
||||
ITool newTargetTool = findCompatibleTargetTool(target, allTools);
|
||||
if(newTargetTool != null){
|
||||
set.remove(target.getId());
|
||||
ITool newTargetTool = findCompatibleTargetTool(target, added);
|
||||
if(newTargetTool == null)
|
||||
continue;
|
||||
|
||||
newTargetTool = ManagedBuildManager.getExtensionTool(newTargetTool);
|
||||
if(newTargetTool == null)
|
||||
continue;
|
||||
|
||||
set.remove(tId);
|
||||
set.add(newTargetTool.getId());
|
||||
targetToolsModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(targetToolsModified){
|
||||
toolChain.setTargetToolIds(CDataUtil.arrayToString((String[])set.toArray(new String[set.size()]), ";")); //$NON-NLS-1$
|
||||
|
@ -1149,10 +1158,43 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
break;
|
||||
}
|
||||
|
||||
if(compatibleTool == null){
|
||||
//try to match build output variable
|
||||
Set set = getToolOutputVars(tool);
|
||||
for(int i = 0; i < allTools.length; i++){
|
||||
IOutputType types[] = allTools[i].getOutputTypes();
|
||||
for(int k = 0; k < types.length; k++){
|
||||
String var = types[k].getBuildVariable();
|
||||
if(var != null && set.contains(var)){
|
||||
compatibleTool = allTools[i];
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(compatibleTool != null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return compatibleTool;
|
||||
}
|
||||
|
||||
private ITool getTargetTool(ITool tool){
|
||||
private Set getToolOutputVars(ITool tool){
|
||||
Set set = new HashSet();
|
||||
|
||||
IOutputType types[] = tool.getOutputTypes();
|
||||
for(int k = 0; k < types.length; k++){
|
||||
String var = types[k].getBuildVariable();
|
||||
if(var != null)
|
||||
set.add(var);
|
||||
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
private Object[] getTargetTool(ITool tool){
|
||||
String [] ids = toolChain.getTargetToolList();
|
||||
|
||||
for(int i = 0; i < ids.length; i++){
|
||||
|
@ -1163,7 +1205,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
break;
|
||||
}
|
||||
if(target != null)
|
||||
return target;
|
||||
return new Object[]{target, id};
|
||||
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -2119,15 +2119,20 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
* @see org.eclipse.cdt.core.build.managed.ITool#getAnnouncement()
|
||||
*/
|
||||
public String getAnnouncement() {
|
||||
String an = getAnnouncementAttribute();
|
||||
if(an == null){
|
||||
an = ManagedMakeMessages.getResourceString(DEFAULT_ANNOUNCEMENT_PREFIX) +
|
||||
WHITESPACE + getName(); // + "(" + getId() + ")";
|
||||
}
|
||||
return an;
|
||||
}
|
||||
|
||||
public String getAnnouncementAttribute() {
|
||||
if (announcement == null) {
|
||||
if (getSuperClass() != null) {
|
||||
return getSuperClass().getAnnouncement();
|
||||
} else {
|
||||
// Generate the default announcement string for the Tool
|
||||
String defaultAnnouncement = ManagedMakeMessages.getResourceString(DEFAULT_ANNOUNCEMENT_PREFIX) +
|
||||
WHITESPACE + getName(); // + "(" + getId() + ")";
|
||||
return defaultAnnouncement;
|
||||
return ((Tool)getSuperClass()).getAnnouncementAttribute();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return announcement;
|
||||
}
|
||||
|
|
|
@ -2046,9 +2046,23 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
|
||||
}
|
||||
}
|
||||
|
||||
ToolInfoHolder h = getToolInfo(rcInfo.getPath());
|
||||
ITool buildTools[] = h.buildTools;
|
||||
|
||||
// if(tool == null){
|
||||
// for (int j=0; j<buildTools.length; j++) {
|
||||
// if (buildTools[j].buildsFileType(ext)) {
|
||||
// if (tool == null) {
|
||||
// tool = buildTools[j];
|
||||
// }
|
||||
// addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(tool == null && rcInfo.getPath().segmentCount() != 0){
|
||||
if(tool == null){
|
||||
h = getToolInfo(Path.EMPTY);
|
||||
buildTools = h.buildTools;
|
||||
|
|
Loading…
Add table
Reference in a new issue