1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-24 08:44:01 +02:00

formatting, mostly spaces and loops to enhanced

This commit is contained in:
Andrew Gvozdev 2009-07-31 01:54:45 +00:00
parent 7a2e4aeffe
commit 482d0431f3

View file

@ -116,9 +116,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* to avoid a missing target error. * to avoid a missing target error.
*/ */
public class ResourceDeltaVisitor implements IResourceDeltaVisitor { public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
private GnuMakefileGenerator generator; private final GnuMakefileGenerator generator;
// private IManagedBuildInfo info; // private IManagedBuildInfo info;
private IConfiguration config; private final IConfiguration config;
/** /**
* The constructor * The constructor
@ -212,8 +212,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* modules contribute buildable source files. * modules contribute buildable source files.
*/ */
protected class ResourceProxyVisitor implements IResourceProxyVisitor { protected class ResourceProxyVisitor implements IResourceProxyVisitor {
private GnuMakefileGenerator generator; private final GnuMakefileGenerator generator;
private IConfiguration config; private final IConfiguration config;
// private IManagedBuildInfo info; // private IManagedBuildInfo info;
/** /**
@ -360,13 +360,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
private IPath topBuildDir; // Build directory - relative to the workspace private IPath topBuildDir; // Build directory - relative to the workspace
// private Set outputExtensionsSet; // private Set outputExtensionsSet;
// Maps of macro names (String) to values (List) // Maps of macro names (String) to values (List)
private HashMap buildSrcVars = new HashMap(); // Map of source file build variable names private final HashMap buildSrcVars = new HashMap(); // Map of source file build variable names
// to a List of source file Path's // to a List of source file Path's
private HashMap buildOutVars = new HashMap(); // Map of output file build variable names private final HashMap buildOutVars = new HashMap(); // Map of output file build variable names
// to a List of output file Path's // to a List of output file Path's
private HashMap buildDepVars = new HashMap(); // Map of dependency file build variable names private final HashMap buildDepVars = new HashMap(); // Map of dependency file build variable names
// to a List of GnuDependencyGroupInfo objects // to a List of GnuDependencyGroupInfo objects
private LinkedHashMap topBuildOutVars = new LinkedHashMap(); private final LinkedHashMap topBuildOutVars = new LinkedHashMap();
// Dependency file variables // Dependency file variables
// private Vector dependencyMakefiles; // IPath's - relative to the top build directory or absolute // private Vector dependencyMakefiles; // IPath's - relative to the top build directory or absolute
@ -798,8 +798,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
IPath path = resource.getProjectRelativePath(); IPath path = resource.getProjectRelativePath();
//TODO: fix to use builder output dir instead //TODO: fix to use builder output dir instead
String[] configNames = ManagedBuildManager.getBuildInfo(project).getConfigurationNames(); String[] configNames = ManagedBuildManager.getBuildInfo(project).getConfigurationNames();
for (int i = 0; i < configNames.length; i++) { for (String name : configNames) {
String name = configNames[i];
IPath root = new Path(name); IPath root = new Path(name);
// It is if it is a root of the resource pathname // It is if it is a root of the resource pathname
if (root.isPrefixOf(path)) return true; if (root.isPrefixOf(path)) return true;
@ -1016,18 +1015,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Add the libraries this project depends on // Add the libraries this project depends on
valueList = new ArrayList(); valueList = new ArrayList();
String[] libs = config.getLibs(buildTargetExt); String[] libs = config.getLibs(buildTargetExt);
for (int i = 0; i < libs.length; i++) { for (String lib : libs) {
String string = libs[i]; valueList.add(lib);
valueList.add(string);
} }
outputMacros.put("LIBS", valueList); //$NON-NLS-1$ outputMacros.put("LIBS", valueList); //$NON-NLS-1$
// Add the extra user-specified objects // Add the extra user-specified objects
valueList = new ArrayList(); valueList = new ArrayList();
String[] userObjs = config.getUserObjects(buildTargetExt); String[] userObjs = config.getUserObjects(buildTargetExt);
for (int i = 0; i < userObjs.length; i++) { for (String obj : userObjs) {
String string = userObjs[i]; valueList.add(obj);
valueList.add(string);
} }
outputMacros.put("USER_OBJS", valueList); //$NON-NLS-1$ outputMacros.put("USER_OBJS", valueList); //$NON-NLS-1$
@ -1079,14 +1076,14 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
ITool[] buildTools = h.buildTools; ITool[] buildTools = h.buildTools;
HashSet handledInputExtensions = new HashSet(); HashSet handledInputExtensions = new HashSet();
String buildMacro; String buildMacro;
for (int i=0; i<buildTools.length; i++) { for (ITool buildTool : buildTools) {
if(buildTools[i].getCustomBuildStep()) if(buildTool.getCustomBuildStep())
continue; continue;
// Add the known sources macros // Add the known sources macros
String[] extensionsList = buildTools[i].getAllInputExtensions(); String[] extensionsList = buildTool.getAllInputExtensions();
for (int j=0; j<extensionsList.length; j++) { for (String ext : extensionsList) {
// create a macro of the form "EXTENSION_SRCS :=" // create a macro of the form "EXTENSION_SRCS :="
String extensionName = extensionsList[j]; String extensionName = ext;
if(//!getOutputExtensions().contains(extensionName) && if(//!getOutputExtensions().contains(extensionName) &&
!handledInputExtensions.contains(extensionName)) { !handledInputExtensions.contains(extensionName)) {
handledInputExtensions.add(extensionName); handledInputExtensions.add(extensionName);
@ -1095,7 +1092,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
buildSrcVars.put(buildMacro, new ArrayList()); buildSrcVars.put(buildMacro, new ArrayList());
} }
// Add any generated dependency file macros // Add any generated dependency file macros
IManagedDependencyGeneratorType depType = buildTools[i].getDependencyGeneratorForExtension(extensionName); IManagedDependencyGeneratorType depType = buildTool.getDependencyGeneratorForExtension(extensionName);
if (depType != null) { if (depType != null) {
int calcType = depType.getCalculatorType(); int calcType = depType.getCalculatorType();
if (calcType == IManagedDependencyGeneratorType.TYPE_COMMAND || if (calcType == IManagedDependencyGeneratorType.TYPE_COMMAND ||
@ -1114,17 +1111,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
} }
// Add the specified output build variables // Add the specified output build variables
IOutputType[] outTypes = buildTools[i].getOutputTypes(); IOutputType[] outTypes = buildTool.getOutputTypes();
if (outTypes != null && outTypes.length > 0) { if (outTypes != null && outTypes.length > 0) {
for (int j=0; j<outTypes.length; j++) { for (IOutputType outputType : outTypes) {
buildMacro = outTypes[j].getBuildVariable(); buildMacro = outputType.getBuildVariable();
if (!buildOutVars.containsKey(buildMacro)) { if (!buildOutVars.containsKey(buildMacro)) {
buildOutVars.put(buildMacro, new ArrayList()); buildOutVars.put(buildMacro, new ArrayList());
} }
} }
} else { } else {
// For support of pre-CDT 3.0 integrations. // For support of pre-CDT 3.0 integrations.
buildMacro = OBJS_MACRO; //$NON-NLS-1$ buildMacro = OBJS_MACRO;
if (!buildOutVars.containsKey(buildMacro)) { if (!buildOutVars.containsKey(buildMacro)) {
buildOutVars.put(buildMacro, new ArrayList()); buildOutVars.put(buildMacro, new ArrayList());
} }
@ -1400,9 +1397,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (refConfigs.length > 0) { if (refConfigs.length > 0) {
boolean addDeps = true; boolean addDeps = true;
// if (refdProjects != null) { // if (refdProjects != null) {
for (int i = 0; i < refConfigs.length; i++) { for (IConfiguration depCfg : refConfigs) {
// IProject dep = refdProjects[i]; // IProject dep = refdProjects[i];
IConfiguration depCfg = refConfigs[i];
if(!depCfg.isManagedBuildOn()) if(!depCfg.isManagedBuildOn())
continue; continue;
@ -1796,16 +1792,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
ITool[] buildTools = h.buildTools; ITool[] buildTools = h.buildTools;
boolean[] buildToolsUsed = h.buildToolsUsed; boolean[] buildToolsUsed = h.buildToolsUsed;
IOutputType[] outTypes = generatingTool.getOutputTypes(); IOutputType[] outTypes = generatingTool.getOutputTypes();
for (int i=0; i<outTypes.length; i++) { for (IOutputType outType : outTypes) {
String[] outExts = outTypes[i].getOutputExtensions(generatingTool); String[] outExts = outType.getOutputExtensions(generatingTool);
String outVariable = outTypes[i].getBuildVariable(); String outVariable = outType.getBuildVariable();
if (outExts != null) { if (outExts != null) {
for (int j=0; j<outExts.length; j++) { for (String outExt : outExts) {
for (int k=0; k<buildTools.length; k++) { for (int k=0; k<buildTools.length; k++) {
ITool tool = buildTools[k]; ITool tool = buildTools[k];
if (!buildToolsUsed[k]) { if (!buildToolsUsed[k]) {
// Also has to match build variables if specified // Also has to match build variables if specified
IInputType inType = tool.getInputType(outExts[j]); IInputType inType = tool.getInputType(outExt);
if (inType != null) { if (inType != null) {
String inVariable = inType.getBuildVariable(); String inVariable = inType.getBuildVariable();
if ((outVariable == null && inVariable == null) || if ((outVariable == null && inVariable == null) ||
@ -1861,7 +1857,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (bTargetTool && managedProjectOutputs != null) { if (bTargetTool && managedProjectOutputs != null) {
Iterator refIter = managedProjectOutputs.listIterator(); Iterator refIter = managedProjectOutputs.listIterator();
while (refIter.hasNext()) { while (refIter.hasNext()) {
dependencies.add((String)refIter.next()); dependencies.add(refIter.next());
} }
} }
return true; return true;
@ -1911,10 +1907,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Is this one of the secondary outputs? // Is this one of the secondary outputs?
// Look for an outputType with this ID, or one with a superclass with this id // Look for an outputType with this ID, or one with a superclass with this id
thisType: thisType:
for (int k = 0; k < secondaryOutputs.length; k++) { for (IOutputType secondaryOutput : secondaryOutputs) {
IOutputType matchType = outType; IOutputType matchType = outType;
do { do {
if (matchType.getId().equals(secondaryOutputs[k].getId())) { if (matchType.getId().equals(secondaryOutput.getId())) {
if (outType.getBuildVariable().equals(varName)) { if (outType.getBuildVariable().equals(varName)) {
return true; return true;
} }
@ -2016,8 +2012,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
IResourceInfo rcInfo; IResourceInfo rcInfo;
IFolder folder = project.getFolder(config.getName()); IFolder folder = project.getFolder(config.getName());
for (int i = 0; i < resources.length; i++) { for (IResource resource : resources) {
IResource resource = resources[i];
if (resource.getType() == IResource.FILE) { if (resource.getType() == IResource.FILE) {
// Check whether this resource is excluded from build // Check whether this resource is excluded from build
IPath rcProjRelPath = resource.getProjectRelativePath(); IPath rcProjRelPath = resource.getProjectRelativePath();
@ -2096,10 +2091,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
h = getToolInfo(Path.EMPTY); h = getToolInfo(Path.EMPTY);
buildTools = h.buildTools; buildTools = h.buildTools;
for (int j=0; j<buildTools.length; j++) { for (ITool buildTool : buildTools) {
if (buildTools[j].buildsFileType(ext)) { if (buildTool.buildsFileType(ext)) {
if (tool == null) { if (tool == null) {
tool = buildTools[j]; tool = buildTool;
} }
addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource); addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
break; break;
@ -2146,9 +2141,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
String firstExt = firstOutput.getFileExtension(); String firstExt = firstOutput.getFileExtension();
ToolInfoHolder tmpH = getFolderToolInfo(rcInfo.getPath()); ToolInfoHolder tmpH = getFolderToolInfo(rcInfo.getPath());
ITool[] tmpBuildTools = tmpH.buildTools; ITool[] tmpBuildTools = tmpH.buildTools;
for (int j=0; j<tmpBuildTools.length; j++) { for (ITool tmpBuildTool : tmpBuildTools) {
if (tmpBuildTools[j].buildsFileType(firstExt)) { if (tmpBuildTool.buildsFileType(firstExt)) {
String bV = tmpBuildTools[j].getPrimaryInputType().getBuildVariable(); String bV = tmpBuildTool.getPrimaryInputType().getBuildVariable();
if (bV.length() > 0) { if (bV.length() > 0) {
buildVariable = bV; buildVariable = bV;
break; break;
@ -2190,8 +2185,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} else { } else {
// If this is a secondary input, add it to build vars // If this is a secondary input, add it to build vars
if (varName == null) { if (varName == null) {
for (int j=0; j<buildTools.length; j++) { for (ITool buildTool : buildTools) {
if (buildTools[j].isInputFileType(ext)) { if (buildTool.isInputFileType(ext)) {
addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource); addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
break; break;
} }
@ -2402,9 +2397,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
depFiles = depPreBuild.getDependencyFiles(); depFiles = depPreBuild.getDependencyFiles();
} }
if (depFiles != null) { if (depFiles != null) {
for (int i=0; i<depFiles.length; i++) { for (IPath depFile : depFiles) {
getDependencyMakefiles(h).add(depFiles[i]); getDependencyMakefiles(h).add(depFile);
generatedDepFiles.add(depFiles[i]); generatedDepFiles.add(depFile);
} }
} }
} }
@ -2539,7 +2534,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Make sure that at least one of the rule outputs contains a %. // Make sure that at least one of the rule outputs contains a %.
for (int i=0; i<ruleOutputs.size(); i++) { for (int i=0; i<ruleOutputs.size(); i++) {
String ruleOutput = ((IPath)ruleOutputs.get(i)).toString(); String ruleOutput = ((IPath)ruleOutputs.get(i)).toString();
if (ruleOutput.indexOf('%') >= 0) { //$NON-NLS-1$ if (ruleOutput.indexOf('%') >= 0) {
patternRule = true; patternRule = true;
break; break;
} }
@ -2559,7 +2554,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
boolean first = true; boolean first = true;
for (int i=0; i<ruleOutputs.size(); i++) { for (int i=0; i<ruleOutputs.size(); i++) {
String ruleOutput = ((IPath)ruleOutputs.get(i)).toString(); String ruleOutput = ((IPath)ruleOutputs.get(i)).toString();
if (ruleOutput.indexOf('%') >= 0) { //$NON-NLS-1$ if (ruleOutput.indexOf('%') >= 0) {
if (first) { if (first) {
first = false; first = false;
} else { } else {
@ -2579,9 +2574,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Other additional inputs // Other additional inputs
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements // Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
IPath[] addlDepPaths = tool.getAdditionalDependencies(); IPath[] addlDepPaths = tool.getAdditionalDependencies();
for (int i=0; i<addlDepPaths.length; i++) { for (IPath addlDepPath : addlDepPaths) {
// Translate the path from project relative to build directory relative // Translate the path from project relative to build directory relative
IPath addlPath = addlDepPaths[i]; IPath addlPath = addlDepPath;
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$ if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
if (!addlPath.isAbsolute()) { if (!addlPath.isAbsolute()) {
IPath tempPath = project.getLocation().append(new Path(ensureUnquoted(addlPath.toString()))); IPath tempPath = project.getLocation().append(new Path(ensureUnquoted(addlPath.toString())));
@ -2614,10 +2609,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (depCommands != null) { if (depCommands != null) {
String[] preToolCommands = depCommands.getPreToolDependencyCommands(); String[] preToolCommands = depCommands.getPreToolDependencyCommands();
if (preToolCommands != null && preToolCommands.length > 0) { if (preToolCommands != null && preToolCommands.length > 0) {
for (int i=0; i<preToolCommands.length; i++) { for (String preCmd : preToolCommands) {
try { try {
String resolvedCommand; String resolvedCommand;
String preCmd = preToolCommands[i];
IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider(); IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
if (!needExplicitRuleForFile) { if (!needExplicitRuleForFile) {
resolvedCommand = provider.resolveValueToMakefileFormat( resolvedCommand = provider.resolveValueToMakefileFormat(
@ -2654,9 +2648,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Other additional inputs // Other additional inputs
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements // Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
IPath[] addlInputPaths = getAdditionalResourcesForSource(tool); IPath[] addlInputPaths = getAdditionalResourcesForSource(tool);
for (int i=0; i<addlInputPaths.length; i++) { for (IPath addlInputPath : addlInputPaths) {
// Translate the path from project relative to build directory relative // Translate the path from project relative to build directory relative
IPath addlPath = addlInputPaths[i]; IPath addlPath = addlInputPath;
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$ if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
if (!addlPath.isAbsolute()) { if (!addlPath.isAbsolute()) {
IPath tempPath = getPathForResource(project).append(addlPath); IPath tempPath = getPathForResource(project).append(addlPath);
@ -2712,9 +2706,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
buildCmd = cmdLInfo.getCommandLine(); buildCmd = cmdLInfo.getCommandLine();
} else { } else {
StringBuffer buildFlags = new StringBuffer(); StringBuffer buildFlags = new StringBuffer();
for (int index = 0; index < flags.length; index++) { for (String flag : flags) {
if( flags[ index ] != null ) { if( flag != null ) {
buildFlags.append( flags[ index ] + WHITESPACE ); buildFlags.append( flag + WHITESPACE );
} }
} }
buildCmd = cmd + WHITESPACE + buildFlags.toString().trim() + WHITESPACE + outflag + WHITESPACE + buildCmd = cmd + WHITESPACE + buildFlags.toString().trim() + WHITESPACE + outflag + WHITESPACE +
@ -2770,11 +2764,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
if (depCmds != null) { if (depCmds != null) {
for (int i=0; i<depCmds.length; i++) { for (String depCmd : depCmds) {
// Resolve any macros in the dep command after it has been generated. // Resolve any macros in the dep command after it has been generated.
// Note: do not trim the result because it will strip out necessary tab characters. // Note: do not trim the result because it will strip out necessary tab characters.
buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK); buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK);
String depCmd = depCmds[i];
try { try {
if (!needExplicitRuleForFile) { if (!needExplicitRuleForFile) {
depCmd = ManagedBuildManager.getBuildMacroProvider() depCmd = ManagedBuildManager.getBuildMacroProvider()
@ -2834,8 +2827,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (addlDeps != null && addlDeps.length > 0) { if (addlDeps != null && addlDeps.length > 0) {
calculatedDependencies = new String(); calculatedDependencies = new String();
for (int i=0; i<addlDeps.length; i++) { for (IPath addlDep : addlDeps) {
calculatedDependencies += WHITESPACE + escapeWhitespaces(addlDeps[i].toString()); calculatedDependencies += WHITESPACE + escapeWhitespaces(addlDep.toString());
} }
} }
@ -2856,7 +2849,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
addlOutputs.addAll(enumeratedSecondaryOutputs); addlOutputs.addAll(enumeratedSecondaryOutputs);
if (addlTargets != null) { if (addlTargets != null) {
for (int i=0; i<addlTargets.length; i++) addlOutputs.add(addlTargets[i]); for (IPath addlTarget : addlTargets)
addlOutputs.add(addlTarget);
} }
for (int i=0; i<addlOutputs.size(); i++) { for (int i=0; i<addlOutputs.size(); i++) {
depLine = escapeWhitespaces(((IPath)addlOutputs.get(i)).toString()) + COLON + WHITESPACE + primaryOutputName; depLine = escapeWhitespaces(((IPath)addlOutputs.get(i)).toString()) + COLON + WHITESPACE + primaryOutputName;
@ -2900,8 +2894,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
addedDepLines = true; addedDepLines = true;
buffer.append(depLine + NEWLINE); buffer.append(depLine + NEWLINE);
buffer.append(TAB + AT + escapedEcho(MESSAGE_START_DEPENDENCY + WHITESPACE + OUT_MACRO)); buffer.append(TAB + AT + escapedEcho(MESSAGE_START_DEPENDENCY + WHITESPACE + OUT_MACRO));
for (int i=0; i<preBuildCommands.length; i++) { for (String preBuildCommand : preBuildCommands) {
depLine = preBuildCommands[i]; depLine = preBuildCommand;
// Resolve macros // Resolve macros
try { try {
if (!needExplicitRuleForFile) { if (!needExplicitRuleForFile) {
@ -2968,13 +2962,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
protected IPath[] getAdditionalResourcesForSource(ITool tool) { protected IPath[] getAdditionalResourcesForSource(ITool tool) {
List allRes = new ArrayList(); List allRes = new ArrayList();
IInputType[] types = tool.getInputTypes(); IInputType[] types = tool.getInputTypes();
for (int i=0; i<types.length; i++) { for (IInputType type : types) {
IInputType type = types[i];
// Additional resources come from 2 places. // Additional resources come from 2 places.
// 1. From AdditionalInput childen // 1. From AdditionalInput childen
IPath[] res = type.getAdditionalResources(); IPath[] res = type.getAdditionalResources();
for (int j=0; j<res.length; j++) { for (IPath re : res) {
allRes.add(res[j]); allRes.add(re);
} }
// 2. From InputTypes that other than the primary input type // 2. From InputTypes that other than the primary input type
if (type != tool.getPrimaryInputType()) { if (type != tool.getPrimaryInputType()) {
@ -2984,15 +2977,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} else { } else {
// Use file extensions // Use file extensions
String[] typeExts = type.getSourceExtensions(tool); String[] typeExts = type.getSourceExtensions(tool);
for (int j=0; j<projectResources.length; j++) { for (IResource projectResource : projectResources) {
if (projectResources[j].getType() == IResource.FILE) { if (projectResource.getType() == IResource.FILE) {
String fileExt = projectResources[j].getFileExtension(); String fileExt = projectResource.getFileExtension();
if(fileExt == null) { if(fileExt == null) {
fileExt = ""; //$NON-NLS-1$ fileExt = ""; //$NON-NLS-1$
} }
for (int k=0; k<typeExts.length; k++) { for (String typeExt : typeExts) {
if (fileExt.equals(typeExts[k])) { if (fileExt.equals(typeExt)) {
allRes.add(projectResources[j].getProjectRelativePath()); allRes.add(projectResource.getProjectRelativePath());
break; break;
} }
} }
@ -3103,8 +3096,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
IOutputType[] outTypes = tool.getOutputTypes(); IOutputType[] outTypes = tool.getOutputTypes();
if (outTypes != null && outTypes.length > 0) { if (outTypes != null && outTypes.length > 0) {
for (int i=0; i<outTypes.length; i++) { for (IOutputType type : outTypes) {
IOutputType type = outTypes[i];
boolean primaryOutput = (type == tool.getPrimaryOutputType()); boolean primaryOutput = (type == tool.getPrimaryOutputType());
//if (primaryOutput && ignorePrimary) continue; //if (primaryOutput && ignorePrimary) continue;
String outputPrefix = type.getOutputPrefix(); String outputPrefix = type.getOutputPrefix();
@ -3440,10 +3432,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
case IManagedDependencyGeneratorType.TYPE_EXTERNAL: case IManagedDependencyGeneratorType.TYPE_EXTERNAL:
IResource[] res = depGen.findDependencies(resource, project); IResource[] res = depGen.findDependencies(resource, project);
if (res != null) { if (res != null) {
for (int i=0; i<res.length; i++) { for (IResource re : res) {
IPath dep = null; IPath dep = null;
if (res[i] != null) { if (re != null) {
IPath addlPath = res[i].getLocation(); IPath addlPath = re.getLocation();
if (addlPath != null) { if (addlPath != null) {
dep = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), addlPath); dep = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), addlPath);
} }
@ -3455,7 +3447,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
break; break;
case IManagedDependencyGenerator.TYPE_NODEPS: case IManagedDependencyGeneratorType.TYPE_NODEPS:
default: default:
break; break;
} }
@ -3474,7 +3466,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
for (int i=0; i<addlDeps.length; i++) { for (int i=0; i<addlDeps.length; i++) {
if (!addlDeps[i].isAbsolute()) { if (!addlDeps[i].isAbsolute()) {
// Convert from project relative to build directory relative // Convert from project relative to build directory relative
IPath absolutePath = project.getLocation().append((IPath)addlDeps[i]); IPath absolutePath = project.getLocation().append(addlDeps[i]);
addlDeps[i] = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), absolutePath); addlDeps[i] = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), absolutePath);
} }
} }
@ -3546,8 +3538,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// For each tool for the target, lookup the kinds of sources it outputs // For each tool for the target, lookup the kinds of sources it outputs
// and add that to our list of output extensions. // and add that to our list of output extensions.
for (int i=0; i<h.buildTools.length; i++) { for (ITool tool : h.buildTools) {
ITool tool = h.buildTools[i];
String[] outputs = tool.getAllOutputExtensions(); String[] outputs = tool.getAllOutputExtensions();
if (outputs != null) { if (outputs != null) {
h.outputExtensionsSet.addAll(Arrays.asList(outputs)); h.outputExtensionsSet.addAll(Arrays.asList(outputs));
@ -3605,8 +3596,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Try to determine if this file already has dummy targets defined. // Try to determine if this file already has dummy targets defined.
// If so, we will only add the comment. // If so, we will only add the comment.
String[] bufferLines = inBufferString.split("[\\r\\n]"); //$NON-NLS-1$ String[] bufferLines = inBufferString.split("[\\r\\n]"); //$NON-NLS-1$
for (int i=0; i<bufferLines.length; i++) { for (String bufferLine : bufferLines) {
String bufferLine = bufferLines[i];
if (bufferLine.endsWith(":")) { //$NON-NLS-1$ if (bufferLine.endsWith(":")) { //$NON-NLS-1$
StringBuffer outBuffer = addDefaultHeader(); StringBuffer outBuffer = addDefaultHeader();
outBuffer.append(inBuffer); outBuffer.append(inBuffer);
@ -3955,7 +3945,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE); buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE);
for (int i=0; i<varList.size(); i++) { for (int i=0; i<varList.size(); i++) {
String addition = (String)varMap.get((String)varList.get(i)); String addition = (String)varMap.get(varList.get(i));
StringBuffer currentBuffer = new StringBuffer(); StringBuffer currentBuffer = new StringBuffer();
currentBuffer.append(addition); currentBuffer.append(addition);
currentBuffer.append(NEWLINE); currentBuffer.append(NEWLINE);
@ -4079,8 +4069,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
// Are all calculated? If so, done. // Are all calculated? If so, done.
done = true; done = true;
for (int i=0; i<testState.length; i++) { for (int element : testState) {
if (testState[i] != 3) { if (element != 3) {
done = false; done = false;
break; break;
} }
@ -4492,8 +4482,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Delete the files if they exist // Delete the files if they exist
if (depFilePaths != null) { if (depFilePaths != null) {
for (int i=0; i<depFilePaths.length; i++) { for (IPath dfp : depFilePaths) {
IPath depFilePath = getBuildWorkingDir().append(depFilePaths[i]); IPath depFilePath = getBuildWorkingDir().append(dfp);
IResource depFile = project.findMember(depFilePath); IResource depFile = project.findMember(depFilePath);
if (depFile != null && depFile.exists()) { if (depFile != null && depFile.exists()) {
try { try {
@ -4739,8 +4729,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
toolInfos = PathSettingsContainer.createRootContainer(); toolInfos = PathSettingsContainer.createRootContainer();
IResourceInfo rcInfos[] = config.getResourceInfos(); IResourceInfo rcInfos[] = config.getResourceInfos();
for(int i = 0; i < rcInfos.length; i++){ for (IResourceInfo rcInfo : rcInfos) {
IResourceInfo rcInfo = rcInfos[i];
if(rcInfo.isExcluded() /*&& !((ResourceInfo)rcInfo).isRoot()*/) if(rcInfo.isExcluded() /*&& !((ResourceInfo)rcInfo).isRoot()*/)
continue; continue;