1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Cosmetics

Change-Id: I584622013f810d8ac51dcb618074663a79cd5b19
This commit is contained in:
Jonah Graham 2016-10-13 17:05:51 +01:00 committed by Gerrit Code Review @ Eclipse.org
parent d3fecaa15e
commit 33d12e75c9

View file

@ -68,29 +68,19 @@ public class BuildStep implements IBuildStep {
des.stepCreated(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputIOTypes()
*/
@Override
public IBuildIOType[] getInputIOTypes() {
return fInputTypes.toArray(new BuildIOType[fInputTypes.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputIOTypes()
*/
@Override
public IBuildIOType[] getOutputIOTypes() {
return fOutputTypes.toArray(new BuildIOType[fOutputTypes.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#needsRebuild()
*/
@Override
public boolean needsRebuild() {
if(fNeedsRebuild
|| (fTool != null && fTool.needsRebuild())
if (fNeedsRebuild || (fTool != null && fTool.needsRebuild())
|| (fLibTool != null && fLibTool.needsRebuild()))
return true;
@ -210,17 +200,11 @@ public class BuildStep implements IBuildStep {
fBuildGroup = group;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputResources()
*/
@Override
public IBuildResource[] getInputResources() {
return getResources(true);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputResources()
*/
@Override
public IBuildResource[] getOutputResources() {
return getResources(false);
@ -239,16 +223,12 @@ public class BuildStep implements IBuildStep {
return set.toArray(new BuildResource[set.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getCommands(org.eclipse.core.runtime.IPath, java.util.Map, java.util.Map, boolean)
*/
@Override
public IBuildCommand[] getCommands(IPath cwd, Map inputArgValues, Map outputArgValues, boolean resolveAll) {
public IBuildCommand[] getCommands(IPath cwd, Map inputArgValues, Map outputArgValues,
boolean resolveAll) {
if (cwd == null)
cwd = calcCWD();
if (fTool == null) {
String step = null;
String appendToLastStep = null;
@ -295,7 +275,6 @@ public class BuildStep implements IBuildStep {
return new IBuildCommand[0];
}
performAsignToOption(cwd);
BuildResource inRc = getRcForMacros(true);
@ -309,16 +288,13 @@ public class BuildStep implements IBuildStep {
outPrefix = resolveMacros(outPrefix, data, true);
outRcPath = rmNamePrefix(outRcPath, outPrefix);
IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool,
fTool.getToolCommand(),
getCommandFlags(inRcPath, outRcPath, resolveAll),
fTool.getOutputFlag(),
outPrefix,
IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool, fTool.getToolCommand(),
getCommandFlags(inRcPath, outRcPath, resolveAll), fTool.getOutputFlag(), outPrefix,
listToString(resourcesToStrings(cwd, getPrimaryResources(false), outPrefix), " "), //$NON-NLS-1$
getInputResources(cwd, getPrimaryResources(true)),
fTool.getCommandLinePattern());
getInputResources(cwd, getPrimaryResources(true)), fTool.getCommandLinePattern());
return createCommandsFromString(resolveMacros(info.getCommandLine(), data, true), cwd, getEnvironment());
return createCommandsFromString(resolveMacros(info.getCommandLine(), data, true), cwd,
getEnvironment());
}
private IPath rmNamePrefix(IPath path, String prefix) {
@ -468,7 +444,8 @@ public class BuildStep implements IBuildStep {
SupplierBasedCdtVariableSubstitutor sub = createSubstitutor(cfg, builder, fileData);
result = CdtVariableResolver.resolveToString(str, sub);
} else {
result = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(str, "", " ", IBuildMacroProvider.CONTEXT_FILE, fileData); //$NON-NLS-1$ //$NON-NLS-2$
result = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(str, "", //$NON-NLS-1$
" ", IBuildMacroProvider.CONTEXT_FILE, fileData); //$NON-NLS-1$
}
} catch (CdtVariableException e) {
}
@ -481,9 +458,11 @@ public class BuildStep implements IBuildStep {
try {
IConfiguration cfg = getBuildDescription().getConfiguration();
if (resolveAll) {
result = ManagedBuildManager.getBuildMacroProvider().resolveValue(str, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); //$NON-NLS-1$ //$NON-NLS-2$
result = ManagedBuildManager.getBuildMacroProvider().resolveValue(str, "", " ", //$NON-NLS-1$ //$NON-NLS-2$
IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg);
} else {
result = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(str, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); //$NON-NLS-1$ //$NON-NLS-2$
result = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(str, "", //$NON-NLS-1$
" ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); //$NON-NLS-1$
}
} catch (CdtVariableException e) {
}
@ -491,14 +470,11 @@ public class BuildStep implements IBuildStep {
return result;
}
private SupplierBasedCdtVariableSubstitutor createSubstitutor(IConfiguration cfg, IBuilder builder, IFileContextData fileData){
private SupplierBasedCdtVariableSubstitutor createSubstitutor(IConfiguration cfg, IBuilder builder,
IFileContextData fileData) {
BuildMacroProvider prov = (BuildMacroProvider) ManagedBuildManager.getBuildMacroProvider();
IMacroContextInfo info = prov.getMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE, fileData);
FileMacroExplicitSubstitutor sub = new FileMacroExplicitSubstitutor(
info,
cfg,
builder,
"", " "); //$NON-NLS-1$ //$NON-NLS-2$
FileMacroExplicitSubstitutor sub = new FileMacroExplicitSubstitutor(info, cfg, builder, "", " "); //$NON-NLS-1$ //$NON-NLS-2$
return sub;
}
@ -554,9 +530,6 @@ public class BuildStep implements IBuildStep {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#isRemoved()
*/
@Override
public boolean isRemoved() {
return fIsRemoved;
@ -567,9 +540,6 @@ public class BuildStep implements IBuildStep {
fNeedsRebuild = false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getBuildDescription()
*/
@Override
public IBuildDescription getBuildDescription() {
return fBuildDescription;
@ -582,7 +552,8 @@ public class BuildStep implements IBuildStep {
if (arg != null) {
if (arg.getIoType() != null)
return ((IInputType) arg.getIoType()).getMultipleOfType();
return fTool != null && fTool == ((Configuration)fBuildDescription.getConfiguration()).calculateTargetTool();
return fTool != null
&& fTool == ((Configuration) fBuildDescription.getConfiguration()).calculateTargetTool();
}
return false;
}
@ -625,30 +596,27 @@ public class BuildStep implements IBuildStep {
if (j != 0) {
optVal += " "; //$NON-NLS-1$
}
optVal += BuildDescriptionManager.getRelPath(cwd, bRcs[j].getLocation()).toOSString();
optVal += BuildDescriptionManager.getRelPath(cwd, bRcs[j].getLocation())
.toOSString();
}
ManagedBuildManager.setOption(cfg, fTool, assignToOption, optVal);
} else if (
optType == IOption.STRING_LIST ||
optType == IOption.LIBRARIES ||
optType == IOption.OBJECTS ||
optType == IOption.INCLUDE_PATH ||
optType == IOption.PREPROCESSOR_SYMBOLS ||
optType == IOption.INCLUDE_FILES ||
optType == IOption.LIBRARY_PATHS ||
optType == IOption.LIBRARY_FILES ||
optType == IOption.MACRO_FILES ||
optType == IOption.UNDEF_INCLUDE_PATH ||
optType == IOption.UNDEF_PREPROCESSOR_SYMBOLS ||
optType == IOption.UNDEF_INCLUDE_FILES ||
optType == IOption.UNDEF_LIBRARY_PATHS ||
optType == IOption.UNDEF_LIBRARY_FILES ||
optType == IOption.UNDEF_MACRO_FILES){
// Mote that when using the enumerated inputs, the path(s) must be translated from project relative
} else if (optType == IOption.STRING_LIST || optType == IOption.LIBRARIES
|| optType == IOption.OBJECTS || optType == IOption.INCLUDE_PATH
|| optType == IOption.PREPROCESSOR_SYMBOLS || optType == IOption.INCLUDE_FILES
|| optType == IOption.LIBRARY_PATHS || optType == IOption.LIBRARY_FILES
|| optType == IOption.MACRO_FILES || optType == IOption.UNDEF_INCLUDE_PATH
|| optType == IOption.UNDEF_PREPROCESSOR_SYMBOLS
|| optType == IOption.UNDEF_INCLUDE_FILES
|| optType == IOption.UNDEF_LIBRARY_PATHS
|| optType == IOption.UNDEF_LIBRARY_FILES
|| optType == IOption.UNDEF_MACRO_FILES) {
// Mote that when using the enumerated inputs, the path(s) must be translated from
// project relative
// to top build directory relative
String[] paths = new String[bRcs.length];
for (int j = 0; j < bRcs.length; j++) {
paths[j] = BuildDescriptionManager.getRelPath(cwd, bRcs[j].getLocation()).toOSString();
paths[j] = BuildDescriptionManager.getRelPath(cwd, bRcs[j].getLocation())
.toOSString();
}
ManagedBuildManager.setOption(cfg, fTool, assignToOption, paths);
} else if (optType == IOption.BOOLEAN) {
@ -659,7 +627,8 @@ public class BuildStep implements IBuildStep {
}
} else if (optType == IOption.ENUMERATED || optType == IOption.TREE) {
if (bRcs.length > 0) {
ManagedBuildManager.setOption(cfg, fTool, assignToOption, BuildDescriptionManager.getRelPath(cwd, bRcs[0].getLocation()).toOSString());
ManagedBuildManager.setOption(cfg, fTool, assignToOption, BuildDescriptionManager
.getRelPath(cwd, bRcs[0].getLocation()).toOSString());
}
}
} catch (BuildException ex) {