Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-04-06 22:47:01 -0400
committerDoug Schaefer2003-04-06 22:47:01 -0400
commitec7c947a6f3fdb01f9ca7635d69d22f349b70929 (patch)
treee91e3b562451647c3c58542ae169d4d8d407798a /core/org.eclipse.cdt.core/build
parent44aad85270fb48dbc04906626c769076958182ca (diff)
downloadorg.eclipse.cdt-ec7c947a6f3fdb01f9ca7635d69d22f349b70929.tar.gz
org.eclipse.cdt-ec7c947a6f3fdb01f9ca7635d69d22f349b70929.tar.xz
org.eclipse.cdt-ec7c947a6f3fdb01f9ca7635d69d22f349b70929.zip
Yet Another Build Model.
- Defines most of the interfaces - Some simple implementation behind the interfaces to at least get information from the extension point.
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.java46
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java65
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java32
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java41
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java50
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java165
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java74
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java80
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java60
9 files changed, 613 insertions, 0 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
new file mode 100644
index 0000000000..a270c2cb76
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * 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.core.build.managed;
+
+/**
+ *
+ */
+public interface IConfiguration {
+
+ /**
+ * Returns the name of this configuration
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Returns the platform for this configuration.
+ *
+ * @return
+ */
+ public ITarget getTarget();
+
+ /**
+ * Returns the configuration from which this configuration inherits
+ * properties.
+ *
+ * @return
+ */
+ public IConfiguration getParent();
+
+ /**
+ * Returns the tools that are used in this configuration.
+ *
+ * @return
+ */
+ public ITool[] getTools();
+
+}
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
new file mode 100644
index 0000000000..d7a1ece79c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
@@ -0,0 +1,65 @@
+/**********************************************************************
+ * 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.core.build.managed;
+
+/**
+ *
+ */
+public interface IOption {
+
+ // Type for the value of the option
+ public static final int STRING = 0;
+ public static final int STRING_LIST = 1;
+
+ /**
+ * Returns the category for this option.
+ * @return
+ */
+ public IOptionCategory getCategory();
+
+ /**
+ * Returns the name of this option.
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Get the type for the value of the option.
+ *
+ * @return
+ */
+ public int getValueType();
+
+ /**
+ * If this option is defined as an enumeration, this function returns
+ * the list of possible values for that enum.
+ *
+ * If this option is not defined as an enumeration, it returns null.
+ * @return
+ */
+ public String [] getApplicableValues();
+
+ /**
+ * Returns the current value for this option if it is a String
+ *
+ * @return
+ */
+ public String getStringValue();
+
+ /**
+ * Returns the current value for this option if it is a List of Strings.
+ *
+ * @return
+ */
+ public String [] getStringListValue();
+
+}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java
new file mode 100644
index 0000000000..99f429c17b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java
@@ -0,0 +1,32 @@
+/**********************************************************************
+ * 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.core.build.managed;
+
+/**
+ *
+ */
+public interface IOptionCategory {
+
+ /**
+ * Returns the options that have been assigned to this category.
+ *
+ * @return
+ */
+ public IOption[] getOptions();
+
+ /**
+ * Returns the list of children of this node in the option category tree
+ *
+ * @return
+ */
+ public IOptionCategory[] getChildCategories();
+
+}
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
new file mode 100644
index 0000000000..4e92b6b157
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * 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.core.build.managed;
+
+/**
+ * This class represents targets for the managed build process. A target
+ * is some type of resource built using a given collection of tools.
+ */
+public interface ITarget {
+
+ /**
+ * Gets the name for the target.
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Gets the parent for the target.
+ *
+ * @return
+ */
+ public ITarget getParent();
+
+ /**
+ * Returns the list of platform specific tools associated with this
+ * platform.
+ *
+ * @return
+ */
+ public ITool[] getTools();
+
+}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
new file mode 100644
index 0000000000..881048f9f1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * 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.core.build.managed;
+
+/**
+ *
+ */
+public interface ITool {
+
+ /**
+ * Returns the name of the tool.
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Return the target that defines this tool, if applicable
+ * @return
+ */
+ public ITarget getTarget();
+
+ /**
+ * Returns the tool that this tool inherits properties from.
+ * @return
+ */
+ public ITool getParent();
+
+ /**
+ * Returns the options that may be customized for this tool.
+ */
+ public IOption[] getOptions();
+
+ /**
+ * Options are organized into categories for UI purposes.
+ * These categories are organized into a tree. This is the root
+ * of that tree.
+ *
+ * @return
+ */
+ public IOptionCategory getTopOptionCategory();
+}
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
new file mode 100644
index 0000000000..0d942a592a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
@@ -0,0 +1,165 @@
+/**********************************************************************
+ * 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.core.build.managed;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.core.CCorePlugin;
+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.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+
+/**
+ * This is the main entry point for getting at the build information
+ * for the managed build system.
+ */
+public class ManagedBuildManager {
+
+ /**
+ * 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
+ * the project and all projects this project reference.
+ *
+ * @param project
+ * @return
+ */
+ public static ITarget[] getAvailableTargets(IProject project) {
+ // Make sure the extensions are loaded
+ loadExtensions();
+
+ // Get the platforms for this project and all referenced projects
+
+ // Create the array and copy the elements over
+ ITarget[] targets = new ITarget[extensionTargets.size()];
+
+ for (int i = 0; i < extensionTargets.size(); ++i)
+ targets[i] = (ITarget)extensionTargets.get(i);
+
+ return targets;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Returns the list of configurations associated with a given file.
+ *
+ * @param file
+ * @return
+ */
+ public static IConfiguration[] getConfigurations(IFile file) {
+ return null;
+ }
+
+ /**
+ * Creates a configuration containing the tools defined by the target.
+ *
+ * @param target
+ * @param project
+ * @return
+ */
+ public static IConfiguration createConfiguration(IProject project, ITarget target) {
+ return null;
+ }
+
+ /**
+ * Creates a configuration that inherits from the parent configuration.
+ *
+ * @param origConfig
+ * @param resource
+ * @return
+ */
+ public static IConfiguration createConfiguration(IProject project, IConfiguration parentConfig) {
+ return null;
+ }
+
+ /**
+ * 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;
+
+ private static void loadExtensions() {
+ if (extensionTargets != null)
+ return;
+
+ extensionTargets = new ArrayList();
+
+ IExtensionPoint extensionPoint
+ = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ManagedBuildInfo");
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i = 0; i < extensions.length; ++i) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (int j = 0; j < elements.length; ++j) {
+ IConfigurationElement element = elements[j];
+ if (element.getName().equals("target")) {
+ Target target = new Target(element.getAttribute("name"));
+ extensionTargets.add(target);
+
+ 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);
+ }
+ }
+ }
+ }
+ }
+ }
+}
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
new file mode 100644
index 0000000000..215a1fccc1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
@@ -0,0 +1,74 @@
+/**********************************************************************
+ * 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;
+
+import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.ITarget;
+import org.eclipse.cdt.core.build.managed.ITool;
+
+/**
+ *
+ */
+public class Configuration implements IConfiguration {
+
+ private String name;
+ private ITarget platform;
+
+ public Configuration(ITarget platform) {
+ this.platform = platform;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setName(java.lang.String)
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /* (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() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
+ */
+ public IConfiguration getParent() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTarget()
+ */
+ public ITarget getTarget() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
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
new file mode 100644
index 0000000000..a09979ece3
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
@@ -0,0 +1,80 @@
+/**********************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.core.build.managed.ITarget;
+import org.eclipse.cdt.core.build.managed.ITool;
+
+/**
+ *
+ */
+public class Target implements ITarget {
+
+ private String name;
+ private Target parent;
+ private List tools;
+
+ public Target(String name) {
+ this.name = name;
+ }
+
+ public Target(String name, Target parent) {
+ this(name);
+ this.parent = parent;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ITarget getParent() {
+ return parent;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ private int getNumTools() {
+ int n = (tools == null) ? 0 : tools.size();
+ if (parent != null)
+ n += parent.getNumTools();
+ return n;
+ }
+
+ private int addToolsToArray(ITool[] toolArray, int start) {
+ int n = start;
+ if (parent != null)
+ n = parent.addToolsToArray(toolArray, start);
+
+ if (tools != null) {
+ for (int i = 0; i < tools.size(); ++i)
+ toolArray[n++] = (ITool)tools.get(i);
+ }
+
+ return n;
+ }
+ public ITool[] getTools() {
+ ITool[] toolArray = new ITool[getNumTools()];
+ addToolsToArray(toolArray, 0);
+ return toolArray;
+ }
+
+ public void addTool(Tool tool) {
+ if (tools == null)
+ tools = new ArrayList();
+ tools.add(tool);
+ }
+
+}
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
new file mode 100644
index 0000000000..a730f60b71
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
@@ -0,0 +1,60 @@
+/**********************************************************************
+ * 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;
+
+import org.eclipse.cdt.core.build.managed.IOption;
+import org.eclipse.cdt.core.build.managed.IOptionCategory;
+import org.eclipse.cdt.core.build.managed.ITarget;
+import org.eclipse.cdt.core.build.managed.ITool;
+
+/**
+ *
+ */
+public class Tool implements ITool {
+
+ private String name;
+ private ITarget target;
+
+ public Tool(String name) {
+ this.name = name;
+ }
+
+ public Tool(String name, Target target) {
+ this(name);
+ this.target = target;
+ target.addTool(this);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ITarget getTarget() {
+ return target;
+ }
+
+ public IOption[] getOptions() {
+ return null;
+ }
+
+ public IOptionCategory getTopOptionCategory() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getParent()
+ */
+ public ITool getParent() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}

Back to the top