Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-04-07 16:56:27 -0400
committerDoug Schaefer2003-04-07 16:56:27 -0400
commite7a699b56cc22d4cd0797475f7a94b58654f2e22 (patch)
tree53388ecf03b475dd6be12d2313e9e65cf39ee934 /core/org.eclipse.cdt.core/build
parentc9362066853e3183fc4a0d18b4a16781f9ea160e (diff)
downloadorg.eclipse.cdt-e7a699b56cc22d4cd0797475f7a94b58654f2e22.tar.gz
org.eclipse.cdt-e7a699b56cc22d4cd0797475f7a94b58654f2e22.tar.xz
org.eclipse.cdt-e7a699b56cc22d4cd0797475f7a94b58654f2e22.zip
Updates to the new build model.
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java9
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java28
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java8
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java130
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java44
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java18
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java18
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java18
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java30
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java1
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java18
11 files changed, 241 insertions, 81 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
index a270c2cb76..baf60b7327 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
@@ -10,6 +10,8 @@
**********************************************************************/
package org.eclipse.cdt.core.build.managed;
+import org.eclipse.core.resources.IProject;
+
/**
*
*/
@@ -29,6 +31,13 @@ public interface IConfiguration {
public ITarget getTarget();
/**
+ * Returns the project owning this configuration
+ * or null if this configuration is not associated with a project.
+ * @return
+ */
+ public IProject getProject();
+
+ /**
* Returns the configuration from which this configuration inherits
* properties.
*
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
index d7a1ece79c..c9496aab0b 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
@@ -20,7 +20,15 @@ public interface IOption {
public static final int STRING_LIST = 1;
/**
+ * Returns the tool defining this option.
+ *
+ * @return
+ */
+ public ITool getTool();
+
+ /**
* Returns the category for this option.
+ *
* @return
*/
public IOptionCategory getCategory();
@@ -62,4 +70,24 @@ public interface IOption {
*/
public String [] getStringListValue();
+ /**
+ * Sets the value for this option in a given configuration.
+ * A new instance of the option for the configuration may be created.
+ * The appropriate new option is returned.
+ *
+ * @param config
+ * @param value
+ */
+ public IOption setStringValue(IConfiguration config, String value);
+
+ /**
+ * Sets the value for this option in a given configuration.
+ * A new instance of the option for the configuration may be created.
+ * The appropriate new option is returned.
+ *
+ * @param config
+ * @param value
+ */
+ public IOption setStringValue(IConfiguration config, String[] value);
+
}
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 4e92b6b157..ab668de468 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
@@ -10,6 +10,8 @@
**********************************************************************/
package org.eclipse.cdt.core.build.managed;
+import org.eclipse.core.resources.IProject;
+
/**
* This class represents targets for the managed build process. A target
* is some type of resource built using a given collection of tools.
@@ -38,4 +40,10 @@ public interface ITarget {
*/
public ITool[] getTools();
+ /**
+ * Returns all of the configurations defined by this target.
+ * @return
+ */
+ public IConfiguration[] getAvailableConfigurations(IProject project);
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
index 0d942a592a..d592821803 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
@@ -14,13 +14,17 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.internal.core.build.managed.Configuration;
import org.eclipse.cdt.internal.core.build.managed.Target;
import org.eclipse.cdt.internal.core.build.managed.Tool;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.QualifiedName;
/**
* This is the main entry point for getting at the build information
@@ -28,20 +32,23 @@ import org.eclipse.core.runtime.IExtensionPoint;
*/
public class ManagedBuildManager {
+ private static final QualifiedName configProperty
+ = new QualifiedName(CCorePlugin.PLUGIN_ID, "config");
+
/**
- * Returns the list of platforms that are available to be used in
- * conjunction with the given resource. Generally this will include
- * platforms defined by extensions as well as platforms defined by
+ * Returns the list of targets that are available to be used in
+ * conjunction with the given project. Generally this will include
+ * targets defined by extensions as well as targets defined by
* the project and all projects this project reference.
*
* @param project
* @return
*/
- public static ITarget[] getAvailableTargets(IProject project) {
+ public static ITarget[] getTargets(IProject project) {
// Make sure the extensions are loaded
loadExtensions();
- // Get the platforms for this project and all referenced projects
+ // Get the targets for this project and all referenced projects
// Create the array and copy the elements over
ITarget[] targets = new ITarget[extensionTargets.size()];
@@ -53,26 +60,13 @@ public class ManagedBuildManager {
}
/**
- * Returns the list of configurations belonging to the given platform
- * that can be applied to the given project. This does not include
- * the configurations already applied to the project.
- *
- * @param resource
- * @param platform
- * @return
- */
- public static IConfiguration [] getAvailableConfigurations(IProject project, ITarget platform) {
- return null;
- }
-
- /**
* Returns the list of configurations associated with the given project.
*
* @param project
* @return
*/
- public static IConfiguration [] getConfigurations(IProject project) {
- return null;
+ public static IConfiguration[] getConfigurations(IProject project) {
+ return getResourceConfigs(project);
}
/**
@@ -82,53 +76,40 @@ public class ManagedBuildManager {
* @return
*/
public static IConfiguration[] getConfigurations(IFile file) {
- return null;
+ // TODO not ready for prime time...
+ return getResourceConfigs(file);
}
-
+
/**
- * Creates a configuration containing the tools defined by the target.
+ * Adds a configuration containing the tools defined by the target to
+ * the given project.
*
* @param target
* @param project
* @return
*/
- public static IConfiguration createConfiguration(IProject project, ITarget target) {
+ public static IConfiguration addConfiguration(IProject project, ITarget target) {
+ Configuration config = new Configuration(project, target);
return null;
}
-
+
/**
- * Creates a configuration that inherits from the parent configuration.
- *
+ * Adds a configuration inheriting from the given configuration.
+ *
* @param origConfig
* @param resource
* @return
*/
- public static IConfiguration createConfiguration(IProject project, IConfiguration parentConfig) {
- return null;
+ public static IConfiguration addConfiguration(IProject project, IConfiguration parentConfig) {
+ if (parentConfig.getProject() != null)
+ // Can only inherit from target configs
+ return null;
+
+ Configuration config = new Configuration(project, parentConfig);
+ addResourceConfig(project, config);
+ return config;
}
- /**
- * Sets the String value for an option.
- *
- * @param project
- * @param config
- * @param option
- * @param value
- */
- public static void setOptionValue(IProject project, IConfiguration config, IOption option, String value) {
- }
-
- /**
- * Sets the String List value for an option.
- *
- * @param project
- * @param config
- * @param option
- * @param value
- */
- public static void setOptionValue(IProject project, IConfiguration config, IOption option, String[] value) {
- }
-
// Private stuff
private static List extensionTargets;
@@ -151,15 +132,56 @@ public class ManagedBuildManager {
Target target = new Target(element.getAttribute("name"));
extensionTargets.add(target);
+ List configs = null;
IConfigurationElement[] targetElements = element.getChildren();
for (int k = 0; k < targetElements.length; ++k) {
- IConfigurationElement platformElement = targetElements[k];
- if (platformElement.getName().equals("tool")) {
- Tool tool = new Tool(platformElement.getAttribute("name"), target);
+ IConfigurationElement targetElement = targetElements[k];
+ if (targetElement.getName().equals("tool")) {
+ Tool tool = new Tool(targetElement.getAttribute("name"), target);
+ } else if (targetElement.getName().equals("configuration")) {
+ if (configs == null)
+ configs = new ArrayList();
+ configs.add(new Configuration(target));
}
}
+
+ if (configs != null) {
+ IConfiguration[] configArray = new IConfiguration[configs.size()];
+ configArray = (IConfiguration[])configs.toArray(configArray);
+ target.setConfigurations(configArray);
+ }
}
}
}
}
+
+ private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
+
+ private static IConfiguration[] getResourceConfigs(IResource resource) {
+ IConfiguration[] configs = null;
+
+ try {
+ configs = (IConfiguration[])resource.getSessionProperty(configProperty);
+ } catch (CoreException e) {
+ }
+
+ return (configs != null) ? configs : emptyConfigs;
+ }
+
+ private static void addResourceConfig(IResource resource, IConfiguration config) {
+ IConfiguration[] configs = getResourceConfigs(resource);
+
+ IConfiguration[] newConfigs = new IConfiguration[configs.length + 1];
+ for (int i = 0; i < configs.length; ++i)
+ newConfigs[i] = configs[i];
+ newConfigs[configs.length] = config;
+
+ try {
+ resource.setSessionProperty(configProperty, newConfigs);
+ } catch (CoreException e) {
+ }
+
+ // TODO save the config info to the project build file
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
index 215a1fccc1..42bfe0313c 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
@@ -10,9 +10,12 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.build.managed;
+import java.util.List;
+
import org.eclipse.cdt.core.build.managed.IConfiguration;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
+import org.eclipse.core.resources.IProject;
/**
*
@@ -20,17 +23,30 @@ import org.eclipse.cdt.core.build.managed.ITool;
public class Configuration implements IConfiguration {
private String name;
- private ITarget platform;
+ private ITarget target;
+ private IProject project;
+ private IConfiguration parent;
+ private List toolReference;
- public Configuration(ITarget platform) {
- this.platform = platform;
+ public Configuration(Target target) {
+ this.target = target;
+ }
+
+ public Configuration(IProject project, ITarget target) {
+ this.project = project;
+ this.target = target;
}
+ public Configuration(IProject project, IConfiguration parent) {
+ this.project = project;
+ this.parent = parent;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getName()
*/
public String getName() {
- return name;
+ return (name == null && parent != null) ? parent.getName() : name;
}
/* (non-Javadoc)
@@ -41,13 +57,6 @@ public class Configuration implements IConfiguration {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getPlatform()
- */
- public ITarget getPlatform() {
- return platform;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/
public ITool[] getTools() {
@@ -59,16 +68,21 @@ public class Configuration implements IConfiguration {
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
*/
public IConfiguration getParent() {
- // TODO Auto-generated method stub
- return null;
+ return parent;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTarget()
*/
public ITarget getTarget() {
- // TODO Auto-generated method stub
- return null;
+ return (target == null && parent != null) ? parent.getTarget() : target;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getProject()
+ */
+ public IProject getProject() {
+ return (project == null && parent != null) ? parent.getProject() : project;
}
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
new file mode 100644
index 0000000000..d8f8234f35
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
@@ -0,0 +1,18 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.build.managed;
+
+/**
+ *
+ */
+public class Option {
+
+}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java
new file mode 100644
index 0000000000..5909e1acc1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java
@@ -0,0 +1,18 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.build.managed;
+
+/**
+ *
+ */
+public class OptionCategory {
+
+}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
new file mode 100644
index 0000000000..64eb468b4d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
@@ -0,0 +1,18 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.build.managed;
+
+/**
+ *
+ */
+public class OptionReference {
+
+}
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 a09979ece3..e54de59d0e 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
@@ -10,11 +10,10 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.build.managed;
-import java.util.ArrayList;
-import java.util.List;
-
+import org.eclipse.cdt.core.build.managed.IConfiguration;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
+import org.eclipse.core.resources.IProject;
/**
*
@@ -23,7 +22,8 @@ public class Target implements ITarget {
private String name;
private Target parent;
- private List tools;
+ private ITool[] tools;
+ private IConfiguration[] configurations;
public Target(String name) {
this.name = name;
@@ -47,7 +47,7 @@ public class Target implements ITarget {
}
private int getNumTools() {
- int n = (tools == null) ? 0 : tools.size();
+ int n = (tools == null) ? 0 : tools.length;
if (parent != null)
n += parent.getNumTools();
return n;
@@ -59,22 +59,30 @@ public class Target implements ITarget {
n = parent.addToolsToArray(toolArray, start);
if (tools != null) {
- for (int i = 0; i < tools.size(); ++i)
- toolArray[n++] = (ITool)tools.get(i);
+ for (int i = 0; i < tools.length; ++i)
+ toolArray[n++] = (ITool)tools[i];
}
return n;
}
+
public ITool[] getTools() {
ITool[] toolArray = new ITool[getNumTools()];
addToolsToArray(toolArray, 0);
return toolArray;
}
+
+ public void setTools(ITool[] tools) {
+ this.tools = tools;
+ }
+
+ public void setConfigurations(IConfiguration [] configurations) {
+ this.configurations = configurations;
+ }
- public void addTool(Tool tool) {
- if (tools == null)
- tools = new ArrayList();
- tools.add(tool);
+ public IConfiguration[] getAvailableConfigurations(IProject project) {
+ // TODO Auto-generated method stub
+ return null;
}
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
index a730f60b71..4462a9b292 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
@@ -30,7 +30,6 @@ public class Tool implements ITool {
public Tool(String name, Target target) {
this(name);
this.target = target;
- target.addTool(this);
}
public String getName() {
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
new file mode 100644
index 0000000000..b0608b98d8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
@@ -0,0 +1,18 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.build.managed;
+
+/**
+ *
+ */
+public class ToolReference {
+
+}

Back to the top