mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
New Build Model
- Save and load options values
This commit is contained in:
parent
a4a9738866
commit
b8024352d1
7 changed files with 502 additions and 343 deletions
|
@ -22,6 +22,8 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -88,6 +90,15 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
|
|
||||||
if (element.hasAttribute("parent"))
|
if (element.hasAttribute("parent"))
|
||||||
parent = target.getParent().getConfiguration(element.getAttribute("parent"));
|
parent = target.getParent().getConfiguration(element.getAttribute("parent"));
|
||||||
|
|
||||||
|
NodeList configElements = element.getChildNodes();
|
||||||
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
|
Node configElement = configElements.item(i);
|
||||||
|
if (configElement.getNodeName().equals("toolRef")) {
|
||||||
|
new ToolReference(this, (Element)configElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serealize(Document doc, Element element) {
|
public void serealize(Document doc, Element element) {
|
||||||
|
@ -103,6 +114,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
for (int i = 0; i < toolReferences.size(); ++i) {
|
for (int i = 0; i < toolReferences.size(); ++i) {
|
||||||
ToolReference toolRef = (ToolReference)toolReferences.get(i);
|
ToolReference toolRef = (ToolReference)toolReferences.get(i);
|
||||||
Element toolRefElement = doc.createElement("toolRef");
|
Element toolRefElement = doc.createElement("toolRef");
|
||||||
|
element.appendChild(toolRefElement);
|
||||||
toolRef.serealize(doc, toolRefElement);
|
toolRef.serealize(doc, toolRefElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.build.managed;
|
package org.eclipse.cdt.internal.core.build.managed;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.managed.BuildException;
|
import org.eclipse.cdt.core.build.managed.BuildException;
|
||||||
|
@ -53,6 +54,28 @@ public class Option extends BuildObject implements IOption {
|
||||||
String categoryId = element.getAttribute("category");
|
String categoryId = element.getAttribute("category");
|
||||||
if (categoryId != null)
|
if (categoryId != null)
|
||||||
setCategory(tool.getOptionCategory(categoryId));
|
setCategory(tool.getOptionCategory(categoryId));
|
||||||
|
|
||||||
|
// valueType
|
||||||
|
String valueTypeStr = element.getAttribute("valueType");
|
||||||
|
if (valueTypeStr == null || valueTypeStr.equals("string"))
|
||||||
|
valueType = IOption.STRING;
|
||||||
|
else if (valueTypeStr.equals("stringList"))
|
||||||
|
valueType = IOption.STRING_LIST;
|
||||||
|
|
||||||
|
// value
|
||||||
|
switch (valueType) {
|
||||||
|
case IOption.STRING:
|
||||||
|
value = element.getAttribute("value");
|
||||||
|
break;
|
||||||
|
case IOption.STRING_LIST:
|
||||||
|
List valueList = new ArrayList();
|
||||||
|
value = valueList;
|
||||||
|
IConfigurationElement[] valueElements = element.getChildren("optionValue");
|
||||||
|
for (int i = 0; i < valueElements.length; ++i) {
|
||||||
|
valueList.add(valueElements[i].getAttribute("value"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.build.managed;
|
package org.eclipse.cdt.internal.core.build.managed;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.managed.BuildException;
|
import org.eclipse.cdt.core.build.managed.BuildException;
|
||||||
import org.eclipse.cdt.core.build.managed.IOption;
|
import org.eclipse.cdt.core.build.managed.IOption;
|
||||||
import org.eclipse.cdt.core.build.managed.IOptionCategory;
|
import org.eclipse.cdt.core.build.managed.IOptionCategory;
|
||||||
|
@ -17,6 +20,7 @@ import org.eclipse.cdt.core.build.managed.ITool;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -51,6 +55,20 @@ public class OptionReference implements IOption {
|
||||||
option = owner.getTool().getOption(element.getAttribute("id"));
|
option = owner.getTool().getOption(element.getAttribute("id"));
|
||||||
|
|
||||||
owner.addOptionReference(this);
|
owner.addOptionReference(this);
|
||||||
|
|
||||||
|
// value
|
||||||
|
switch (option.getValueType()) {
|
||||||
|
case IOption.STRING:
|
||||||
|
value = element.getAttribute("value");
|
||||||
|
break;
|
||||||
|
case IOption.STRING_LIST:
|
||||||
|
List valueList = new ArrayList();
|
||||||
|
IConfigurationElement[] valueElements = element.getChildren("optionValue");
|
||||||
|
for (int i = 0; i < valueElements.length; ++i) {
|
||||||
|
valueList.add(valueElements[i].getAttribute("value"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,6 +82,21 @@ public class OptionReference implements IOption {
|
||||||
option = owner.getTool().getOption(element.getAttribute("id"));
|
option = owner.getTool().getOption(element.getAttribute("id"));
|
||||||
|
|
||||||
owner.addOptionReference(this);
|
owner.addOptionReference(this);
|
||||||
|
|
||||||
|
// value
|
||||||
|
switch (option.getValueType()) {
|
||||||
|
case IOption.STRING:
|
||||||
|
value = element.getAttribute("value");
|
||||||
|
break;
|
||||||
|
case IOption.STRING_LIST:
|
||||||
|
List valueList = new ArrayList();
|
||||||
|
NodeList nodes = element.getElementsByTagName("optionValue");
|
||||||
|
for (int i = 0; i < nodes.getLength(); ++i) {
|
||||||
|
valueList.add(((Element)nodes.item(i)).getAttribute("value"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +107,20 @@ public class OptionReference implements IOption {
|
||||||
*/
|
*/
|
||||||
public void serealize(Document doc, Element element) {
|
public void serealize(Document doc, Element element) {
|
||||||
element.setAttribute("id", option.getId());
|
element.setAttribute("id", option.getId());
|
||||||
option = owner.getOption(element.getAttribute("id"));
|
|
||||||
|
// value
|
||||||
|
switch (option.getValueType()) {
|
||||||
|
case IOption.STRING:
|
||||||
|
element.setAttribute("value", (String)value);
|
||||||
|
break;
|
||||||
|
case IOption.STRING_LIST:
|
||||||
|
List valueList = (List)value;
|
||||||
|
for (int i = 0; i < valueList.size(); ++i) {
|
||||||
|
Element valueElement = doc.createElement("optionValue");
|
||||||
|
valueElement.setAttribute("value", (String)valueList.get(i));
|
||||||
|
element.appendChild(valueElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -22,6 +22,8 @@ import org.eclipse.cdt.core.build.managed.ITool;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -69,6 +71,20 @@ public class ToolReference implements ITool {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToolReference(Configuration owner, Element element) {
|
public ToolReference(Configuration owner, Element element) {
|
||||||
|
this.owner = owner;
|
||||||
|
|
||||||
|
Target parentTarget = (Target)owner.getTarget();
|
||||||
|
parent = ((Target)parentTarget.getParent()).getTool(element.getAttribute("id"));
|
||||||
|
|
||||||
|
owner.addToolReference(this);
|
||||||
|
|
||||||
|
NodeList configElements = element.getChildNodes();
|
||||||
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
|
Node configElement = configElements.item(i);
|
||||||
|
if (configElement.getNodeName().equals("optionRef")) {
|
||||||
|
new OptionReference(this, (Element)configElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serealize(Document doc, Element element) {
|
public void serealize(Document doc, Element element) {
|
||||||
|
@ -78,6 +94,7 @@ public class ToolReference implements ITool {
|
||||||
for (int i = 0; i < optionReferences.size(); ++i) {
|
for (int i = 0; i < optionReferences.size(); ++i) {
|
||||||
OptionReference optionRef = (OptionReference)optionReferences.get(i);
|
OptionReference optionRef = (OptionReference)optionReferences.get(i);
|
||||||
Element optionRefElement = doc.createElement("optionRef");
|
Element optionRefElement = doc.createElement("optionRef");
|
||||||
|
element.appendChild(optionRefElement);
|
||||||
optionRef.serealize(doc, optionRefElement);
|
optionRef.serealize(doc, optionRefElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,330 +1,343 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<!-- Schema file written by PDE -->
|
<!-- Schema file written by PDE -->
|
||||||
<schema targetNamespace="org.eclipse.cdt.core">
|
<schema targetNamespace="org.eclipse.cdt.core">
|
||||||
<annotation>
|
<annotation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
|
<meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
<documentation>
|
<documentation>
|
||||||
[Enter description of this extension point.]
|
[Enter description of this extension point.]
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
|
|
||||||
<element name="extension">
|
<element name="extension">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element ref="target"/>
|
<element ref="target"/>
|
||||||
<element ref="tool"/>
|
<element ref="tool"/>
|
||||||
<element ref="configuration"/>
|
<element ref="configuration"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="point" type="string" use="required">
|
<attribute name="point" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="id" type="string">
|
<attribute name="id" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="name" type="string">
|
<attribute name="name" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
<element name="tool">
|
<element name="tool">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element ref="option"/>
|
<element ref="option"/>
|
||||||
<element ref="optionCategory"/>
|
<element ref="optionCategory"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="id" type="string" use="required">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="name" type="string" use="required">
|
<attribute name="name" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="sources" type="string">
|
<attribute name="sources" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="outputs" type="string">
|
<attribute name="outputs" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="dependencyCalculator" type="string">
|
<attribute name="dependencyCalculator" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
</documentation>
|
</documentation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.attribute kind="java"/>
|
<meta.attribute kind="java"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
<element name="option">
|
<element name="option">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element ref="optionEnum"/>
|
<element ref="optionEnum"/>
|
||||||
</sequence>
|
<element ref="optionValue"/>
|
||||||
<attribute name="id" type="string" use="required">
|
</sequence>
|
||||||
<annotation>
|
<attribute name="id" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="name" type="string" use="required">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="name" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="type" use="default" value="string">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="valueType" use="default" value="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
<simpleType>
|
</annotation>
|
||||||
<restriction base="string">
|
<simpleType>
|
||||||
<enumeration value="string">
|
<restriction base="string">
|
||||||
</enumeration>
|
<enumeration value="string">
|
||||||
<enumeration value="enumeration">
|
</enumeration>
|
||||||
</enumeration>
|
<enumeration value="stringList">
|
||||||
</restriction>
|
</enumeration>
|
||||||
</simpleType>
|
</restriction>
|
||||||
</attribute>
|
</simpleType>
|
||||||
<attribute name="default" type="string">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="value" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="category" type="string">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="category" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
This is the id of the option category for this option. The id can be the id of the tool which is also a category.
|
<documentation>
|
||||||
</documentation>
|
This is the id of the option category for this option. The id can be the id of the tool which is also a category.
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<element name="optionEnum">
|
|
||||||
<complexType>
|
<element name="optionEnum">
|
||||||
<attribute name="id" type="string" use="required">
|
<complexType>
|
||||||
<annotation>
|
<attribute name="id" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="name" type="string" use="required">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="name" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<element name="configuration">
|
|
||||||
<complexType>
|
<element name="configuration">
|
||||||
<sequence>
|
<complexType>
|
||||||
<element ref="toolRef"/>
|
<sequence>
|
||||||
</sequence>
|
<element ref="toolRef"/>
|
||||||
<attribute name="id" type="string" use="required">
|
</sequence>
|
||||||
<annotation>
|
<attribute name="id" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="name" type="string" use="required">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="name" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<element name="toolRef">
|
|
||||||
<complexType>
|
<element name="toolRef">
|
||||||
<sequence>
|
<complexType>
|
||||||
<element ref="optionRef"/>
|
<sequence>
|
||||||
</sequence>
|
<element ref="optionRef"/>
|
||||||
<attribute name="id" type="string" use="required">
|
</sequence>
|
||||||
<annotation>
|
<attribute name="id" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<element name="optionRef">
|
|
||||||
<complexType>
|
<element name="optionRef">
|
||||||
<attribute name="id" type="string" use="required">
|
<complexType>
|
||||||
<annotation>
|
<attribute name="id" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="value" type="string" use="required">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="value" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<element name="target">
|
|
||||||
<annotation>
|
<element name="target">
|
||||||
<documentation>
|
<annotation>
|
||||||
Represents a type of resource that is the target of the build process, for example, a Linux Library. A target contains a sequence of tool definitions and configurations. Targets are arranged in an inheritance hierarchy where a target inherits the list of tools from it's parent and can add to or override tools in this list.
|
<documentation>
|
||||||
</documentation>
|
Represents a type of resource that is the target of the build process, for example, a Linux Library. A target contains a sequence of tool definitions and configurations. Targets are arranged in an inheritance hierarchy where a target inherits the list of tools from it's parent and can add to or override tools in this list.
|
||||||
</annotation>
|
</documentation>
|
||||||
<complexType>
|
</annotation>
|
||||||
<sequence>
|
<complexType>
|
||||||
<element ref="tool"/>
|
<sequence>
|
||||||
<element ref="configuration"/>
|
<element ref="tool"/>
|
||||||
</sequence>
|
<element ref="configuration"/>
|
||||||
<attribute name="id" type="string" use="required">
|
</sequence>
|
||||||
<annotation>
|
<attribute name="id" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="name" type="string" use="required">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="name" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="isAbstract" type="boolean" use="default" value="false">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="isAbstract" type="boolean" use="default" value="false">
|
||||||
<documentation>
|
<annotation>
|
||||||
This is a UI property. If set to true, users should not be able to create project configurations targeted at this target.
|
<documentation>
|
||||||
</documentation>
|
This is a UI property. If set to true, users should not be able to create project configurations targeted at this target.
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="parent" type="string">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="parent" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
The id of a target that this tool inherits from.
|
<documentation>
|
||||||
</documentation>
|
The id of a target that this tool inherits from.
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<element name="optionCategory">
|
|
||||||
<complexType>
|
<element name="optionCategory">
|
||||||
<attribute name="id" type="string">
|
<complexType>
|
||||||
<annotation>
|
<attribute name="id" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="name" type="string">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="name" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
<attribute name="owner" type="string">
|
</attribute>
|
||||||
<annotation>
|
<attribute name="owner" type="string">
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
</attribute>
|
</annotation>
|
||||||
</complexType>
|
</attribute>
|
||||||
</element>
|
</complexType>
|
||||||
|
</element>
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
<element name="optionValue">
|
||||||
<meta.section type="since"/>
|
<complexType>
|
||||||
</appInfo>
|
<attribute name="value" type="string" use="required">
|
||||||
<documentation>
|
<annotation>
|
||||||
[Enter the first release in which this extension point appears.]
|
<documentation>
|
||||||
</documentation>
|
|
||||||
</annotation>
|
</documentation>
|
||||||
|
</annotation>
|
||||||
<annotation>
|
</attribute>
|
||||||
<appInfo>
|
</complexType>
|
||||||
<meta.section type="examples"/>
|
</element>
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
<annotation>
|
||||||
[Enter extension point usage example here.]
|
<appInfo>
|
||||||
</documentation>
|
<meta.section type="since"/>
|
||||||
</annotation>
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
<annotation>
|
[Enter the first release in which this extension point appears.]
|
||||||
<appInfo>
|
</documentation>
|
||||||
<meta.section type="apiInfo"/>
|
</annotation>
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
<annotation>
|
||||||
[Enter API information here.]
|
<appInfo>
|
||||||
</documentation>
|
<meta.section type="examples"/>
|
||||||
</annotation>
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
<annotation>
|
[Enter extension point usage example here.]
|
||||||
<appInfo>
|
</documentation>
|
||||||
<meta.section type="implementation"/>
|
</annotation>
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
<annotation>
|
||||||
[Enter information about supplied implementation of this extension point.]
|
<appInfo>
|
||||||
</documentation>
|
<meta.section type="apiInfo"/>
|
||||||
</annotation>
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
<annotation>
|
[Enter API information here.]
|
||||||
<appInfo>
|
</documentation>
|
||||||
<meta.section type="copyright"/>
|
</annotation>
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
</documentation>
|
<meta.section type="implementation"/>
|
||||||
</annotation>
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
</schema>
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="copyright"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
</schema>
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class AllBuildTests extends TestCase {
|
||||||
* Navigates through the build info as defined in the extensions
|
* Navigates through the build info as defined in the extensions
|
||||||
* defined in this plugin
|
* defined in this plugin
|
||||||
*/
|
*/
|
||||||
public void testExtensions() {
|
public void testExtensions() throws Exception {
|
||||||
ITarget testRoot = null;
|
ITarget testRoot = null;
|
||||||
ITarget testSub = null;
|
ITarget testSub = null;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class AllBuildTests extends TestCase {
|
||||||
if (target.getName().equals("Test Root")) {
|
if (target.getName().equals("Test Root")) {
|
||||||
testRoot = target;
|
testRoot = target;
|
||||||
|
|
||||||
checkRootTarget(testRoot);
|
checkRootTarget(testRoot, "x");
|
||||||
|
|
||||||
} else if (target.getName().equals("Test Sub")) {
|
} else if (target.getName().equals("Test Sub")) {
|
||||||
testSub = target;
|
testSub = target;
|
||||||
|
@ -123,7 +123,19 @@ public class AllBuildTests extends TestCase {
|
||||||
for (int i = 0; i < configs.length; ++i)
|
for (int i = 0; i < configs.length; ++i)
|
||||||
target.createConfiguration(configs[i], target.getId() + "." + i);
|
target.createConfiguration(configs[i], target.getId() + "." + i);
|
||||||
|
|
||||||
checkRootTarget(target);
|
checkRootTarget(target, "x");
|
||||||
|
|
||||||
|
// Override the "Option in Category" option value
|
||||||
|
configs = target.getConfigurations();
|
||||||
|
ITool[] tools = configs[0].getTools();
|
||||||
|
IOptionCategory topCategory = tools[0].getTopOptionCategory();
|
||||||
|
IOptionCategory[] categories = topCategory.getChildCategories();
|
||||||
|
IOption[] options = categories[0].getOptions(configs[0]);
|
||||||
|
configs[0].setOption(options[0], "z");
|
||||||
|
options = categories[0].getOptions(null);
|
||||||
|
assertEquals("x", options[0].getStringValue());
|
||||||
|
options = categories[0].getOptions(configs[0]);
|
||||||
|
assertEquals("z", options[0].getStringValue());
|
||||||
|
|
||||||
// Save, close, reopen and test again
|
// Save, close, reopen and test again
|
||||||
ManagedBuildManager.saveBuildInfo(project);
|
ManagedBuildManager.saveBuildInfo(project);
|
||||||
|
@ -133,7 +145,7 @@ public class AllBuildTests extends TestCase {
|
||||||
|
|
||||||
targets = ManagedBuildManager.getTargets(project);
|
targets = ManagedBuildManager.getTargets(project);
|
||||||
assertEquals(1, targets.length);
|
assertEquals(1, targets.length);
|
||||||
checkRootTarget(targets[0]);
|
checkRootTarget(targets[0], "z");
|
||||||
}
|
}
|
||||||
|
|
||||||
IProject createProject(String name) throws CoreException {
|
IProject createProject(String name) throws CoreException {
|
||||||
|
@ -154,7 +166,7 @@ public class AllBuildTests extends TestCase {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkRootTarget(ITarget target) {
|
private void checkRootTarget(ITarget target, String oicValue) throws BuildException {
|
||||||
// Tools
|
// Tools
|
||||||
ITool[] tools = target.getTools();
|
ITool[] tools = target.getTools();
|
||||||
// Root Tool
|
// Root Tool
|
||||||
|
@ -164,7 +176,11 @@ public class AllBuildTests extends TestCase {
|
||||||
IOption[] options = rootTool.getOptions();
|
IOption[] options = rootTool.getOptions();
|
||||||
assertEquals(2, options.length);
|
assertEquals(2, options.length);
|
||||||
assertEquals("Option in Top", options[0].getName());
|
assertEquals("Option in Top", options[0].getName());
|
||||||
|
String[] valueList = options[0].getStringListValue();
|
||||||
|
assertEquals("a", valueList[0]);
|
||||||
|
assertEquals("b", valueList[1]);
|
||||||
assertEquals("Option in Category", options[1].getName());
|
assertEquals("Option in Category", options[1].getName());
|
||||||
|
assertEquals("x", options[1].getStringValue());
|
||||||
// Option Categories
|
// Option Categories
|
||||||
IOptionCategory topCategory = rootTool.getTopOptionCategory();
|
IOptionCategory topCategory = rootTool.getTopOptionCategory();
|
||||||
assertEquals("Root Tool", topCategory.getName());
|
assertEquals("Root Tool", topCategory.getName());
|
||||||
|
@ -187,11 +203,34 @@ public class AllBuildTests extends TestCase {
|
||||||
tools = rootConfig.getTools();
|
tools = rootConfig.getTools();
|
||||||
assertEquals(1, tools.length);
|
assertEquals(1, tools.length);
|
||||||
assertEquals("Root Tool", tools[0].getName());
|
assertEquals("Root Tool", tools[0].getName());
|
||||||
|
topCategory = tools[0].getTopOptionCategory();
|
||||||
|
options = topCategory.getOptions(configs[0]);
|
||||||
|
assertEquals(1, options.length);
|
||||||
|
assertEquals("Option in Top", options[0].getName());
|
||||||
|
valueList = options[0].getStringListValue();
|
||||||
|
assertEquals("a", valueList[0]);
|
||||||
|
assertEquals("b", valueList[1]);
|
||||||
|
categories = topCategory.getChildCategories();
|
||||||
|
options = categories[0].getOptions(configs[0]);
|
||||||
|
assertEquals("Option in Category", options[0].getName());
|
||||||
|
assertEquals(oicValue, options[0].getStringValue());
|
||||||
// Root Override Config
|
// Root Override Config
|
||||||
assertEquals("Root Override Config", configs[1].getName());
|
assertEquals("Root Override Config", configs[1].getName());
|
||||||
tools = configs[1].getTools();
|
tools = configs[1].getTools();
|
||||||
|
assertEquals(1, tools.length);
|
||||||
assertTrue(tools[0] instanceof ToolReference);
|
assertTrue(tools[0] instanceof ToolReference);
|
||||||
options = tools[0].getOptions();
|
assertEquals("Root Tool", tools[0].getName());
|
||||||
|
topCategory = tools[0].getTopOptionCategory();
|
||||||
|
options = topCategory.getOptions(configs[1]);
|
||||||
|
assertEquals(1, options.length);
|
||||||
|
assertEquals("Option in Top", options[0].getName());
|
||||||
|
valueList = options[0].getStringListValue();
|
||||||
|
assertEquals("a", valueList[0]);
|
||||||
|
assertEquals("b", valueList[1]);
|
||||||
|
categories = topCategory.getChildCategories();
|
||||||
|
options = categories[0].getOptions(configs[1]);
|
||||||
|
assertEquals("Option in Category", options[0].getName());
|
||||||
|
assertEquals("y", options[0].getStringValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
</optionCategory>
|
</optionCategory>
|
||||||
<option
|
<option
|
||||||
name="Compiler Flags"
|
name="Compiler Flags"
|
||||||
type="string"
|
valueType="string"
|
||||||
id="linux.compiler.flags">
|
id="linux.compiler.flags">
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
name="Optimization Flags"
|
name="Optimization Flags"
|
||||||
default="-O"
|
|
||||||
type="string"
|
|
||||||
category="linux.compiler.optimization"
|
category="linux.compiler.optimization"
|
||||||
|
value="-O"
|
||||||
|
valueType="string"
|
||||||
id="linux.compiler.optimizationFlags">
|
id="linux.compiler.optimizationFlags">
|
||||||
</option>
|
</option>
|
||||||
</tool>
|
</tool>
|
||||||
|
@ -106,11 +106,20 @@
|
||||||
</optionCategory>
|
</optionCategory>
|
||||||
<option
|
<option
|
||||||
name="Option in Top"
|
name="Option in Top"
|
||||||
|
valueType="stringList"
|
||||||
id="topOption">
|
id="topOption">
|
||||||
|
<optionValue
|
||||||
|
value="a">
|
||||||
|
</optionValue>
|
||||||
|
<optionValue
|
||||||
|
value="b">
|
||||||
|
</optionValue>
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
name="Option in Category"
|
name="Option in Category"
|
||||||
category="category"
|
category="category"
|
||||||
|
value="x"
|
||||||
|
valueType="string"
|
||||||
id="childOption">
|
id="childOption">
|
||||||
</option>
|
</option>
|
||||||
</tool>
|
</tool>
|
||||||
|
@ -124,8 +133,8 @@
|
||||||
<toolRef
|
<toolRef
|
||||||
id="root.tool">
|
id="root.tool">
|
||||||
<optionRef
|
<optionRef
|
||||||
value="x"
|
value="y"
|
||||||
id="topOption">
|
id="childOption">
|
||||||
</optionRef>
|
</optionRef>
|
||||||
</toolRef>
|
</toolRef>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
Loading…
Add table
Reference in a new issue