mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
added environment APIs to target and build info
enable variable support in builder arguments, environment and targets make builder is now "configurable"
This commit is contained in:
parent
6bcf0f580b
commit
58e5610d98
10 changed files with 121 additions and 38 deletions
|
@ -16,6 +16,7 @@
|
||||||
<import plugin="org.eclipse.core.resources"/>
|
<import plugin="org.eclipse.core.resources"/>
|
||||||
<import plugin="org.eclipse.cdt.core"/>
|
<import plugin="org.eclipse.cdt.core"/>
|
||||||
<import plugin="org.eclipse.core.runtime"/>
|
<import plugin="org.eclipse.core.runtime"/>
|
||||||
|
<import plugin="org.eclipse.core.variables"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,9 +53,9 @@
|
||||||
name="%builderMake.name"
|
name="%builderMake.name"
|
||||||
point="org.eclipse.core.resources.builders">
|
point="org.eclipse.core.resources.builders">
|
||||||
<builder
|
<builder
|
||||||
hasNature="true">
|
hasNature="true"
|
||||||
<run
|
isConfigurable="true">
|
||||||
class="org.eclipse.cdt.make.core.MakeBuilder">
|
<run class="org.eclipse.cdt.make.core.MakeBuilder">
|
||||||
<parameter
|
<parameter
|
||||||
name="defaultCommand"
|
name="defaultCommand"
|
||||||
value="make">
|
value="make">
|
||||||
|
|
|
@ -60,4 +60,7 @@ public interface IMakeBuilderInfo {
|
||||||
|
|
||||||
Map getEnvironment();
|
Map getEnvironment();
|
||||||
void setEnvironment(Map env) throws CoreException;
|
void setEnvironment(Map env) throws CoreException;
|
||||||
|
|
||||||
|
boolean appendEnvironment();
|
||||||
|
void setAppendEnvironment(boolean append) throws CoreException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.make.core;
|
package org.eclipse.cdt.make.core;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
@ -31,12 +33,19 @@ public interface IMakeTarget extends IAdaptable {
|
||||||
|
|
||||||
IPath getBuildCommand();
|
IPath getBuildCommand();
|
||||||
void setBuildCommand(IPath command) throws CoreException;
|
void setBuildCommand(IPath command) throws CoreException;
|
||||||
|
|
||||||
String getBuildArguments();
|
String getBuildArguments();
|
||||||
void setBuildArguments(String arguments) throws CoreException;
|
void setBuildArguments(String arguments) throws CoreException;
|
||||||
|
|
||||||
void setRunAllBuilders(boolean runAllBuilders);
|
void setRunAllBuilders(boolean runAllBuilders);
|
||||||
boolean runAllBuilders();
|
boolean runAllBuilders();
|
||||||
|
|
||||||
|
void setBuildEnvironment(Map env) throws CoreException;
|
||||||
|
Map getBuildEnvironment();
|
||||||
|
|
||||||
|
void setAppendEnvironment(boolean append) throws CoreException;
|
||||||
|
boolean isAppendEnvironment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the target build container.
|
* Get the target build container.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,9 +13,10 @@ package org.eclipse.cdt.make.core;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CommandLauncher;
|
import org.eclipse.cdt.core.CommandLauncher;
|
||||||
|
@ -40,10 +41,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.core.variables.VariablesPlugin;
|
||||||
|
import org.eclipse.osgi.service.environment.Constants;
|
||||||
|
|
||||||
public class MakeBuilder extends ACBuilder {
|
public class MakeBuilder extends ACBuilder {
|
||||||
|
|
||||||
|
@ -144,20 +148,39 @@ public class MakeBuilder extends ACBuilder {
|
||||||
launcher.showCommand(true);
|
launcher.showCommand(true);
|
||||||
|
|
||||||
// Set the environmennt, some scripts may need the CWD var to be set.
|
// Set the environmennt, some scripts may need the CWD var to be set.
|
||||||
Properties props = launcher.getEnvironment();
|
HashMap envMap = new HashMap();
|
||||||
props.putAll(info.getEnvironment());
|
if (info.appendEnvironment()) {
|
||||||
props.put("CWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
envMap.putAll(launcher.getEnvironment());
|
||||||
props.put("PWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
|
||||||
String[] env = null;
|
|
||||||
ArrayList envList = new ArrayList();
|
|
||||||
Enumeration names = props.propertyNames();
|
|
||||||
if (names != null) {
|
|
||||||
while (names.hasMoreElements()) {
|
|
||||||
String key = (String) names.nextElement();
|
|
||||||
envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
env = (String[]) envList.toArray(new String[envList.size()]);
|
|
||||||
}
|
}
|
||||||
|
envMap.put("CWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
||||||
|
envMap.put("PWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
||||||
|
// Add variables from build info
|
||||||
|
Map userEnv = info.getEnvironment();
|
||||||
|
Iterator iter= userEnv.entrySet().iterator();
|
||||||
|
boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Map.Entry entry= (Map.Entry) iter.next();
|
||||||
|
String key= (String) entry.getKey();
|
||||||
|
if (win32) {
|
||||||
|
// Win32 vars are case insensitive. Uppercase everything so
|
||||||
|
// that (for example) "pAtH" will correctly replace "PATH"
|
||||||
|
key= key.toUpperCase();
|
||||||
|
}
|
||||||
|
String value = (String) entry.getValue();
|
||||||
|
// translate any string substitution variables
|
||||||
|
String translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
|
||||||
|
envMap.put(key, translated);
|
||||||
|
}
|
||||||
|
|
||||||
|
iter= envMap.entrySet().iterator();
|
||||||
|
List strings= new ArrayList(envMap.size());
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Map.Entry entry = (Map.Entry) iter.next();
|
||||||
|
StringBuffer buffer= new StringBuffer((String) entry.getKey());
|
||||||
|
buffer.append('=').append((String) entry.getValue());
|
||||||
|
strings.add(buffer.toString());
|
||||||
|
}
|
||||||
|
String[] env = (String[]) strings.toArray(new String[strings.size()]);
|
||||||
String[] buildArguments = targets;
|
String[] buildArguments = targets;
|
||||||
if (info.isDefaultBuildCmd()) {
|
if (info.isDefaultBuildCmd()) {
|
||||||
if (!info.isStopOnError()) {
|
if (!info.isStopOnError()) {
|
||||||
|
@ -168,7 +191,8 @@ public class MakeBuilder extends ACBuilder {
|
||||||
} else {
|
} else {
|
||||||
String args = info.getBuildArguments();
|
String args = info.getBuildArguments();
|
||||||
if (args != null && !args.equals("")) { //$NON-NLS-1$
|
if (args != null && !args.equals("")) { //$NON-NLS-1$
|
||||||
String[] newArgs = makeArray(args);
|
String translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args);
|
||||||
|
String[] newArgs = makeArray(translated);
|
||||||
buildArguments = new String[targets.length + newArgs.length];
|
buildArguments = new String[targets.length + newArgs.length];
|
||||||
System.arraycopy(newArgs, 0, buildArguments, 0, newArgs.length);
|
System.arraycopy(newArgs, 0, buildArguments, 0, newArgs.length);
|
||||||
System.arraycopy(targets, 0, buildArguments, newArgs.length, targets.length);
|
System.arraycopy(targets, 0, buildArguments, newArgs.length, targets.length);
|
||||||
|
@ -273,7 +297,7 @@ public class MakeBuilder extends ACBuilder {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getTargets(int kind, IMakeBuilderInfo info) {
|
protected String[] getTargets(int kind, IMakeBuilderInfo info) throws CoreException {
|
||||||
String targets = ""; //$NON-NLS-1$
|
String targets = ""; //$NON-NLS-1$
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case IncrementalProjectBuilder.AUTO_BUILD :
|
case IncrementalProjectBuilder.AUTO_BUILD :
|
||||||
|
@ -289,7 +313,8 @@ public class MakeBuilder extends ACBuilder {
|
||||||
targets = info.getCleanBuildTarget();
|
targets = info.getCleanBuildTarget();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return makeArray(targets);
|
String translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(targets);
|
||||||
|
return makeArray(translated);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn the string into an array.
|
// Turn the string into an array.
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class MakeProjectNature implements IProjectNature {
|
||||||
project.setDescription(description, monitor);
|
project.setDescription(description, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICommand getBuildSpec(IProjectDescription description, String builderID) throws CoreException {
|
public static ICommand getBuildSpec(IProjectDescription description, String builderID) {
|
||||||
ICommand[] commands = description.getBuildSpec();
|
ICommand[] commands = description.getBuildSpec();
|
||||||
for (int i = 0; i < commands.length; ++i) {
|
for (int i = 0; i < commands.length; ++i) {
|
||||||
if (commands[i].getBuilderName().equals(builderID)) {
|
if (commands[i].getBuilderName().equals(builderID)) {
|
||||||
|
@ -50,8 +50,7 @@ public class MakeProjectNature implements IProjectNature {
|
||||||
* Update the Java command in the build spec (replace existing one if present,
|
* Update the Java command in the build spec (replace existing one if present,
|
||||||
* add one first if none).
|
* add one first if none).
|
||||||
*/
|
*/
|
||||||
public static IProjectDescription setBuildSpec(IProjectDescription description, ICommand newCommand)
|
public static IProjectDescription setBuildSpec(IProjectDescription description, ICommand newCommand) {
|
||||||
throws CoreException {
|
|
||||||
|
|
||||||
ICommand[] oldCommands = description.getBuildSpec();
|
ICommand[] oldCommands = description.getBuildSpec();
|
||||||
ICommand oldCommand = getBuildSpec(description, newCommand.getBuilderName());
|
ICommand oldCommand = getBuildSpec(description, newCommand.getBuilderName());
|
||||||
|
@ -149,6 +148,8 @@ public class MakeProjectNature implements IProjectNature {
|
||||||
projectInfo.setCleanBuildEnable(info.isCleanBuildEnabled());
|
projectInfo.setCleanBuildEnable(info.isCleanBuildEnabled());
|
||||||
projectInfo.setCleanBuildTarget(info.getCleanBuildTarget());
|
projectInfo.setCleanBuildTarget(info.getCleanBuildTarget());
|
||||||
projectInfo.setErrorParsers(info.getErrorParsers());
|
projectInfo.setErrorParsers(info.getErrorParsers());
|
||||||
|
projectInfo.setAppendEnvironment(info.appendEnvironment());
|
||||||
|
projectInfo.setEnvironment(info.getEnvironment());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeBuildSpec() throws CoreException {
|
public void removeBuildSpec() throws CoreException {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||||
import org.eclipse.core.resources.ICommand;
|
import org.eclipse.core.resources.ICommand;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
@ -54,8 +55,10 @@ public class BuildInfoFactory {
|
||||||
static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild"; //$NON-NLS-1$
|
static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild"; //$NON-NLS-1$
|
||||||
static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments"; //$NON-NLS-1$
|
static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments"; //$NON-NLS-1$
|
||||||
static final String ENVIRONMENT = PREFIX + ".environment"; //$NON-NLS-1$
|
static final String ENVIRONMENT = PREFIX + ".environment"; //$NON-NLS-1$
|
||||||
|
static final String BUILD_APPEND_ENVIRONMENT = ".append_environment"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private abstract static class AbstractBuildInfo implements IMakeBuilderInfo {
|
||||||
|
|
||||||
private abstract static class Store implements IMakeBuilderInfo {
|
|
||||||
|
|
||||||
public void setUseDefaultBuildCmd(boolean on) throws CoreException {
|
public void setUseDefaultBuildCmd(boolean on) throws CoreException {
|
||||||
putString(USE_DEFAULT_BUILD_CMD, new Boolean(on).toString());
|
putString(USE_DEFAULT_BUILD_CMD, new Boolean(on).toString());
|
||||||
|
@ -232,6 +235,17 @@ public class BuildInfoFactory {
|
||||||
putString(ENVIRONMENT, encodeMap(env));
|
putString(ENVIRONMENT, encodeMap(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean appendEnvironment() {
|
||||||
|
if (getString(BUILD_APPEND_ENVIRONMENT).length() > 0) {
|
||||||
|
return getBoolean(BUILD_APPEND_ENVIRONMENT);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppendEnvironment(boolean append) throws CoreException {
|
||||||
|
putString(BUILD_APPEND_ENVIRONMENT, new Boolean(append).toString());
|
||||||
|
}
|
||||||
|
|
||||||
protected Map decodeMap(String value) {
|
protected Map decodeMap(String value) {
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
StringBuffer envStr = new StringBuffer(value);
|
StringBuffer envStr = new StringBuffer(value);
|
||||||
|
@ -298,12 +312,12 @@ public class BuildInfoFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Preference extends Store {
|
private static class BuildInfoPreference extends AbstractBuildInfo {
|
||||||
private Preferences prefs;
|
private Preferences prefs;
|
||||||
private String builderID;
|
private String builderID;
|
||||||
private boolean useDefaults;
|
private boolean useDefaults;
|
||||||
|
|
||||||
Preference(Preferences prefs, String builderID, boolean useDefaults) {
|
BuildInfoPreference(Preferences prefs, String builderID, boolean useDefaults) {
|
||||||
this.prefs = prefs;
|
this.prefs = prefs;
|
||||||
this.builderID = builderID;
|
this.builderID = builderID;
|
||||||
this.useDefaults = useDefaults;
|
this.useDefaults = useDefaults;
|
||||||
|
@ -329,12 +343,12 @@ public class BuildInfoFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BuildProperty extends Store {
|
private static class BuildInfoProject extends AbstractBuildInfo {
|
||||||
private IProject project;
|
private IProject project;
|
||||||
private String builderID;
|
private String builderID;
|
||||||
private Map args;
|
private Map args;
|
||||||
|
|
||||||
BuildProperty(IProject project, String builderID) throws CoreException {
|
BuildInfoProject(IProject project, String builderID) throws CoreException {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.builderID = builderID;
|
this.builderID = builderID;
|
||||||
ICommand builder;
|
ICommand builder;
|
||||||
|
@ -354,6 +368,10 @@ public class BuildInfoFactory {
|
||||||
ICommand builder = MakeProjectNature.getBuildSpec(description, builderID);
|
ICommand builder = MakeProjectNature.getBuildSpec(description, builderID);
|
||||||
args.put(name, value);
|
args.put(name, value);
|
||||||
builder.setArguments(args);
|
builder.setArguments(args);
|
||||||
|
builder.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, isAutoBuildEnable());
|
||||||
|
builder.setBuilding(IncrementalProjectBuilder.FULL_BUILD, isFullBuildEnabled());
|
||||||
|
builder.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, isIncrementalBuildEnabled());
|
||||||
|
builder.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, isCleanBuildEnabled());
|
||||||
MakeProjectNature.setBuildSpec(description, builder);
|
MakeProjectNature.setBuildSpec(description, builder);
|
||||||
project.setDescription(description, null);
|
project.setDescription(description, null);
|
||||||
}
|
}
|
||||||
|
@ -368,11 +386,11 @@ public class BuildInfoFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BuildArguments extends Store {
|
private static class BuildInfoMap extends AbstractBuildInfo {
|
||||||
private Map args;
|
private Map args;
|
||||||
private String builderID;
|
private String builderID;
|
||||||
|
|
||||||
BuildArguments(Map args, String builderID) {
|
BuildInfoMap(Map args, String builderID) {
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.builderID = builderID;
|
this.builderID = builderID;
|
||||||
}
|
}
|
||||||
|
@ -391,14 +409,14 @@ public class BuildInfoFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMakeBuilderInfo create(Preferences prefs, String builderID, boolean useDefaults) {
|
public static IMakeBuilderInfo create(Preferences prefs, String builderID, boolean useDefaults) {
|
||||||
return new BuildInfoFactory.Preference(prefs, builderID, useDefaults);
|
return new BuildInfoFactory.BuildInfoPreference(prefs, builderID, useDefaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMakeBuilderInfo create(IProject project, String builderID) throws CoreException {
|
public static IMakeBuilderInfo create(IProject project, String builderID) throws CoreException {
|
||||||
return new BuildInfoFactory.BuildProperty(project, builderID);
|
return new BuildInfoFactory.BuildInfoProject(project, builderID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMakeBuilderInfo create(Map args, String builderID) {
|
public static IMakeBuilderInfo create(Map args, String builderID) {
|
||||||
return new BuildInfoFactory.BuildArguments(args, builderID);
|
return new BuildInfoFactory.BuildInfoMap(args, builderID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.make.internal.core;
|
package org.eclipse.cdt.make.internal.core;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
||||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||||
|
@ -41,6 +42,8 @@ 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 Map buildEnvironment;
|
||||||
|
|
||||||
MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
|
MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
@ -51,6 +54,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
buildArguments = info.getBuildArguments();
|
buildArguments = info.getBuildArguments();
|
||||||
isDefaultBuildCmd = info.isDefaultBuildCmd();
|
isDefaultBuildCmd = info.isDefaultBuildCmd();
|
||||||
isStopOnError = info.isStopOnError();
|
isStopOnError = info.isStopOnError();
|
||||||
|
appendEnvironment = info.appendEnvironment();
|
||||||
|
buildEnvironment = info.getEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContainer(IContainer container) {
|
public void setContainer(IContainer container) {
|
||||||
|
@ -105,6 +110,24 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
manager.updateTarget(this);
|
manager.updateTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map getBuildEnvironment() {
|
||||||
|
return buildEnvironment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuildEnvironment(Map env) throws CoreException {
|
||||||
|
buildEnvironment = new HashMap(env);
|
||||||
|
manager.updateTarget(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAppendEnvironment() {
|
||||||
|
return appendEnvironment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppendEnvironment(boolean append) throws CoreException {
|
||||||
|
appendEnvironment = append;
|
||||||
|
manager.updateTarget(this);
|
||||||
|
}
|
||||||
|
|
||||||
public IContainer getContainer() {
|
public IContainer getContainer() {
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +143,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return container.hashCode() * 17 + name.hashCode();
|
return container.hashCode() * 17 + name != null ? name.hashCode(): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build(IProgressMonitor monitor) throws CoreException {
|
public void build(IProgressMonitor monitor) throws CoreException {
|
||||||
|
@ -139,6 +162,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
||||||
info.setStopOnError(isStopOnError);
|
info.setStopOnError(isStopOnError);
|
||||||
info.setFullBuildEnable(true);
|
info.setFullBuildEnable(true);
|
||||||
info.setFullBuildTarget(target);
|
info.setFullBuildTarget(target);
|
||||||
|
info.setEnvironment(buildEnvironment);
|
||||||
|
info.setAppendEnvironment(appendEnvironment);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
info.setBuildLocation(container.getFullPath());
|
info.setBuildLocation(container.getFullPath());
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
return projectTargets.findTarget(container, name);
|
return projectTargets.findTarget(container, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject[] getTargetBuilderProjects() throws CoreException {
|
public IProject[] getTargetBuilderProjects() {
|
||||||
return (IProject[])fProjects.toArray(new IProject[fProjects.size()]);
|
return (IProject[])fProjects.toArray(new IProject[fProjects.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
projectTargets.saveTargets();
|
projectTargets.saveTargets();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProjectTargets readTargets(IProject project) throws CoreException {
|
protected ProjectTargets readTargets(IProject project) {
|
||||||
ProjectTargets projectTargets = new ProjectTargets(this, project);
|
ProjectTargets projectTargets = new ProjectTargets(this, project);
|
||||||
projectMap.put(project, projectTargets);
|
projectMap.put(project, projectTargets);
|
||||||
return projectTargets;
|
return projectTargets;
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
info.setFullBuildTarget("clean all"); //$NON-NLS-1$
|
info.setFullBuildTarget("clean all"); //$NON-NLS-1$
|
||||||
info.setCleanBuildEnable(true);
|
info.setCleanBuildEnable(true);
|
||||||
info.setCleanBuildTarget("clean"); //$NON-NLS-1$
|
info.setCleanBuildTarget("clean"); //$NON-NLS-1$
|
||||||
|
info.setAppendEnvironment(true);
|
||||||
info.setErrorParsers(CCorePlugin.getDefault().getAllErrorParsersIDs());
|
info.setErrorParsers(CCorePlugin.getDefault().getAllErrorParsersIDs());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ProjectTargets {
|
||||||
|
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
public ProjectTargets(MakeTargetManager manager, IProject project) throws CoreException {
|
public ProjectTargets(MakeTargetManager manager, IProject project) {
|
||||||
boolean writeTargets = false;
|
boolean writeTargets = false;
|
||||||
File targetFile = null;
|
File targetFile = null;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue