mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 11:25:35 +02:00
fixed bug#94981
This commit is contained in:
parent
bcf69885a2
commit
aee9835a95
3 changed files with 48 additions and 19 deletions
|
@ -56,7 +56,7 @@ public interface IMakeCommonBuildInfo {
|
||||||
String[] getErrorParsers();
|
String[] getErrorParsers();
|
||||||
void setErrorParsers(String[] parsers) throws CoreException;
|
void setErrorParsers(String[] parsers) throws CoreException;
|
||||||
|
|
||||||
Map getExpandedEnvironment();
|
Map getExpandedEnvironment() throws CoreException;
|
||||||
|
|
||||||
Map getEnvironment();
|
Map getEnvironment();
|
||||||
void setEnvironment(Map env) throws CoreException;
|
void setEnvironment(Map env) throws CoreException;
|
||||||
|
|
|
@ -17,10 +17,10 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
public interface IMakeTarget extends IAdaptable, IMakeCommonBuildInfo {
|
public interface IMakeTarget extends IAdaptable, IMakeCommonBuildInfo {
|
||||||
|
|
||||||
public final static String BUILD_TARGET = ARGS_PREFIX + ".build.target"; //$NON-NLS-1$
|
public final static String BUILD_TARGET = ARGS_PREFIX + ".build.target"; //$NON-NLS-1$
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
String getTargetBuilderID();
|
String getTargetBuilderID();
|
||||||
|
|
||||||
IProject getProject();
|
IProject getProject();
|
||||||
|
@ -37,6 +37,7 @@ public interface IMakeTarget extends IAdaptable, IMakeCommonBuildInfo {
|
||||||
String getBuildTarget() ;
|
String getBuildTarget() ;
|
||||||
|
|
||||||
void setRunAllBuilders(boolean runAllBuilders) throws CoreException;
|
void setRunAllBuilders(boolean runAllBuilders) throws CoreException;
|
||||||
|
|
||||||
boolean runAllBuilders();
|
boolean runAllBuilders();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,5 +54,9 @@ public interface IMakeTarget extends IAdaptable, IMakeCommonBuildInfo {
|
||||||
*/
|
*/
|
||||||
void setContainer(IContainer container);
|
void setContainer(IContainer container);
|
||||||
|
|
||||||
|
void setAppendProjectEnvironment(boolean append);
|
||||||
|
|
||||||
|
boolean appendProjectEnvironment();
|
||||||
|
|
||||||
void build(IProgressMonitor monitor) throws CoreException;
|
void build(IProgressMonitor monitor) throws CoreException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.core.variables.VariablesPlugin;
|
||||||
import org.eclipse.osgi.service.environment.Constants;
|
import org.eclipse.osgi.service.environment.Constants;
|
||||||
|
|
||||||
public class MakeTarget extends PlatformObject implements IMakeTarget {
|
public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
|
private final static int USE_PROJECT_ENV_SETTING = 3;
|
||||||
private final MakeTargetManager manager;
|
private final MakeTargetManager manager;
|
||||||
private final IProject project;
|
private final IProject project;
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -45,8 +45,9 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
boolean runAllBuidlers = true;
|
boolean runAllBuidlers = true;
|
||||||
private String targetBuilderID;
|
private String targetBuilderID;
|
||||||
private IContainer container;
|
private IContainer container;
|
||||||
private boolean appendEnvironment;
|
private int appendEnvironment = USE_PROJECT_ENV_SETTING;
|
||||||
private Map buildEnvironment;
|
private boolean appendProjectEnvironment = true;
|
||||||
|
private Map buildEnvironment = new HashMap();
|
||||||
private Map targetAttributes = new HashMap();
|
private Map targetAttributes = new HashMap();
|
||||||
|
|
||||||
MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
|
MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
|
||||||
|
@ -59,8 +60,6 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
|
setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
|
||||||
isDefaultBuildCmd = info.isDefaultBuildCmd();
|
isDefaultBuildCmd = info.isDefaultBuildCmd();
|
||||||
isStopOnError = info.isStopOnError();
|
isStopOnError = info.isStopOnError();
|
||||||
appendEnvironment = info.appendEnvironment();
|
|
||||||
buildEnvironment = info.getEnvironment();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
|
@ -193,8 +192,18 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getExpandedEnvironment() {
|
public Map getExpandedEnvironment() throws CoreException {
|
||||||
Map env = getEnvironment();
|
Map env = null;
|
||||||
|
if (appendProjectEnvironment()) {
|
||||||
|
IMakeBuilderInfo projectInfo;
|
||||||
|
projectInfo = MakeCorePlugin.createBuildInfo(getProject(), manager.getBuilderID(targetBuilderID));
|
||||||
|
env = projectInfo.getEnvironment();
|
||||||
|
}
|
||||||
|
if (env == null) {
|
||||||
|
env = getEnvironment();
|
||||||
|
} else {
|
||||||
|
env.putAll(getEnvironment());
|
||||||
|
}
|
||||||
HashMap envMap = new HashMap(env.entrySet().size());
|
HashMap envMap = new HashMap(env.entrySet().size());
|
||||||
Iterator iter = env.entrySet().iterator();
|
Iterator iter = env.entrySet().iterator();
|
||||||
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
|
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
|
||||||
|
@ -209,15 +218,20 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
String value = (String)entry.getValue();
|
String value = (String)entry.getValue();
|
||||||
// translate any string substitution variables
|
// translate any string substitution variables
|
||||||
String translated = value;
|
String translated = value;
|
||||||
try {
|
|
||||||
translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value, false);
|
translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value, false);
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
envMap.put(key, translated);
|
envMap.put(key, translated);
|
||||||
}
|
}
|
||||||
return envMap;
|
return envMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean appendProjectEnvironment() {
|
||||||
|
return appendProjectEnvironment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppendProjectEnvironment(boolean append) {
|
||||||
|
appendProjectEnvironment = append;
|
||||||
|
}
|
||||||
|
|
||||||
public Map getEnvironment() {
|
public Map getEnvironment() {
|
||||||
return buildEnvironment;
|
return buildEnvironment;
|
||||||
}
|
}
|
||||||
|
@ -228,12 +242,22 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAppendEnvironment(boolean append) throws CoreException {
|
public void setAppendEnvironment(boolean append) throws CoreException {
|
||||||
appendEnvironment = append;
|
appendEnvironment = append ? 1 : 0;
|
||||||
manager.updateTarget(this);
|
manager.updateTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean appendEnvironment() {
|
public boolean appendEnvironment() {
|
||||||
return appendEnvironment;
|
return appendEnvironment == USE_PROJECT_ENV_SETTING ? getProjectEnvSetting(): appendEnvironment == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getProjectEnvSetting() {
|
||||||
|
IMakeBuilderInfo projectInfo;
|
||||||
|
try {
|
||||||
|
projectInfo = MakeCorePlugin.createBuildInfo(getProject(), manager.getBuilderID(targetBuilderID));
|
||||||
|
return projectInfo.appendEnvironment();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IContainer getContainer() {
|
public IContainer getContainer() {
|
||||||
|
@ -261,12 +285,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
||||||
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
|
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
|
||||||
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
|
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
|
||||||
info.setUseDefaultBuildCmd(isDefaultBuildCmd);
|
info.setUseDefaultBuildCmd(isDefaultBuildCmd());
|
||||||
info.setStopOnError(isStopOnError);
|
info.setStopOnError(isStopOnError());
|
||||||
info.setFullBuildEnable(true);
|
info.setFullBuildEnable(true);
|
||||||
info.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_FULL, getBuildAttribute(IMakeTarget.BUILD_TARGET, "")); //$NON-NLS-1$
|
info.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_FULL, getBuildAttribute(IMakeTarget.BUILD_TARGET, "")); //$NON-NLS-1$
|
||||||
info.setEnvironment(buildEnvironment);
|
info.setEnvironment(getExpandedEnvironment());
|
||||||
info.setAppendEnvironment(appendEnvironment);
|
info.setAppendEnvironment(appendEnvironment());
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, container.getFullPath().toString());
|
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, container.getFullPath().toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue