Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java15
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java13
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java57
3 files changed, 74 insertions, 11 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
index 2eefd1c879f..163d2d9cc17 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
@@ -47,6 +47,13 @@ public interface ITarget extends IBuildObject {
public String getArtifactName();
/**
+ * Answers the OS-specific command to remove files created by the build
+ *
+ * @return
+ */
+ public String getCleanCommand();
+
+ /**
* Returns all of the configurations defined by this target.
* @return
*/
@@ -61,6 +68,13 @@ public interface ITarget extends IBuildObject {
public String getDefaultExtension();
/**
+ * Answers the name of the make utility for the target.
+ *
+ * @return
+ */
+ public String getMakeCommand();
+
+ /**
* Returns the configuration with the given id, or null if not found.
*
* @param id
@@ -110,5 +124,6 @@ public interface ITarget extends IBuildObject {
* @param name The name of the build artifact.
*/
public void setBuildArtifact(String name);
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
index 4aa43626f60..b2c6090d122 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
@@ -116,8 +116,11 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getCleanCommand()
*/
public String getCleanCommand() {
- // TODO Get from the model
- return new String("rm -rf");
+ // Get from the model
+ String command = new String();
+ ITarget target = getDefaultTarget();
+ command = target.getCleanCommand();
+ return command;
}
/* (non-Javadoc)
@@ -276,8 +279,10 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeCommand()
*/
public String getMakeCommand() {
- // TODO Don't hard-code this
- return new String("make");
+ String command = new String();
+ ITarget target = getDefaultTarget();
+ command = target.getMakeCommand();
+ return command;
}
/* (non-Javadoc)
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
index b01bf3ba74d..4c13d741c83 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
@@ -31,16 +31,18 @@ import org.w3c.dom.Node;
*/
public class Target extends BuildObject implements ITarget {
- private ITarget parent;
- private IResource owner;
- private List tools;
- private Map toolMap;
- private List configurations;
+ private String artifactName;
+ private String cleanCommand;
private Map configMap;
+ private List configurations;
+ private String defaultExtension;
private boolean isAbstract = false;
private boolean isTest = false;
- private String artifactName;
- private String defaultExtension;
+ private String makeCommand;
+ private IResource owner;
+ private ITarget parent;
+ private Map toolMap;
+ private List tools;
private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
private static final String EMPTY_STRING = new String();
@@ -66,6 +68,8 @@ public class Target extends BuildObject implements ITarget {
this.artifactName = parent.getArtifactName();
this.defaultExtension = parent.getDefaultExtension();
this.isTest = parent.isTestTarget();
+ this.cleanCommand = parent.getCleanCommand();
+ this.makeCommand = parent.getMakeCommand();
// Hook me up
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner, true);
@@ -110,6 +114,20 @@ public class Target extends BuildObject implements ITarget {
// Is this a test target
isTest = ("true".equals(element.getAttribute("isTest")));
+
+ // Get the clean command
+ cleanCommand = element.getAttribute("cleanCommand");
+ if (cleanCommand == null) {
+ // See if it defined in the parent
+ cleanCommand = parent.getCleanCommand();
+ }
+
+ // Get the make command
+ makeCommand = element.getAttribute("makeCommand");
+ if (makeCommand == null) {
+ // See if it defined in the parent
+ makeCommand = parent.getMakeCommand();
+ }
IConfigurationElement[] targetElements = element.getChildren();
for (int k = 0; k < targetElements.length; ++k) {
@@ -159,6 +177,12 @@ public class Target extends BuildObject implements ITarget {
// Is this a test target
isTest = ("true".equals(element.getAttribute("isTest")));
+
+ // Get the clean command
+ cleanCommand = element.getAttribute("cleanCommand");
+
+ // Get the make command
+ makeCommand = element.getAttribute("makeCommand");
Node child = element.getFirstChild();
while (child != null) {
@@ -184,6 +208,8 @@ public class Target extends BuildObject implements ITarget {
element.setAttribute("artifactName", getArtifactName());
element.setAttribute("defaultExtension", getDefaultExtension());
element.setAttribute("isTest", isTest ? "true" : "false");
+ element.setAttribute("cleanCommand", getCleanCommand());
+ element.setAttribute("makeCommand", getMakeCommand());
if (configurations != null)
for (int i = 0; i < configurations.size(); ++i) {
@@ -194,6 +220,14 @@ public class Target extends BuildObject implements ITarget {
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITarget#getMakeCommand()
+ */
+ public String getMakeCommand() {
+ // Return the name of the make utility
+ return makeCommand == null ? EMPTY_STRING : makeCommand;
+ }
+
public String getName() {
return (name == null && parent != null) ? parent.getName() : name;
}
@@ -268,6 +302,14 @@ public class Target extends BuildObject implements ITarget {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITarget#getCleanCommand()
+ */
+ public String getCleanCommand() {
+ // Return the command used to remove files
+ return cleanCommand == null ? EMPTY_STRING : cleanCommand;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#getArtifactName()
*/
public String getArtifactName() {
@@ -325,4 +367,5 @@ public class Target extends BuildObject implements ITarget {
public void setBuildArtifact(String name) {
artifactName = name;
}
+
}

Back to the top