mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 08:15:48 +02:00
cleanup: java generics, no functionality changes
This commit is contained in:
parent
d58c6da529
commit
241396290b
1 changed files with 105 additions and 134 deletions
|
@ -15,14 +15,13 @@ import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -100,14 +99,14 @@ public class BuildDescription implements IBuildDescription {
|
||||||
private IResourceDelta fDelta;
|
private IResourceDelta fDelta;
|
||||||
private IConfigurationBuildState fBuildState;
|
private IConfigurationBuildState fBuildState;
|
||||||
|
|
||||||
private Map fToolToMultiStepMap = new HashMap();
|
private Map<ITool, BuildStep> fToolToMultiStepMap = new HashMap<ITool, BuildStep>();
|
||||||
private BuildStep fOrderedMultiActions[];
|
private BuildStep fOrderedMultiActions[];
|
||||||
|
|
||||||
private Map fLocationToRcMap = new HashMap();
|
private Map<IPath, BuildResource> fLocationToRcMap = new HashMap<IPath, BuildResource>();
|
||||||
|
|
||||||
private Map fVarToAddlInSetMap = new HashMap();
|
private Map<String, Set<BuildIOType>> fVarToAddlInSetMap = new HashMap<String, Set<BuildIOType>>();
|
||||||
|
|
||||||
private List fStepList = new ArrayList();
|
private List<BuildStep> fStepList = new ArrayList<BuildStep>();
|
||||||
|
|
||||||
private BuildStep fTargetStep;
|
private BuildStep fTargetStep;
|
||||||
|
|
||||||
|
@ -121,15 +120,15 @@ public class BuildDescription implements IBuildDescription {
|
||||||
private BuildStep fInputStep;
|
private BuildStep fInputStep;
|
||||||
private BuildStep fOutputStep;
|
private BuildStep fOutputStep;
|
||||||
|
|
||||||
private Map fToolOrderMap = new HashMap();
|
private Map<String, ToolOrderEstimation> fToolOrderMap = new HashMap<String, ToolOrderEstimation>();
|
||||||
private Set fToolInProcesSet = new HashSet();
|
private Set<ITool> fToolInProcesSet = new HashSet<ITool>();
|
||||||
private ITool fOrderedTools[];
|
private ITool fOrderedTools[];
|
||||||
|
|
||||||
private ICSourceEntry[] fSourceEntries;
|
private ICSourceEntry[] fSourceEntries;
|
||||||
|
|
||||||
// private Map fExtToToolAndTypeListMap = new HashMap();
|
// private Map fExtToToolAndTypeListMap = new HashMap();
|
||||||
|
|
||||||
private Map fEnvironment;
|
private Map<String, String> fEnvironment;
|
||||||
|
|
||||||
private PDOMDependencyGenerator fPdomDepGen;
|
private PDOMDependencyGenerator fPdomDepGen;
|
||||||
|
|
||||||
|
@ -138,8 +137,8 @@ public class BuildDescription implements IBuildDescription {
|
||||||
private BuildStep fCleanStep;
|
private BuildStep fCleanStep;
|
||||||
|
|
||||||
private class ToolInfoHolder {
|
private class ToolInfoHolder {
|
||||||
Map fExtToToolAndTypeListMap;
|
Map<String, List<ToolAndType>> fExtToToolAndTypeListMap;
|
||||||
Map fInTypeToGroupMap = new HashMap();
|
Map<String, BuildGroup> fInTypeToGroupMap = new HashMap<String, BuildGroup>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ToolAndType{
|
class ToolAndType{
|
||||||
|
@ -273,29 +272,29 @@ public class BuildDescription implements IBuildDescription {
|
||||||
return rcLocation;
|
return rcLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StepCollector implements IStepVisitor{
|
// private class StepCollector implements IStepVisitor{
|
||||||
private Set fStepSet = new HashSet();
|
// private Set<IBuildStep> fStepSet = new HashSet<IBuildStep>();
|
||||||
|
//
|
||||||
public int visit(IBuildStep action) throws CoreException {
|
// public int visit(IBuildStep action) throws CoreException {
|
||||||
if(DbgUtil.DEBUG){
|
// if(DbgUtil.DEBUG){
|
||||||
DbgUtil.trace("StepCollector: visiting step " + DbgUtil.stepName(action)); //$NON-NLS-1$
|
// DbgUtil.trace("StepCollector: visiting step " + DbgUtil.stepName(action)); //$NON-NLS-1$
|
||||||
}
|
// }
|
||||||
fStepSet.add(action);
|
// fStepSet.add(action);
|
||||||
return VISIT_CONTINUE;
|
// return VISIT_CONTINUE;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public BuildStep[] getSteps(){
|
// public BuildStep[] getSteps(){
|
||||||
return (BuildStep[])fStepSet.toArray(new BuildStep[fStepSet.size()]);
|
// return (BuildStep[])fStepSet.toArray(new BuildStep[fStepSet.size()]);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Set getStepSet(){
|
// public Set getStepSet(){
|
||||||
return fStepSet;
|
// return fStepSet;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void clear(){
|
// public void clear(){
|
||||||
fStepSet.clear();
|
// fStepSet.clear();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private class RebuildStateSynchronizer implements IStepVisitor{
|
private class RebuildStateSynchronizer implements IStepVisitor{
|
||||||
|
|
||||||
|
@ -397,9 +396,9 @@ public class BuildDescription implements IBuildDescription {
|
||||||
fTool = tool;
|
fTool = tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITool getTool(){
|
// ITool getTool(){
|
||||||
return fTool;
|
// return fTool;
|
||||||
}
|
// }
|
||||||
|
|
||||||
ITool[] getDeps(){
|
ITool[] getDeps(){
|
||||||
if(fDeps == null)
|
if(fDeps == null)
|
||||||
|
@ -413,13 +412,13 @@ public class BuildDescription implements IBuildDescription {
|
||||||
return fConsumers;
|
return fConsumers;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean dependsOn(ITool tool){
|
// boolean dependsOn(ITool tool){
|
||||||
return indexOf(tool, getDeps()) != -1;
|
// return indexOf(tool, getDeps()) != -1;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
boolean hasConsumer(ITool tool){
|
// boolean hasConsumer(ITool tool){
|
||||||
return indexOf(tool, getConsumers()) != -1;
|
// return indexOf(tool, getConsumers()) != -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,8 +465,8 @@ public class BuildDescription implements IBuildDescription {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map initToolAndTypeMap(IFolderInfo foInfo){
|
private Map<String, List<ToolAndType>> initToolAndTypeMap(IFolderInfo foInfo){
|
||||||
Map extToToolAndTypeListMap = new HashMap();
|
Map<String, List<ToolAndType>> extToToolAndTypeListMap = new HashMap<String, List<ToolAndType>>();
|
||||||
ITool tools[] = foInfo.getFilteredTools();
|
ITool tools[] = foInfo.getFilteredTools();
|
||||||
for(int i = 0; i < tools.length; i++){
|
for(int i = 0; i < tools.length; i++){
|
||||||
ITool tool = tools[i];
|
ITool tool = tools[i];
|
||||||
|
@ -479,9 +478,9 @@ public class BuildDescription implements IBuildDescription {
|
||||||
for(int k = 0; k < exts.length; k++){
|
for(int k = 0; k < exts.length; k++){
|
||||||
String ext = exts[k];
|
String ext = exts[k];
|
||||||
if(tool.buildsFileType(ext)){
|
if(tool.buildsFileType(ext)){
|
||||||
List list = (List)extToToolAndTypeListMap.get(ext);
|
List<ToolAndType> list = extToToolAndTypeListMap.get(ext);
|
||||||
if(list == null){
|
if(list == null){
|
||||||
list = new ArrayList();
|
list = new ArrayList<ToolAndType>();
|
||||||
extToToolAndTypeListMap.put(ext, list);
|
extToToolAndTypeListMap.put(ext, list);
|
||||||
}
|
}
|
||||||
list.add(new ToolAndType(tool, type, ext));
|
list.add(new ToolAndType(tool, type, ext));
|
||||||
|
@ -493,9 +492,9 @@ public class BuildDescription implements IBuildDescription {
|
||||||
for(int k = 0; k < exts.length; k++){
|
for(int k = 0; k < exts.length; k++){
|
||||||
String ext = exts[k];
|
String ext = exts[k];
|
||||||
if(tool.buildsFileType(ext)){
|
if(tool.buildsFileType(ext)){
|
||||||
List list = (List)extToToolAndTypeListMap.get(ext);
|
List<ToolAndType> list = extToToolAndTypeListMap.get(ext);
|
||||||
if(list == null){
|
if(list == null){
|
||||||
list = new ArrayList();
|
list = new ArrayList<ToolAndType>();
|
||||||
extToToolAndTypeListMap.put(ext, list);
|
extToToolAndTypeListMap.put(ext, list);
|
||||||
}
|
}
|
||||||
list.add(new ToolAndType(tool, null, ext));
|
list.add(new ToolAndType(tool, null, ext));
|
||||||
|
@ -516,14 +515,11 @@ public class BuildDescription implements IBuildDescription {
|
||||||
BuildIOType arg = (BuildIOType)rc.getProducerIOType();
|
BuildIOType arg = (BuildIOType)rc.getProducerIOType();
|
||||||
String linkId = (checkVar && arg != null) ? arg.getLinkId() : null;
|
String linkId = (checkVar && arg != null) ? arg.getLinkId() : null;
|
||||||
|
|
||||||
for(Iterator iter = h.fExtToToolAndTypeListMap.entrySet().iterator(); iter.hasNext();){
|
for (Entry<String, List<ToolAndType>> entry : h.fExtToToolAndTypeListMap.entrySet()) {
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
String ext = entry.getKey();
|
||||||
String ext = (String)entry.getKey();
|
|
||||||
if(locString.endsWith("." + ext)){ //$NON-NLS-1$
|
if(locString.endsWith("." + ext)){ //$NON-NLS-1$
|
||||||
List list = (List)entry.getValue();
|
List<ToolAndType> list = entry.getValue();
|
||||||
for(Iterator itt = list.iterator(); itt.hasNext();){
|
for (ToolAndType tt : list) {
|
||||||
ToolAndType tt = (ToolAndType)itt.next();
|
|
||||||
|
|
||||||
if(!checkVar)
|
if(!checkVar)
|
||||||
return tt;
|
return tt;
|
||||||
|
|
||||||
|
@ -535,10 +531,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
if(var == null || var.length() == 0)
|
if(var == null || var.length() == 0)
|
||||||
return tt;
|
return tt;
|
||||||
|
|
||||||
if(linkId == null){
|
if(linkId != null && linkId.equals(var)){
|
||||||
if(var == null || var.length() == 0)
|
|
||||||
return tt;
|
|
||||||
} else if(linkId.equals(var)){
|
|
||||||
return tt;
|
return tt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +675,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(inputType != null ? inputType.getMultipleOfType() : tool == fCfg.calculateTargetTool()){
|
if(inputType != null ? inputType.getMultipleOfType() : tool == fCfg.calculateTargetTool()){
|
||||||
BuildStep step = (BuildStep)fToolToMultiStepMap.get(tool);
|
BuildStep step = fToolToMultiStepMap.get(tool);
|
||||||
|
|
||||||
if(step != null){
|
if(step != null){
|
||||||
BuildIOType argument = step.getIOTypeForType(inputType, true);
|
BuildIOType argument = step.getIOTypeForType(inputType, true);
|
||||||
|
@ -692,7 +685,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
argument.addResource(rc);
|
argument.addResource(rc);
|
||||||
|
|
||||||
if(inputActionArg == null){
|
if(inputActionArg == null){
|
||||||
inputActionArg = findTypeForExtension(inputAction,false,rc.getLocation().getFileExtension());;
|
inputActionArg = findTypeForExtension(inputAction,false,rc.getLocation().getFileExtension());
|
||||||
if(inputActionArg == null)
|
if(inputActionArg == null)
|
||||||
inputActionArg = inputAction.createIOType(false, false, null);
|
inputActionArg = inputAction.createIOType(false, false, null);
|
||||||
inputActionArg.addResource(rc);
|
inputActionArg.addResource(rc);
|
||||||
|
@ -708,7 +701,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
private BuildGroup createGroup(ToolInfoHolder h, IInputType inType, String ext){
|
private BuildGroup createGroup(ToolInfoHolder h, IInputType inType, String ext){
|
||||||
String key = inType != null ?
|
String key = inType != null ?
|
||||||
inType.getId() : "ext:"+ext; //$NON-NLS-1$
|
inType.getId() : "ext:"+ext; //$NON-NLS-1$
|
||||||
BuildGroup group = (BuildGroup)h.fInTypeToGroupMap.get(key);
|
BuildGroup group = h.fInTypeToGroupMap.get(key);
|
||||||
if(group == null){
|
if(group == null){
|
||||||
group = new BuildGroup();
|
group = new BuildGroup();
|
||||||
h.fInTypeToGroupMap.put(key, group);
|
h.fInTypeToGroupMap.put(key, group);
|
||||||
|
@ -897,7 +890,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
ITool orderedTools[] = getOrderedTools();
|
ITool orderedTools[] = getOrderedTools();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(int i = 0; i < orderedTools.length; i++){
|
for(int i = 0; i < orderedTools.length; i++){
|
||||||
BuildStep action = (BuildStep)fToolToMultiStepMap.get(orderedTools[i]);
|
BuildStep action = fToolToMultiStepMap.get(orderedTools[i]);
|
||||||
if(action != null)
|
if(action != null)
|
||||||
fOrderedMultiActions[index++] = action;
|
fOrderedMultiActions[index++] = action;
|
||||||
}
|
}
|
||||||
|
@ -941,12 +934,10 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
}while(foundUnused);
|
}while(foundUnused);
|
||||||
|
|
||||||
Set set = fLocationToRcMap.entrySet();
|
Set<Entry<IPath,BuildResource>> set = fLocationToRcMap.entrySet();
|
||||||
List list = new ArrayList();
|
List<BuildResource> list = new ArrayList<BuildResource>();
|
||||||
for(Iterator iter = set.iterator();iter.hasNext();){
|
for (Entry<IPath, BuildResource> entry : set) {
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
BuildResource rc = entry.getValue();
|
||||||
|
|
||||||
BuildResource rc = (BuildResource)entry.getValue();
|
|
||||||
boolean doRemove = false;
|
boolean doRemove = false;
|
||||||
BuildIOType producerArg = (BuildIOType)rc.getProducerIOType();
|
BuildIOType producerArg = (BuildIOType)rc.getProducerIOType();
|
||||||
if(producerArg == null){
|
if(producerArg == null){
|
||||||
|
@ -967,8 +958,8 @@ public class BuildDescription implements IBuildDescription {
|
||||||
list.add(rc);
|
list.add(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Iterator iter = list.iterator(); iter.hasNext();){
|
for (BuildResource buildResource : list) {
|
||||||
BuildIOType[][] types = removeResource((BuildResource)iter.next());
|
BuildIOType[][] types = removeResource(buildResource);
|
||||||
|
|
||||||
BuildIOType producer = types[0][0];
|
BuildIOType producer = types[0][0];
|
||||||
if(producer != null && producer.getResources().length == 0){
|
if(producer != null && producer.getResources().length == 0){
|
||||||
|
@ -1025,7 +1016,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
|
|
||||||
private BuildResource[] addOutputs(IPath paths[], BuildIOType buildArg, IPath outDirPath){
|
private BuildResource[] addOutputs(IPath paths[], BuildIOType buildArg, IPath outDirPath){
|
||||||
if(paths != null){
|
if(paths != null){
|
||||||
List list = new ArrayList();
|
List<BuildResource> list = new ArrayList<BuildResource>();
|
||||||
for(int k = 0; k < paths.length; k++){
|
for(int k = 0; k < paths.length; k++){
|
||||||
IPath outFullPath = paths[k];
|
IPath outFullPath = paths[k];
|
||||||
IPath outWorkspacePath = paths[k];
|
IPath outWorkspacePath = paths[k];
|
||||||
|
@ -1059,7 +1050,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
outFullPath = projLocation.append(outDirPath.removeFirstSegments(1).append(outFullPath.lastSegment()));
|
outFullPath = projLocation.append(outDirPath.removeFirstSegments(1).append(outFullPath.lastSegment()));
|
||||||
outWorkspacePath = fProject.getFullPath().append(outProjPath);;
|
outWorkspacePath = fProject.getFullPath().append(outProjPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,7 +1059,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
buildArg.addResource(outRc);
|
buildArg.addResource(outRc);
|
||||||
|
|
||||||
}
|
}
|
||||||
return (BuildResource[])list.toArray(new BuildResource[list.size()]);
|
return list.toArray(new BuildResource[list.size()]);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1194,13 +1185,11 @@ public class BuildDescription implements IBuildDescription {
|
||||||
config = (IConfiguration) toolParent;
|
config = (IConfiguration) toolParent;
|
||||||
else if (toolParent instanceof IToolChain) {
|
else if (toolParent instanceof IToolChain) {
|
||||||
// must be a toolchain
|
// must be a toolchain
|
||||||
config = (IConfiguration) ((IToolChain) toolParent)
|
config = ((IToolChain) toolParent).getParent();
|
||||||
.getParent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (toolParent instanceof IResourceConfiguration) {
|
else if (toolParent instanceof IResourceConfiguration) {
|
||||||
config = (IConfiguration) ((IResourceConfiguration) toolParent)
|
config = ((IResourceConfiguration) toolParent).getParent();
|
||||||
.getParent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -1279,7 +1268,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
optType == IOption.UNDEF_LIBRARY_PATHS ||
|
optType == IOption.UNDEF_LIBRARY_PATHS ||
|
||||||
optType == IOption.UNDEF_LIBRARY_FILES ||
|
optType == IOption.UNDEF_LIBRARY_FILES ||
|
||||||
optType == IOption.UNDEF_MACRO_FILES) {
|
optType == IOption.UNDEF_MACRO_FILES) {
|
||||||
List outputList = (List)option.getValue();
|
List<String> outputList = (List<String>)option.getValue();
|
||||||
// Add outputPrefix to each if necessary
|
// Add outputPrefix to each if necessary
|
||||||
if(outputList != null && outputList.size() > 0){
|
if(outputList != null && outputList.size() > 0){
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -1287,7 +1276,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
pathStrings = ManagedBuildManager
|
pathStrings = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveStringListValues(
|
.resolveStringListValues(
|
||||||
(String[])outputList.toArray(new String[outputList.size()]),
|
outputList.toArray(new String[outputList.size()]),
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
|
@ -1385,9 +1374,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
|
|
||||||
|
|
||||||
if(paths != null){
|
if(paths != null){
|
||||||
if(buildArg == null)
|
buildArg = action.createIOType(false, primaryOutput, type);
|
||||||
buildArg = action.createIOType(false, primaryOutput, type);
|
|
||||||
|
|
||||||
addOutputs(paths, buildArg, outDirPath);
|
addOutputs(paths, buildArg, outDirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1416,7 +1403,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(checkFlags(BuildDescriptionManager.DEPFILES)){
|
if(checkFlags(BuildDescriptionManager.DEPFILES)){
|
||||||
if(tool != null && buildRc != null){
|
if(buildRc != null){
|
||||||
IInputType type = action.getInputType();
|
IInputType type = action.getInputType();
|
||||||
String ext = null;
|
String ext = null;
|
||||||
if(type != null){
|
if(type != null){
|
||||||
|
@ -1502,36 +1489,26 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuildResource getBuildResource(IPath location) {
|
public IBuildResource getBuildResource(IPath location) {
|
||||||
return (BuildResource)fLocationToRcMap.get(location);
|
return fLocationToRcMap.get(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getResources()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getResources()
|
||||||
*/
|
*/
|
||||||
public IBuildResource[] getResources(){
|
public IBuildResource[] getResources(){
|
||||||
Collection c = fLocationToRcMap.values();
|
return fLocationToRcMap.values().toArray(new IBuildResource[0]);
|
||||||
List list = new ArrayList();
|
|
||||||
for(Iterator iter = c.iterator();iter.hasNext();){
|
|
||||||
Object obj = iter.next();
|
|
||||||
|
|
||||||
if(obj instanceof BuildResource)
|
|
||||||
list.add(obj);
|
|
||||||
else if(obj instanceof List)
|
|
||||||
list.addAll((List)obj);
|
|
||||||
}
|
|
||||||
return (IBuildResource[])list.toArray(new IBuildResource[list.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuildResource[] getResources(boolean generated){
|
public IBuildResource[] getResources(boolean generated){
|
||||||
IBuildResource[] rcs = getResources();
|
IBuildResource[] rcs = getResources();
|
||||||
List list = new ArrayList();
|
List<IBuildResource> list = new ArrayList<IBuildResource>();
|
||||||
for(int i = 0; i < rcs.length; i++){
|
for(int i = 0; i < rcs.length; i++){
|
||||||
IBuildResource rc = rcs[i];
|
IBuildResource rc = rcs[i];
|
||||||
if(generated == (rc.getProducerStep() != fInputStep))
|
if(generated == (rc.getProducerStep() != fInputStep))
|
||||||
list.add(rc);
|
list.add(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IBuildResource[])list.toArray(new IBuildResource[list.size()]);
|
return list.toArray(new IBuildResource[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1541,15 +1518,15 @@ public class BuildDescription implements IBuildDescription {
|
||||||
return fCfg;
|
return fCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getEnvironment(){
|
public Map<String, String> getEnvironment(){
|
||||||
if(fEnvironment == null)
|
if(fEnvironment == null)
|
||||||
fEnvironment = calculateEnvironment();
|
fEnvironment = calculateEnvironment();
|
||||||
return fEnvironment;
|
return fEnvironment;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map calculateEnvironment(){
|
protected Map<String, String> calculateEnvironment(){
|
||||||
IBuildEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(fCfg,true,true);
|
IBuildEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(fCfg,true,true);
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
|
||||||
for(int i = 0; i < variables.length; i++){
|
for(int i = 0; i < variables.length; i++){
|
||||||
IBuildEnvironmentVariable var = variables[i];
|
IBuildEnvironmentVariable var = variables[i];
|
||||||
|
@ -1577,7 +1554,6 @@ public class BuildDescription implements IBuildDescription {
|
||||||
if (inTypes != null && inTypes.length > 0) {
|
if (inTypes != null && inTypes.length > 0) {
|
||||||
for (int i=0; i<inTypes.length; i++) {
|
for (int i=0; i<inTypes.length; i++) {
|
||||||
IInputType type = inTypes[i];
|
IInputType type = inTypes[i];
|
||||||
String variable = type.getBuildVariable();
|
|
||||||
boolean primaryInput = type.getPrimaryInput();
|
boolean primaryInput = type.getPrimaryInput();
|
||||||
IOption option = tool.getOptionBySuperClassId(type.getOptionId());
|
IOption option = tool.getOptionBySuperClassId(type.getOptionId());
|
||||||
BuildIOType arg = step.getIOTypeForType(type, true);
|
BuildIOType arg = step.getIOTypeForType(type, true);
|
||||||
|
@ -1585,7 +1561,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
// Option?
|
// Option?
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
try {
|
try {
|
||||||
List inputs = new ArrayList();
|
List<String> inputs = new ArrayList<String>();
|
||||||
int optType = option.getValueType();
|
int optType = option.getValueType();
|
||||||
if (optType == IOption.STRING) {
|
if (optType == IOption.STRING) {
|
||||||
inputs.add(option.getStringValue());
|
inputs.add(option.getStringValue());
|
||||||
|
@ -1604,10 +1580,10 @@ public class BuildDescription implements IBuildDescription {
|
||||||
optType == IOption.UNDEF_LIBRARY_FILES ||
|
optType == IOption.UNDEF_LIBRARY_FILES ||
|
||||||
optType == IOption.UNDEF_MACRO_FILES
|
optType == IOption.UNDEF_MACRO_FILES
|
||||||
) {
|
) {
|
||||||
inputs = (List)option.getValue();
|
inputs = (List<String>)option.getValue();
|
||||||
}
|
}
|
||||||
for (int j=0; j<inputs.size(); j++) {
|
for (int j=0; j<inputs.size(); j++) {
|
||||||
String inputName = ((String)inputs.get(j)).trim();
|
String inputName = inputs.get(j).trim();
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1685,15 +1661,14 @@ public class BuildDescription implements IBuildDescription {
|
||||||
if(arg == null)
|
if(arg == null)
|
||||||
arg = step.createIOType(true, primaryInput, type);
|
arg = step.createIOType(true, primaryInput, type);
|
||||||
|
|
||||||
Set set = (Set)fVarToAddlInSetMap.get(var);
|
Set<BuildIOType> set = fVarToAddlInSetMap.get(var);
|
||||||
if(set == null){
|
if(set == null){
|
||||||
set = new HashSet();
|
set = new HashSet<BuildIOType>();
|
||||||
fVarToAddlInSetMap.put(var, set);
|
fVarToAddlInSetMap.put(var, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(set.add(arg)){
|
if(set.add(arg)){
|
||||||
for(Iterator iter = fLocationToRcMap.values().iterator(); iter.hasNext();){
|
for (BuildResource rc : fLocationToRcMap.values()) {
|
||||||
BuildResource rc = (BuildResource)iter.next();
|
|
||||||
BuildIOType t = (BuildIOType)rc.getProducerIOType();
|
BuildIOType t = (BuildIOType)rc.getProducerIOType();
|
||||||
if(t != null && var.equals(t.getLinkId()))
|
if(t != null && var.equals(t.getLinkId()))
|
||||||
arg.addResource(rc);
|
arg.addResource(rc);
|
||||||
|
@ -1718,7 +1693,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
|
|
||||||
private void calculateDeps(BuildStep step){
|
private void calculateDeps(BuildStep step){
|
||||||
BuildResource rcs[] = (BuildResource[])step.getInputResources();
|
BuildResource rcs[] = (BuildResource[])step.getInputResources();
|
||||||
Set depSet = new HashSet();
|
Set<IPath> depSet = new HashSet<IPath>();
|
||||||
|
|
||||||
for(int i = 0; i < rcs.length; i++){
|
for(int i = 0; i < rcs.length; i++){
|
||||||
IManagedDependencyCalculator depCalc = getDependencyCalculator(step, rcs[i]);
|
IManagedDependencyCalculator depCalc = getDependencyCalculator(step, rcs[i]);
|
||||||
|
@ -1733,8 +1708,8 @@ public class BuildDescription implements IBuildDescription {
|
||||||
if(depSet.size() > 0){
|
if(depSet.size() > 0){
|
||||||
BuildIOType ioType = step.createIOType(true, false, null);
|
BuildIOType ioType = step.createIOType(true, false, null);
|
||||||
|
|
||||||
for(Iterator iter = depSet.iterator(); iter.hasNext();){
|
for (IPath path : depSet) {
|
||||||
addInput((IPath)iter.next(), ioType);
|
addInput(path, ioType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1843,7 +1818,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getLibs(BuildStep step) {
|
public String[] getLibs(BuildStep step) {
|
||||||
Vector libs = new Vector();
|
Vector<String> libs = new Vector<String>();
|
||||||
ITool tool = step.getLibTool();
|
ITool tool = step.getLibTool();
|
||||||
|
|
||||||
if(tool != null){
|
if(tool != null){
|
||||||
|
@ -1891,11 +1866,11 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (String[])libs.toArray(new String[libs.size()]);
|
return libs.toArray(new String[libs.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getUserObjs(BuildStep step) {
|
public String[] getUserObjs(BuildStep step) {
|
||||||
Vector objs = new Vector();
|
Vector<String> objs = new Vector<String>();
|
||||||
ITool tool = fCfg.calculateTargetTool();
|
ITool tool = fCfg.calculateTargetTool();
|
||||||
if(tool == null)
|
if(tool == null)
|
||||||
tool = step.getTool();
|
tool = step.getTool();
|
||||||
|
@ -1932,7 +1907,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (String[])objs.toArray(new String[objs.size()]);
|
return objs.toArray(new String[objs.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BuildResource addInput(String path, BuildIOType buildArg){
|
private BuildResource addInput(String path, BuildIOType buildArg){
|
||||||
|
@ -1970,7 +1945,6 @@ public class BuildDescription implements IBuildDescription {
|
||||||
inFullPath = fProject.getFullPath().append(inLocation.removeFirstSegments(getProjectLocation().segmentCount()));
|
inFullPath = fProject.getFullPath().append(inLocation.removeFirstSegments(getProjectLocation().segmentCount()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IPath projPath = inFullPath;
|
|
||||||
inFullPath = fProject.getFullPath().append(inFullPath);
|
inFullPath = fProject.getFullPath().append(inFullPath);
|
||||||
|
|
||||||
IResource res = ResourcesPlugin.getWorkspace().getRoot().getFile(inFullPath);//.findMember(inFullPath);
|
IResource res = ResourcesPlugin.getWorkspace().getRoot().getFile(inFullPath);//.findMember(inFullPath);
|
||||||
|
@ -2065,9 +2039,9 @@ public class BuildDescription implements IBuildDescription {
|
||||||
return fOrderedTools;
|
return fOrderedTools;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int indexOf(Object obj, Object array[]){
|
// private int indexOf(Object obj, Object array[]){
|
||||||
return indexOf(obj, array, 0, -1);
|
// return indexOf(obj, array, 0, -1);
|
||||||
}
|
// }
|
||||||
|
|
||||||
private int indexOf(Object obj, Object array[], int start, int stop){
|
private int indexOf(Object obj, Object array[], int start, int stop){
|
||||||
if(start < 0)
|
if(start < 0)
|
||||||
|
@ -2085,7 +2059,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToolOrderEstimation getToolOrder(ITool tool){
|
private ToolOrderEstimation getToolOrder(ITool tool){
|
||||||
ToolOrderEstimation order = (ToolOrderEstimation)fToolOrderMap.get(tool.getId());
|
ToolOrderEstimation order = fToolOrderMap.get(tool.getId());
|
||||||
if(order == null){
|
if(order == null){
|
||||||
order = new ToolOrderEstimation(tool);
|
order = new ToolOrderEstimation(tool);
|
||||||
fToolOrderMap.put(tool.getId(), order);
|
fToolOrderMap.put(tool.getId(), order);
|
||||||
|
@ -2104,7 +2078,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
String exts[] = tool.getAllInputExtensions();
|
String exts[] = tool.getAllInputExtensions();
|
||||||
|
|
||||||
ITool tools[] = fCfg.getFilteredTools();
|
ITool tools[] = fCfg.getFilteredTools();
|
||||||
Set set = new HashSet();
|
Set<ITool> set = new HashSet<ITool>();
|
||||||
for(int i = 0; i < tools.length; i++){
|
for(int i = 0; i < tools.length; i++){
|
||||||
ITool t = tools[i];
|
ITool t = tools[i];
|
||||||
if(t == tool)
|
if(t == tool)
|
||||||
|
@ -2136,7 +2110,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
fToolInProcesSet.remove(tool);
|
fToolInProcesSet.remove(tool);
|
||||||
return (ITool[])set.toArray(new ITool[set.size()]);
|
return set.toArray(new ITool[set.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ITool[] doCalcConsumers(ITool tool){
|
private ITool[] doCalcConsumers(ITool tool){
|
||||||
|
@ -2150,7 +2124,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
String exts[] = tool.getAllOutputExtensions();
|
String exts[] = tool.getAllOutputExtensions();
|
||||||
|
|
||||||
ITool tools[] = fCfg.getFilteredTools();
|
ITool tools[] = fCfg.getFilteredTools();
|
||||||
Set set = new HashSet();
|
Set<ITool> set = new HashSet<ITool>();
|
||||||
for(int i = 0; i < tools.length; i++){
|
for(int i = 0; i < tools.length; i++){
|
||||||
ITool t = tools[i];
|
ITool t = tools[i];
|
||||||
if(t == tool)
|
if(t == tool)
|
||||||
|
@ -2182,7 +2156,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
fToolInProcesSet.remove(tool);
|
fToolInProcesSet.remove(tool);
|
||||||
return (ITool[])set.toArray(new ITool[set.size()]);
|
return set.toArray(new ITool[set.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath[] getGeneratedPaths(){
|
private IPath[] getGeneratedPaths(){
|
||||||
|
@ -2250,12 +2224,9 @@ public class BuildDescription implements IBuildDescription {
|
||||||
if(var == null)
|
if(var == null)
|
||||||
var = new String();
|
var = new String();
|
||||||
|
|
||||||
Set set = (Set)fVarToAddlInSetMap.get(var);
|
Set<BuildIOType> set = fVarToAddlInSetMap.get(var);
|
||||||
if(set != null){
|
for (BuildIOType t : set) {
|
||||||
for(Iterator iter = set.iterator(); iter.hasNext();){
|
t.addResource(rc);
|
||||||
BuildIOType t = (BuildIOType)iter.next();
|
|
||||||
t.addResource(rc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2268,7 +2239,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getSteps()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getSteps()
|
||||||
*/
|
*/
|
||||||
public IBuildStep[] getSteps() {
|
public IBuildStep[] getSteps() {
|
||||||
return (BuildStep[])fStepList.toArray(new BuildStep[fStepList.size()]);
|
return fStepList.toArray(new BuildStep[fStepList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue