1
0
Fork 0
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:
Mikhail Sennikovsky 2007-06-08 10:24:42 +00:00
parent e2330794b8
commit 31841a2ffe
9 changed files with 167 additions and 36 deletions

View file

@ -6708,7 +6708,7 @@
</managedBuildRevision> </managedBuildRevision>
<tool <tool
natureFilter="cnature" natureFilter="cnature"
name="%ToolName.linker.gnu.c" name="Test 4.0 ToolName.linker.gnu.c"
outputFlag="-o" outputFlag="-o"
isSystem="true" isSystem="true"
command="gcc" command="gcc"
@ -6727,12 +6727,12 @@
<optionCategory <optionCategory
owner="test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker" 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"> id="test.gnu.c.link.category.general">
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="%Option.Posix.Linker.NoStartFiles" name="Test 4.0 Option.Posix.Linker.NoStartFiles"
category="test.gnu.c.link.category.general" category="test.gnu.c.link.category.general"
command="-nostartfiles" command="-nostartfiles"
id="test.gnu.c.link.option.nostart" id="test.gnu.c.link.option.nostart"
@ -6740,7 +6740,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="%Option.Posix.Linker.NoDefLibs" name="Test 4.0 Option.Posix.Linker.NoDefLibs"
category="test.gnu.c.link.category.general" category="test.gnu.c.link.category.general"
command="-nodefaultlibs" command="-nodefaultlibs"
id="test.gnu.c.link.option.nodeflibs" id="test.gnu.c.link.option.nodeflibs"
@ -6748,7 +6748,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="%Option.Posix.Linker.NoStdLibs" name="Test 4.0 Option.Posix.Linker.NoStdLibs"
category="test.gnu.c.link.category.general" category="test.gnu.c.link.category.general"
command="-nostdlib" command="-nostdlib"
id="test.gnu.c.link.option.nostdlibs" id="test.gnu.c.link.option.nostdlibs"
@ -6756,7 +6756,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="%Option.Posix.Linker.Strip" name="Test 4.0 Option.Posix.Linker.Strip"
category="test.gnu.c.link.category.general" category="test.gnu.c.link.category.general"
command="-s" command="-s"
id="test.gnu.c.link.option.strip" id="test.gnu.c.link.option.strip"
@ -6764,7 +6764,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="%Option.Posix.Linker.Static" name="Test 4.0 Option.Posix.Linker.Static"
category="test.gnu.c.link.category.general" category="test.gnu.c.link.category.general"
command="-static" command="-static"
id="test.gnu.c.link.option.noshared" id="test.gnu.c.link.option.noshared"
@ -6772,11 +6772,11 @@
</option> </option>
<optionCategory <optionCategory
owner="test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker" 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"> id="test.gnu.c.link.category.libs">
</optionCategory> </optionCategory>
<option <option
name="%Option.Posix.Libs" name="Test 4.0 Option.Posix.Libs"
category="test.gnu.c.link.category.libs" category="test.gnu.c.link.category.libs"
command="-l" command="-l"
id="test.gnu.c.link.option.libs" id="test.gnu.c.link.option.libs"
@ -6784,7 +6784,7 @@
valueType="libs"> valueType="libs">
</option> </option>
<option <option
name="%Option.Posix.Libsearch" name="Test 4.0 Option.Posix.Libsearch"
category="test.gnu.c.link.category.libs" category="test.gnu.c.link.category.libs"
command="-L" command="-L"
id="test.gnu.c.link.option.paths" id="test.gnu.c.link.option.paths"
@ -6793,17 +6793,17 @@
</option> </option>
<optionCategory <optionCategory
owner="test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker" 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"> id="test.gnu.c.link.category.other">
</optionCategory> </optionCategory>
<option <option
name="%Option.Posix.Linker.Flags" name="Test 4.0 Option.Posix.Linker.Flags"
category="test.gnu.c.link.category.other" category="test.gnu.c.link.category.other"
valueType="string" valueType="string"
id="test.gnu.c.link.option.ldflags"> id="test.gnu.c.link.option.ldflags">
</option> </option>
<option <option
name="%Option.Posix.Linker.XLinker" name="Test 4.0 Option.Posix.Linker.XLinker"
category="test.gnu.c.link.category.other" category="test.gnu.c.link.category.other"
command="-Xlinker ${VALUE}" command="-Xlinker ${VALUE}"
valueType="stringList" valueType="stringList"
@ -8348,7 +8348,7 @@
archList="all" archList="all"
osList="win32" osList="win32"
name="Test 4.0 ToolChainName.Cygwin" 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" isSystem="true"
id="test.four.dot.zero.cdt.managedbuild.toolchain.gnu.cygwin.base"> id="test.four.dot.zero.cdt.managedbuild.toolchain.gnu.cygwin.base">
<targetPlatform <targetPlatform
@ -8809,7 +8809,7 @@
</toolChain> </toolChain>
</configuration> </configuration>
</projectType> </projectType>
</extension> </extension>

View file

@ -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();
}
}

View file

@ -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(){
//
// }
}

View file

@ -41,6 +41,7 @@ import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IManagedProject; import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IModificationStatus; import org.eclipse.cdt.managedbuilder.core.IModificationStatus;
import org.eclipse.cdt.managedbuilder.core.IOption; 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.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform; import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
@ -1095,12 +1096,12 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
toolChain.addTool((Tool)added[i]); toolChain.addTool((Tool)added[i]);
} }
adjustTargetTools(removed, getTools()); adjustTargetTools(removed, added);
toolChain.propertiesChanged(); toolChain.propertiesChanged();
} }
private void adjustTargetTools(ITool removed[], ITool allTools[]){ private void adjustTargetTools(ITool removed[], ITool added[]){
if(!isRoot()) if(!isRoot())
return; return;
@ -1110,21 +1111,29 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
set.addAll(Arrays.asList(ids)); set.addAll(Arrays.asList(ids));
for(int i = 0; i < removed.length; i++){ 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; 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) if(list.size() != 0)
continue; continue;
ITool newTargetTool = findCompatibleTargetTool(target, allTools); ITool newTargetTool = findCompatibleTargetTool(target, added);
if(newTargetTool != null){ if(newTargetTool == null)
set.remove(target.getId()); continue;
set.add(newTargetTool.getId());
targetToolsModified = true; newTargetTool = ManagedBuildManager.getExtensionTool(newTargetTool);
} if(newTargetTool == null)
continue;
set.remove(tId);
set.add(newTargetTool.getId());
targetToolsModified = true;
} }
if(targetToolsModified){ if(targetToolsModified){
@ -1149,10 +1158,43 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
break; 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; 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(); String [] ids = toolChain.getTargetToolList();
for(int i = 0; i < ids.length; i++){ for(int i = 0; i < ids.length; i++){
@ -1163,7 +1205,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
break; break;
} }
if(target != null) if(target != null)
return target; return new Object[]{target, id};
} }
return null; return null;

View file

@ -2119,15 +2119,20 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
* @see org.eclipse.cdt.core.build.managed.ITool#getAnnouncement() * @see org.eclipse.cdt.core.build.managed.ITool#getAnnouncement()
*/ */
public String 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 (announcement == null) {
if (getSuperClass() != null) { if (getSuperClass() != null) {
return getSuperClass().getAnnouncement(); return ((Tool)getSuperClass()).getAnnouncementAttribute();
} else { }
// Generate the default announcement string for the Tool return null;
String defaultAnnouncement = ManagedMakeMessages.getResourceString(DEFAULT_ANNOUNCEMENT_PREFIX) +
WHITESPACE + getName(); // + "(" + getId() + ")";
return defaultAnnouncement;
}
} }
return announcement; return announcement;
} }

View file

@ -2046,9 +2046,23 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource); addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
} }
} }
ToolInfoHolder h = getToolInfo(rcInfo.getPath()); ToolInfoHolder h = getToolInfo(rcInfo.getPath());
ITool buildTools[] = h.buildTools; 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){ if(tool == null){
h = getToolInfo(Path.EMPTY); h = getToolInfo(Path.EMPTY);
buildTools = h.buildTools; buildTools = h.buildTools;