mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Apply Bill Hilliard's patch for adding resource specific custom build steps
This commit is contained in:
parent
d3db562481
commit
1eb10a46a0
13 changed files with 1159 additions and 90 deletions
|
@ -418,6 +418,39 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="rcbsApplicability">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Identifies how the user desires to apply a resource custom build step:
|
||||
1. Apply rcbs tool before any other tools defined for the resource.
|
||||
2. Apply rcbs tool after any other tools defined for the resource.
|
||||
3. Apply rcbs tool overriding any other tools defined for the resource.
|
||||
4. Disable (don't apply) the rcbs tool.
|
||||
</documentation>
|
||||
</annotation>
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<enumeration value="before">
|
||||
</enumeration>
|
||||
<enumeration value="after">
|
||||
</enumeration>
|
||||
<enumeration value="override">
|
||||
</enumeration>
|
||||
<enumeration value="disable">
|
||||
</enumeration>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
<attribute name="toolsToInvoke" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Identifies which tools to invoke by a semicolon separated list of child tool ids. Applies as follows:
|
||||
1. Defaults to all tools in the order found
|
||||
2. Use specified ordered list of children to invoke
|
||||
3. If empty string, treat as if no resource configuration existed, i.e., use project level tool.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -26,6 +26,16 @@ public interface IResourceConfiguration extends IBuildObject {
|
|||
public static final String RESOURCE_CONFIGURATION_ELEMENT_NAME = "resourceConfiguration"; //$NON-NLS-1$
|
||||
public static final String RESOURCE_PATH = "resourcePath"; //$NON-NLS-1$
|
||||
public static final String EXCLUDE = "exclude"; //$NON-NLS-1$
|
||||
public static final String RCBS_APPLICABILITY = "rcbsApplicability"; //$NON-NLS-1$
|
||||
public static final String TOOLS_TO_INVOKE = "toolsToInvoke"; //$NON-NLS-1$
|
||||
public static final String APPLY_RCBS_TOOL_AS_OVERRIDE = "override"; //$NON-NLS-1$
|
||||
public static final int KIND_APPLY_RCBS_TOOL_AS_OVERRIDE = 1;
|
||||
public static final String APPLY_RCBS_TOOL_BEFORE = "before"; //$NON-NLS-1$
|
||||
public static final int KIND_APPLY_RCBS_TOOL_BEFORE = 2;
|
||||
public static final String APPLY_RCBS_TOOL_AFTER = "after"; //$NON-NLS-1$
|
||||
public static final int KIND_APPLY_RCBS_TOOL_AFTER = 3;
|
||||
public static final String DISABLE_RCBS_TOOL = "disable"; //$NON-NLS-1$
|
||||
public static final int KIND_DISABLE_RCBS_TOOL = 4;
|
||||
|
||||
//TODO: Set name and ID in the constructors to be
|
||||
// configuration-name#resource-path
|
||||
|
@ -54,6 +64,30 @@ public interface IResourceConfiguration extends IBuildObject {
|
|||
*/
|
||||
public String getResourcePath();
|
||||
|
||||
/**
|
||||
* Returns an integer constant representing the users desire for ordering the application of
|
||||
* a resource custom build step tool.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getRcbsApplicability();
|
||||
|
||||
/**
|
||||
* Returns the list of tools currently defined for the project resource that
|
||||
* this element references. Updates the String attribute toolsToInvoke.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public ITool[] getToolsToInvoke();
|
||||
|
||||
/**
|
||||
* Sets the new value representing the users desire for ordering the application of
|
||||
* a resource custom build step tool.
|
||||
*
|
||||
* @param int
|
||||
*/
|
||||
public void setRcbsApplicability(int value);
|
||||
|
||||
/**
|
||||
* Sets the "excluded" flag for the resource.
|
||||
* If <code>true</code>, the project resource identified by the resoursePath
|
||||
|
@ -99,6 +133,13 @@ public interface IResourceConfiguration extends IBuildObject {
|
|||
*/
|
||||
public ITool getTool(String id);
|
||||
|
||||
/**
|
||||
* Removes the Tool from the Tool list and map
|
||||
*
|
||||
* @param Tool
|
||||
*/
|
||||
public void removeTool(ITool tool);
|
||||
|
||||
/**
|
||||
* Creates a <code>Tool</code> child for this resource configuration.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -16,6 +16,11 @@ import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildPathEnt
|
|||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
// NOTE: The code below is for tracking resource renaming and deleting. This is needed to keep
|
||||
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
|
||||
// elements
|
||||
//import org.eclipse.cdt.managedbuilder.internal.core.ResourceChangeHandler;
|
||||
//import org.eclipse.core.resources.*;
|
||||
|
||||
|
||||
public class ManagedBuilderCorePlugin extends Plugin {
|
||||
|
@ -27,6 +32,10 @@ public class ManagedBuilderCorePlugin extends Plugin {
|
|||
public static final String COMMANDLINEGEN_ID = "commandlineGenerator"; //$NON-NLS-1$
|
||||
// The unique id for all managed make projects
|
||||
public static final String MANAGED_MAKE_PROJECT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".managedMake"; //$NON-NLS-1$
|
||||
// NOTE: The code below is for tracking resource renaming and deleting. This is needed to keep
|
||||
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
|
||||
// elements
|
||||
//private static ResourceChangeHandler listener;
|
||||
|
||||
/**
|
||||
* @param descriptor
|
||||
|
@ -60,6 +69,31 @@ public class ManagedBuilderCorePlugin extends Plugin {
|
|||
// Turn on logging for plugin when debugging
|
||||
super.start(context);
|
||||
configurePluginDebugOptions();
|
||||
|
||||
// NOTE: The code below is for tracking resource renaming and deleting. This is needed to keep
|
||||
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
|
||||
// elements
|
||||
|
||||
// Set up a listener for resource change events
|
||||
//listener = new ResourceChangeHandler();
|
||||
//ResourcesPlugin.getWorkspace().addResourceChangeListener(
|
||||
// listener, IResourceChangeEvent.POST_CHANGE /*| IResourceChangeEvent.POST_BUILD*/);
|
||||
//ISavedState lastState =
|
||||
// ResourcesPlugin.getWorkspace().addSaveParticipant(plugin, listener);
|
||||
//if (lastState != null) {
|
||||
// lastState.processResourceChangeEvents(listener);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
// NOTE: The code below is for tracking resource renaming and deleting. This is needed to keep
|
||||
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
|
||||
// elements
|
||||
//ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
|
||||
}
|
||||
|
||||
private static final String PATH_ENTRY = ManagedBuilderCorePlugin.getUniqueIdentifier() + "/debug/pathEntry"; //$NON-NLS-1$
|
||||
|
|
|
@ -644,11 +644,13 @@ public class InputType extends BuildObject implements IInputType {
|
|||
String[] paths = current.getPaths();
|
||||
if (paths != null) {
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
if (paths[i].length() > 0) {
|
||||
deps.add(Path.fromOSString(paths[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (IPath[])deps.toArray(new IPath[deps.size()]);
|
||||
}
|
||||
|
||||
|
@ -666,11 +668,13 @@ public class InputType extends BuildObject implements IInputType {
|
|||
String[] paths = current.getPaths();
|
||||
if (paths != null) {
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
if (paths[i].length() > 0) {
|
||||
ins.add(Path.fromOSString(paths[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (IPath[])ins.toArray(new IPath[ins.size()]);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
// Managed Build model attributes
|
||||
private String resPath;
|
||||
private Boolean isExcluded;
|
||||
private Integer rcbsApplicability;
|
||||
private String toolsToInvoke;
|
||||
// Miscellaneous
|
||||
private boolean isExtensionResourceConfig = false;
|
||||
private boolean isDirty = false;
|
||||
|
@ -124,6 +126,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
resPath = path;
|
||||
isDirty = false;
|
||||
isExcluded = new Boolean(false);
|
||||
toolsToInvoke = EMPTY_STRING;
|
||||
rcbsApplicability = new Integer(KIND_DISABLE_RCBS_TOOL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,6 +152,12 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
if (cloneConfig.isExcluded != null) {
|
||||
isExcluded = new Boolean(cloneConfig.isExcluded.booleanValue());
|
||||
}
|
||||
if (cloneConfig.toolsToInvoke != null) {
|
||||
toolsToInvoke = new String(cloneConfig.toolsToInvoke);
|
||||
}
|
||||
if (cloneConfig.rcbsApplicability != null) {
|
||||
rcbsApplicability = new Integer(cloneConfig.rcbsApplicability.intValue());
|
||||
}
|
||||
|
||||
// Clone the resource configuration's tool children
|
||||
if (cloneConfig.toolList != null) {
|
||||
|
@ -226,6 +236,20 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
if (excludeStr != null){
|
||||
isExcluded = new Boolean("true".equals(excludeStr)); //$NON-NLS-1$
|
||||
}
|
||||
// toolsToInvoke
|
||||
toolsToInvoke = element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE);
|
||||
|
||||
// rcbsApplicability
|
||||
String rcbsApplicabilityStr = element.getAttribute(IResourceConfiguration.RCBS_APPLICABILITY);
|
||||
if (rcbsApplicabilityStr == null || rcbsApplicabilityStr.equals(DISABLE_RCBS_TOOL)) {
|
||||
rcbsApplicability = new Integer(KIND_DISABLE_RCBS_TOOL);
|
||||
} else if (rcbsApplicabilityStr.equals(APPLY_RCBS_TOOL_BEFORE)) {
|
||||
rcbsApplicability = new Integer(KIND_APPLY_RCBS_TOOL_BEFORE);
|
||||
} else if (rcbsApplicabilityStr.equals(APPLY_RCBS_TOOL_AFTER)) {
|
||||
rcbsApplicability = new Integer(KIND_APPLY_RCBS_TOOL_AFTER);
|
||||
} else if (rcbsApplicabilityStr.equals(APPLY_RCBS_TOOL_AS_OVERRIDE)) {
|
||||
rcbsApplicability = new Integer(KIND_APPLY_RCBS_TOOL_AS_OVERRIDE);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -256,6 +280,25 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
if (element.hasAttribute(IResourceConfiguration.RESOURCE_PATH)) {
|
||||
resPath = element.getAttribute(IResourceConfiguration.RESOURCE_PATH);
|
||||
}
|
||||
|
||||
// toolsToInvoke
|
||||
if (element.hasAttribute(IResourceConfiguration.TOOLS_TO_INVOKE)) {
|
||||
toolsToInvoke = element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE);
|
||||
}
|
||||
|
||||
// rcbsApplicability
|
||||
if (element.hasAttribute(IResourceConfiguration.RCBS_APPLICABILITY)) {
|
||||
String rcbsApplicabilityStr = element.getAttribute(IResourceConfiguration.RCBS_APPLICABILITY);
|
||||
if (rcbsApplicabilityStr == null || rcbsApplicabilityStr.equals(DISABLE_RCBS_TOOL)) {
|
||||
rcbsApplicability = new Integer(KIND_DISABLE_RCBS_TOOL);
|
||||
} else if (rcbsApplicabilityStr.equals(APPLY_RCBS_TOOL_BEFORE)) {
|
||||
rcbsApplicability = new Integer(KIND_APPLY_RCBS_TOOL_BEFORE);
|
||||
} else if (rcbsApplicabilityStr.equals(APPLY_RCBS_TOOL_AFTER)) {
|
||||
rcbsApplicability = new Integer(KIND_APPLY_RCBS_TOOL_AFTER);
|
||||
} else if (rcbsApplicabilityStr.equals(APPLY_RCBS_TOOL_AS_OVERRIDE)) {
|
||||
rcbsApplicability = new Integer(KIND_APPLY_RCBS_TOOL_AS_OVERRIDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,6 +323,32 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
element.setAttribute(IResourceConfiguration.RESOURCE_PATH, resPath);
|
||||
}
|
||||
|
||||
if (toolsToInvoke != null) {
|
||||
element.setAttribute(IResourceConfiguration.TOOLS_TO_INVOKE, toolsToInvoke);
|
||||
}
|
||||
|
||||
if (rcbsApplicability != null) {
|
||||
String str;
|
||||
switch (getRcbsApplicability()) {
|
||||
case KIND_APPLY_RCBS_TOOL_BEFORE:
|
||||
str = APPLY_RCBS_TOOL_BEFORE;
|
||||
break;
|
||||
case KIND_APPLY_RCBS_TOOL_AFTER:
|
||||
str = APPLY_RCBS_TOOL_AFTER;
|
||||
break;
|
||||
case KIND_APPLY_RCBS_TOOL_AS_OVERRIDE:
|
||||
str = APPLY_RCBS_TOOL_AS_OVERRIDE;
|
||||
break;
|
||||
case KIND_DISABLE_RCBS_TOOL:
|
||||
str = DISABLE_RCBS_TOOL;
|
||||
break;
|
||||
default:
|
||||
str = DISABLE_RCBS_TOOL;
|
||||
break;
|
||||
}
|
||||
element.setAttribute(IResourceConfiguration.RCBS_APPLICABILITY, str);
|
||||
}
|
||||
|
||||
// Serialize my children
|
||||
List toolElements = getToolList();
|
||||
Iterator iter = toolElements.listIterator();
|
||||
|
@ -361,6 +430,16 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
getToolMap().put(tool.getId(), tool);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Removes the Tool from the Tool list and map
|
||||
*
|
||||
* @param Tool
|
||||
*/
|
||||
public void removeTool(ITool tool) {
|
||||
getToolList().remove(tool);
|
||||
getToolMap().remove(tool);
|
||||
}
|
||||
|
||||
/*
|
||||
* M O D E L A T T R I B U T E A C C E S S O R S
|
||||
*/
|
||||
|
@ -386,6 +465,180 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
return path;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#getRcbsApplicability()
|
||||
*/
|
||||
public int getRcbsApplicability() {
|
||||
/*
|
||||
* rcbsApplicability is an integer constant that represents how the user wants to
|
||||
* order the application of a resource custom build step tool.
|
||||
* Defaults to disable rcbs tool.
|
||||
* Choices are before, after, or override other tools, or disable rcbs tool.
|
||||
*/
|
||||
if (rcbsApplicability == null) {
|
||||
return KIND_DISABLE_RCBS_TOOL;
|
||||
}
|
||||
return rcbsApplicability.intValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#getToolsToInvoke()
|
||||
*/
|
||||
public ITool[] getToolsToInvoke() {
|
||||
/*
|
||||
* toolsToInvoke is an ordered list of tool ids for the currently defined tools in
|
||||
* the resource configuration.
|
||||
* Defaults to all tools in the order found.
|
||||
* Modified by the presence of an rcbs tool and the currently assigned applicability of that tool.
|
||||
* The attribute is implemented as a String of a semicolon separated list of tool ids.
|
||||
* An empty string implies treat as if no resource configuration, i.e., use project level tool.
|
||||
* This getter routine returns an ITool[] to consumers (i.e., the makefile generator).
|
||||
*/
|
||||
String t_ToolsToInvoke = EMPTY_STRING;
|
||||
ITool[] resConfigTools;
|
||||
ITool[] tools;
|
||||
String id;
|
||||
String rcbsToolId = EMPTY_STRING;
|
||||
int len;
|
||||
int j;
|
||||
int rcbsToolIdx=-1;
|
||||
resConfigTools = getTools();
|
||||
|
||||
/*
|
||||
* Evaluate the tools currently defined in the resource configuration.
|
||||
* Update the current state of the toolsToInvoke attribute.
|
||||
* Build and return an ITool[] for consumers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If no tools are currently defined, return a zero lengh array of ITool.
|
||||
*/
|
||||
if (resConfigTools.length == 0) {
|
||||
toolsToInvoke = EMPTY_STRING;
|
||||
tools = new ITool[0];
|
||||
return tools;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if there is an rcbs tool defined. There should only be one at most.
|
||||
*/
|
||||
for ( int i = 0; i < resConfigTools.length; i++ ){
|
||||
if (resConfigTools[i].getCustomBuildStep() && !resConfigTools[i].isExtensionElement()) {
|
||||
rcbsToolId = resConfigTools[i].getId();
|
||||
rcbsToolIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!rcbsToolId.equals(EMPTY_STRING)){
|
||||
/*
|
||||
* Here if an rcbs tool is defined.
|
||||
* Apply the tools according to the current rcbsApplicability setting.
|
||||
*/
|
||||
switch(rcbsApplicability.intValue()){
|
||||
case KIND_APPLY_RCBS_TOOL_AS_OVERRIDE:
|
||||
toolsToInvoke = rcbsToolId;
|
||||
tools = new ITool[1];
|
||||
tools[0] = resConfigTools[rcbsToolIdx];
|
||||
break;
|
||||
case KIND_APPLY_RCBS_TOOL_AFTER:
|
||||
j = 0;
|
||||
tools = new ITool[resConfigTools.length];
|
||||
for ( int i = 0; i < resConfigTools.length; i++ ){
|
||||
if (resConfigTools[i].getId() != rcbsToolId) {
|
||||
t_ToolsToInvoke += resConfigTools[i].getId() + ";"; //$NON-NLS-1$
|
||||
tools[j++] = resConfigTools[i];
|
||||
}
|
||||
}
|
||||
t_ToolsToInvoke += rcbsToolId;
|
||||
tools[j++] = resConfigTools[rcbsToolIdx];
|
||||
toolsToInvoke = t_ToolsToInvoke;
|
||||
break;
|
||||
case KIND_APPLY_RCBS_TOOL_BEFORE:
|
||||
j = 0;
|
||||
tools = new ITool[resConfigTools.length];
|
||||
t_ToolsToInvoke = rcbsToolId + ";"; //$NON-NLS-1$
|
||||
tools[j++] = resConfigTools[rcbsToolIdx];
|
||||
for ( int i = 0; i < resConfigTools.length; i++ ){
|
||||
if (resConfigTools[i].getId() != rcbsToolId) {
|
||||
t_ToolsToInvoke += resConfigTools[i].getId() + ";"; //$NON-NLS-1$
|
||||
tools[j++] = resConfigTools[i];
|
||||
}
|
||||
}
|
||||
len = t_ToolsToInvoke.length();
|
||||
t_ToolsToInvoke = t_ToolsToInvoke.substring(0,len-1);
|
||||
toolsToInvoke = t_ToolsToInvoke;
|
||||
break;
|
||||
case KIND_DISABLE_RCBS_TOOL:
|
||||
/*
|
||||
* If the rcbs tool is the only tool and the user has disabled it,
|
||||
* there are no tools to invoke in the resource configuration.
|
||||
*/
|
||||
if(resConfigTools.length == 1){
|
||||
tools = new ITool[0];
|
||||
toolsToInvoke = EMPTY_STRING;
|
||||
break;
|
||||
}
|
||||
j = 0;
|
||||
tools = new ITool[resConfigTools.length-1];
|
||||
for ( int i = 0; i < resConfigTools.length; i++ ){
|
||||
if (resConfigTools[i].getId() != rcbsToolId) {
|
||||
t_ToolsToInvoke += resConfigTools[i].getId() + ";"; //$NON-NLS-1$
|
||||
tools[j++] = resConfigTools[i];
|
||||
}
|
||||
}
|
||||
len = t_ToolsToInvoke.length();
|
||||
t_ToolsToInvoke = t_ToolsToInvoke.substring(0,len-1);
|
||||
toolsToInvoke = t_ToolsToInvoke;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* If we get an unexpected value, apply all tools in the order found.
|
||||
*/
|
||||
tools = new ITool[resConfigTools.length];
|
||||
for ( int i = 0; i < resConfigTools.length; i++ ){
|
||||
t_ToolsToInvoke += resConfigTools[i].getId() + ";"; //$NON-NLS-1$
|
||||
tools[i] = resConfigTools[i];
|
||||
}
|
||||
len = t_ToolsToInvoke.length();
|
||||
t_ToolsToInvoke = t_ToolsToInvoke.substring(0,len-1);
|
||||
toolsToInvoke = t_ToolsToInvoke;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Here if no rcbs tool is defined, but there are other tools in the resource configuration.
|
||||
* Specify all tools in the order found.
|
||||
*/
|
||||
tools = new ITool[resConfigTools.length];
|
||||
for ( int i = 0; i < resConfigTools.length; i++ ){
|
||||
t_ToolsToInvoke += resConfigTools[i].getId() + ";"; //$NON-NLS-1$
|
||||
tools[i] = resConfigTools[i];
|
||||
}
|
||||
len = t_ToolsToInvoke.length();
|
||||
t_ToolsToInvoke = t_ToolsToInvoke.substring(0,len-1);
|
||||
toolsToInvoke = t_ToolsToInvoke;
|
||||
}
|
||||
return tools;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#getRcbsApplicability()
|
||||
*/
|
||||
public void setRcbsApplicability(int newValue) {
|
||||
/*
|
||||
* rcbsApplicability is an integer constant that represents how the user wants to
|
||||
* order the application of a resource custom build step tool.
|
||||
* Defaults to override all other tools.
|
||||
* Choices are before, after, or override other tools, or disable rcbs tool.
|
||||
*/
|
||||
if (rcbsApplicability == null || !(rcbsApplicability.intValue() == newValue)) {
|
||||
rcbsApplicability = new Integer(newValue);
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IResourceConfiguration#setExclude()
|
||||
*/
|
||||
|
|
|
@ -559,7 +559,7 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
|||
ITool buildTools[] = null;
|
||||
IResourceConfiguration rcCfg = cfg.getResourceConfiguration(inputPath.toOSString());
|
||||
if(rcCfg != null)
|
||||
buildTools = rcCfg.getTools();
|
||||
buildTools = rcCfg.getToolsToInvoke();
|
||||
else
|
||||
buildTools = cfg.getFilteredTools();
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerat
|
|||
String outputPrefix = ""; //$NON-NLS-1$
|
||||
String outputFile = ""; //$NON-NLS-1$
|
||||
if( resConfig != null) {
|
||||
ITool[] tools = resConfig.getTools();
|
||||
ITool[] tools = resConfig.getToolsToInvoke();
|
||||
String cmd = tools[0].getToolCommand();
|
||||
//try to resolve the build macros in the tool command
|
||||
try{
|
||||
|
|
|
@ -202,19 +202,25 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
|
||||
// Is this a resource we should even consider
|
||||
if (proxy.getType() == IResource.FILE) {
|
||||
// Check extension to see if build model should build this file
|
||||
// If this resource has a Resource Configuration and is not excluded or
|
||||
// if it has a file extension that one of the tools builds, add the sudirectory to the list
|
||||
IResource resource = proxy.requestResource();
|
||||
String ext = resource.getFileExtension();
|
||||
if (info.buildsFileType(ext)) {
|
||||
// If this file resource is a generated resource, then it is uninteresting
|
||||
if (!generator.isGeneratedResource(resource)) {
|
||||
// If this file resource is excluded from build, then it is uninteresting
|
||||
boolean willBuild = false;
|
||||
IResourceConfiguration resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
|
||||
if (resConfig != null) willBuild = true;
|
||||
if (!willBuild) {
|
||||
String ext = resource.getFileExtension();
|
||||
if (info.buildsFileType(ext) &&
|
||||
// If this file resource is a generated resource, then it is uninteresting
|
||||
!generator.isGeneratedResource(resource)) {
|
||||
willBuild = true;
|
||||
}
|
||||
}
|
||||
if (willBuild) {
|
||||
if ((resConfig == null) || (!(resConfig.isExcluded()))) {
|
||||
generator.appendBuildSubdirectory(resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -567,7 +573,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getTopBuildDir()
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getBuildWorkingDir()
|
||||
*/
|
||||
public IPath getBuildWorkingDir() {
|
||||
if (topBuildDir != null) {
|
||||
|
@ -1814,7 +1820,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
if( (resConfig != null) && (resConfig.isExcluded()) )
|
||||
continue;
|
||||
addFragmentMakefileEntriesForSource(buildVarToRuleStringMap, ruleBuffer,
|
||||
folder, relativePath, resource, resource.getLocation(), null, false);
|
||||
folder, relativePath, resource, resource.getLocation(), resConfig, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1832,19 +1838,30 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
* @param relativePath build output directory relative path of the current output directory
|
||||
* @param resource the source file for this invocation of the tool - this may be null for a generated output
|
||||
* @param sourceLocation the full path of the source
|
||||
* @param resConfig the IResourceConfiguration associated with this file or null
|
||||
* @param varName the build variable to add this invocation's outputs to
|
||||
* if <code>null</code>, use the file extension to find the name
|
||||
* @param generatedSource if <code>true</code>, this file was generated by another tool in the tool-chain
|
||||
*/
|
||||
protected void addFragmentMakefileEntriesForSource (LinkedHashMap buildVarToRuleStringMap, StringBuffer ruleBuffer,
|
||||
IFolder folder, String relativePath, IResource resource, IPath sourceLocation, String varName, boolean generatedSource) {
|
||||
IFolder folder, String relativePath, IResource resource, IPath sourceLocation, IResourceConfiguration resConfig,
|
||||
String varName, boolean generatedSource) {
|
||||
// Determine which tool, if any, builds files with this extension
|
||||
String ext = sourceLocation.getFileExtension();
|
||||
boolean toolFound = false;
|
||||
ITool tool = null;
|
||||
|
||||
// Use the tool from the resource configuration if there is one
|
||||
if (resConfig != null) {
|
||||
ITool[] tools = resConfig.getToolsToInvoke();
|
||||
if (tools != null && tools.length > 0) {
|
||||
tool = tools[0];
|
||||
}
|
||||
}
|
||||
for (int j=0; j<buildTools.length; j++) {
|
||||
if (buildTools[j].buildsFileType(ext)) {
|
||||
toolFound = true;
|
||||
ITool tool = buildTools[j];
|
||||
if (tool == null) {
|
||||
tool = buildTools[j];
|
||||
}
|
||||
// look for the extension in the map
|
||||
StringBuffer bufferForExtension = new StringBuffer();
|
||||
if (varName == null) {
|
||||
|
@ -1865,11 +1882,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
}
|
||||
if (!buildVarToRuleStringMap.containsKey(varName)) {
|
||||
// TODO - is this an error?
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// Add the resource name to the makefile line that adds resources to the build variable
|
||||
addMacroAdditionFile(buildVarToRuleStringMap, varName, relativePath, sourceLocation, generatedSource);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tool != null) {
|
||||
// Generate the rule to build this source file
|
||||
IInputType primaryInputType = tool.getPrimaryInputType();
|
||||
IInputType inputType = tool.getInputType(ext);
|
||||
|
@ -1879,7 +1900,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
// Try to add the rule for the file
|
||||
StringBuffer generatedDepFile = new StringBuffer();
|
||||
Vector generatedOutputs = new Vector();
|
||||
addRuleForSource(relativePath, ruleBuffer, resource, sourceLocation, generatedSource, generatedDepFile, generatedOutputs);
|
||||
addRuleForSource(relativePath, ruleBuffer, resource, sourceLocation, resConfig, generatedSource, generatedDepFile, generatedOutputs);
|
||||
|
||||
// If the rule generates a dependency file, add the file to the DEPS variable
|
||||
if (generatedDepFile.length() > 0) {
|
||||
|
@ -1893,7 +1914,25 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
IOutputType outType = tool.getPrimaryOutputType();
|
||||
String buildVariable = null;
|
||||
if (outType != null) {
|
||||
if (tool.getCustomBuildStep()) {
|
||||
// TODO: This is somewhat of a hack since a custom build step
|
||||
// tool does not currently define a build variable
|
||||
if (generatedOutputs.size() > 0) {
|
||||
IPath firstOutput = (IPath)generatedOutputs.get(0);
|
||||
String firstExt = firstOutput.getFileExtension();
|
||||
for (int j=0; j<buildTools.length; j++) {
|
||||
if (buildTools[j].buildsFileType(firstExt)) {
|
||||
String bV = buildTools[j].getPrimaryInputType().getBuildVariable();
|
||||
if (bV.length() > 0) {
|
||||
buildVariable = bV;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buildVariable = outType.getBuildVariable();
|
||||
}
|
||||
} else {
|
||||
// For support of pre-CDT 3.0 integrations.
|
||||
buildVariable = OBJS_MACRO;
|
||||
|
@ -1911,12 +1950,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
// because the file is not under the project. We use this resource in the calls to the dependency generator
|
||||
IResource generateOutputResource = project.getFile(generatedOutput);
|
||||
addFragmentMakefileEntriesForSource(buildVarToRuleStringMap, ruleBuffer,
|
||||
folder, relativePath, generateOutputResource, generatedOutput, buildVariable, true);
|
||||
folder, relativePath, generateOutputResource, generatedOutput, null, buildVariable, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!toolFound) {
|
||||
} else {
|
||||
// If this generated output is identified as a secondary output, add the file to the build variable
|
||||
if (varName != null) {
|
||||
IOutputType[] secondaryOutputs = config.getToolChain().getSecondaryOutputs();
|
||||
|
@ -1961,26 +1998,23 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
* @param buffer buffer to populate with the build rule
|
||||
* @param resource the source file for this invocation of the tool
|
||||
* @param generatedSource <code>true</code> if the resource is a generated output
|
||||
* @param sourceLocation the full path of the source
|
||||
* @param resConfig the IResourceConfiguration associated with this file or null
|
||||
* @param generatedDepFile passed in as an empty string; append the dependency file name
|
||||
* to it if one is generated by the rule
|
||||
* @param enumeratedOutputs vector of the filenames that are the output of this rule
|
||||
*/
|
||||
protected void addRuleForSource(String relativePath, StringBuffer buffer, IResource resource,
|
||||
IPath sourceLocation, boolean generatedSource, StringBuffer generatedDepFile, Vector enumeratedOutputs) {
|
||||
IPath sourceLocation, IResourceConfiguration resConfig,
|
||||
boolean generatedSource, StringBuffer generatedDepFile, Vector enumeratedOutputs) {
|
||||
|
||||
String fileName = sourceLocation.removeFileExtension().lastSegment();
|
||||
String inputExtension = sourceLocation.getFileExtension();
|
||||
String outputExtension = info.getOutputExtension(inputExtension);
|
||||
|
||||
// We need to check whether we have any resource specific build information.
|
||||
IResourceConfiguration resConfig = null;
|
||||
if( !generatedSource && config != null ) {
|
||||
resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
|
||||
}
|
||||
|
||||
ITool tool;
|
||||
if( resConfig != null) {
|
||||
ITool[] tools = resConfig.getTools();
|
||||
ITool[] tools = resConfig.getToolsToInvoke();
|
||||
tool = tools[0];
|
||||
} else {
|
||||
tool = info.getToolFromInputExtension(inputExtension);
|
||||
|
@ -2131,7 +2165,18 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
||||
IPath[] addlDepPaths = tool.getAdditionalDependencies();
|
||||
for (int i=0; i<addlDepPaths.length; i++) {
|
||||
buildRule += WHITESPACE + addlDepPaths[i].toString();
|
||||
// Translate the path from project relative to
|
||||
// build directory relative
|
||||
IPath addlPath = addlDepPaths[i];
|
||||
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
||||
if (!addlPath.isAbsolute()) {
|
||||
IPath tempPath = project.getLocation().append(addlPath);
|
||||
if (tempPath != null) {
|
||||
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
buildRule += WHITESPACE + addlPath.toString();
|
||||
}
|
||||
|
||||
// No duplicates in a makefile. If we already have this rule, return
|
||||
|
@ -2169,7 +2214,18 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
||||
IPath[] addlInputPaths = tool.getAdditionalResources();
|
||||
for (int i=0; i<addlInputPaths.length; i++) {
|
||||
inputs.add(addlDepPaths[i].toString());
|
||||
// Translate the path from project relative to
|
||||
// build directory relative
|
||||
IPath addlPath = addlInputPaths[i];
|
||||
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
||||
if (!addlPath.isAbsolute()) {
|
||||
IPath tempPath = project.getLocation().append(addlPath);
|
||||
if (tempPath != null) {
|
||||
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
inputs.add(addlPath.toString());
|
||||
}
|
||||
// Call the command line generator
|
||||
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
|
||||
|
@ -2193,7 +2249,18 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
||||
IPath[] addlInputPaths = tool.getAdditionalResources();
|
||||
for (int i=0; i<addlInputPaths.length; i++) {
|
||||
inputs.add(addlDepPaths[i].toString());
|
||||
// Translate the path from project relative to
|
||||
// build directory relative
|
||||
IPath addlPath = addlInputPaths[i];
|
||||
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
||||
if (!addlPath.isAbsolute()) {
|
||||
IPath tempPath = project.getLocation().append(addlPath);
|
||||
if (tempPath != null) {
|
||||
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
inputs.add(addlPath.toString());
|
||||
}
|
||||
// Call the command line generator
|
||||
cmdLInfo = info.generateToolCommandLineInfo( inputExtension, flags, outflag, outputPrefix,
|
||||
|
@ -3270,4 +3337,43 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the configuration's top build directory
|
||||
*/
|
||||
public IPath getTopBuildDir() {
|
||||
return project.getLocation().append(getBuildWorkingDir());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate a relative path given the full path to a folder and a file
|
||||
*/
|
||||
public IPath calculateRelativePath(IPath container, IPath contents){
|
||||
IPath path = contents;
|
||||
if(container.isPrefixOf(contents)){
|
||||
path = contents.setDevice(null).removeFirstSegments(container.segmentCount());
|
||||
} else {
|
||||
String file = null;
|
||||
container = container.addTrailingSeparator();
|
||||
if(!contents.hasTrailingSeparator()){
|
||||
file = contents.lastSegment();
|
||||
contents = contents.removeLastSegments(1);
|
||||
contents = contents.addTrailingSeparator();
|
||||
}
|
||||
|
||||
IPath prefix = contents;
|
||||
for(;prefix.segmentCount() > 0 && !prefix.isPrefixOf(container);prefix = prefix.removeLastSegments(1)){
|
||||
}
|
||||
if(prefix.segmentCount() > 0){
|
||||
int diff = container.segmentCount() - prefix.segmentCount();
|
||||
StringBuffer buff = new StringBuffer();
|
||||
while(diff-- > 0)
|
||||
buff.append("../"); //$NON-NLS-1$
|
||||
path = new Path(buff.toString()).append(contents.removeFirstSegments(prefix.segmentCount()));
|
||||
if(file != null)
|
||||
path = path.append(file);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -272,8 +272,20 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
|
|||
String[] paths = addlInput.getPaths();
|
||||
if (paths != null) {
|
||||
for (int k = 0; k < paths.length; k++) {
|
||||
myCommandInputs.add(paths[k]);
|
||||
myEnumeratedInputs.add(paths[k]);
|
||||
// Translate the path from project relative to
|
||||
// build directory relative
|
||||
String path = paths[k];
|
||||
if (!(path.startsWith("$("))) { //$NON-NLS-1$
|
||||
IResource addlResource = project.getFile(path);
|
||||
if (addlResource != null) {
|
||||
IPath addlPath = addlResource.getLocation();
|
||||
if (addlPath != null) {
|
||||
path = makeGen.calculateRelativePath(makeGen.getTopBuildDir(), addlPath).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
myCommandInputs.add(path);
|
||||
myEnumeratedInputs.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -635,8 +647,20 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
|
|||
String[] paths = addlInput.getPaths();
|
||||
if (paths != null) {
|
||||
for (int k = 0; k < paths.length; k++) {
|
||||
myCommandDependencies.add(paths[k]);
|
||||
//myEnumeratedInputs.add(pathTokens[k]);
|
||||
// Translate the path from project relative to
|
||||
// build directory relative
|
||||
String path = paths[k];
|
||||
if (!(path.startsWith("$("))) { //$NON-NLS-1$
|
||||
IResource addlResource = project.getFile(path);
|
||||
if (addlResource != null) {
|
||||
IPath addlPath = addlResource.getLocation();
|
||||
if (addlPath != null) {
|
||||
path = makeGen.calculateRelativePath(makeGen.getTopBuildDir(), addlPath).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
myCommandDependencies.add(path);
|
||||
//myEnumeratedInputs.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.ui.help.WorkbenchHelp;
|
|||
public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
||||
|
||||
private ToolsSettingsBlock toolsSettingsBlock;
|
||||
private ResourceCustomBuildStepBlock resCustomBuildStepBlock;
|
||||
private BuildSettingsBlock buildSettingsBlock;
|
||||
private BuildStepSettingsBlock buildStepSettingsBlock;
|
||||
private ErrorParserBlock errParserBlock;
|
||||
|
@ -81,6 +82,7 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
addTab(macrosBlock = new MacrosSetBlock((BuildPropertyPage) fParent));
|
||||
} else if (element instanceof IFile) {
|
||||
addTab(toolsSettingsBlock = new ToolsSettingsBlock((ResourceBuildPropertyPage) fParent, element));
|
||||
addTab(resCustomBuildStepBlock = new ResourceCustomBuildStepBlock((ResourceBuildPropertyPage) fParent));
|
||||
} else if (element instanceof IWorkspace) {
|
||||
addTab(environmentBlock = new EnvironmentSetBlock((BuildPreferencePage) fParent));
|
||||
addTab(macrosBlock = new MacrosSetBlock((BuildPreferencePage) fParent));
|
||||
|
@ -91,6 +93,10 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
return toolsSettingsBlock;
|
||||
}
|
||||
|
||||
public ResourceCustomBuildStepBlock getResourceCustomBuildStepBlock() {
|
||||
return resCustomBuildStepBlock;
|
||||
}
|
||||
|
||||
public BuildSettingsBlock getBuildSettingsBlock() {
|
||||
return buildSettingsBlock;
|
||||
}
|
||||
|
@ -135,6 +141,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
if (getToolsSettingsBlock()!= null) {
|
||||
getToolsSettingsBlock().initializeValues();
|
||||
}
|
||||
if (getResourceCustomBuildStepBlock()!= null) {
|
||||
getResourceCustomBuildStepBlock().initializeValues();
|
||||
}
|
||||
if (getBuildSettingsBlock()!= null) {
|
||||
getBuildSettingsBlock().initializeValues();
|
||||
}
|
||||
|
@ -182,6 +191,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
if (getToolsSettingsBlock() != null) {
|
||||
getToolsSettingsBlock().updateValues();
|
||||
}
|
||||
if (getResourceCustomBuildStepBlock() != null) {
|
||||
getResourceCustomBuildStepBlock().updateValues();
|
||||
}
|
||||
} else if(element instanceof IWorkspace) {
|
||||
if(getCurrentPage() instanceof EnvironmentSetBlock) {
|
||||
((EnvironmentSetBlock)getCurrentPage()).updateValues();
|
||||
|
@ -220,6 +232,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
if (getToolsSettingsBlock() != null) {
|
||||
getToolsSettingsBlock().updateValues();
|
||||
}
|
||||
if (getResourceCustomBuildStepBlock() != null) {
|
||||
getResourceCustomBuildStepBlock().setValues();
|
||||
}
|
||||
} else if (element instanceof IWorkspace) {
|
||||
if(getCurrentPage() instanceof EnvironmentSetBlock) {
|
||||
((EnvironmentSetBlock)getCurrentPage()).updateValues();
|
||||
|
@ -257,6 +272,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
if (getToolsSettingsBlock()!= null) {
|
||||
getToolsSettingsBlock().removeValues(id);
|
||||
}
|
||||
if (getResourceCustomBuildStepBlock() != null) {
|
||||
getResourceCustomBuildStepBlock().removeValues(id);
|
||||
}
|
||||
} else if (element instanceof IWorkspace) {
|
||||
if(getEnvironmentBlock()!= null) {
|
||||
}
|
||||
|
@ -293,6 +311,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
if (getCurrentPage() instanceof ToolsSettingsBlock) {
|
||||
return toolsSettingsBlock.getPreferenceStore();
|
||||
}
|
||||
if (getCurrentPage() instanceof ResourceCustomBuildStepBlock) {
|
||||
return resCustomBuildStepBlock.getPreferenceStore();
|
||||
}
|
||||
} else if (element instanceof IWorkspace) {
|
||||
if(getCurrentPage() instanceof EnvironmentSetBlock) {
|
||||
return null;
|
||||
|
@ -344,6 +365,8 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
ICOptionPage tab = (ICOptionPage)iter.next();
|
||||
if (tab instanceof BuildSettingsBlock) {
|
||||
((BuildSettingsBlock)tab).setDirty(b);
|
||||
} else if (tab instanceof ResourceCustomBuildStepBlock) {
|
||||
((ResourceCustomBuildStepBlock)tab).setDirty(b);
|
||||
} else if (tab instanceof ToolsSettingsBlock) {
|
||||
((ToolsSettingsBlock)tab).setDirty(b);
|
||||
} else if (tab instanceof BuildStepSettingsBlock) {
|
||||
|
@ -370,6 +393,8 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
|
|||
ICOptionPage tab = (ICOptionPage)iter.next();
|
||||
if (tab instanceof BuildSettingsBlock) {
|
||||
if (((BuildSettingsBlock)tab).isDirty()) return true;
|
||||
} else if (tab instanceof ResourceCustomBuildStepBlock) {
|
||||
if (((ResourceCustomBuildStepBlock)tab).isDirty()) return true;
|
||||
} else if (tab instanceof ToolsSettingsBlock) {
|
||||
if (((ToolsSettingsBlock)tab).isDirty()) return true;
|
||||
} else if (tab instanceof BuildStepSettingsBlock) {
|
||||
|
|
|
@ -221,6 +221,26 @@ ResourceBuildPropertyPage.config.notselected=No configurations selected
|
|||
ResourceBuildPropertyPage.rc.non.build=Managed Build settings for this resource are not available
|
||||
ResourceBuildPropertyPage.rc.generated=The selected resource is created by the buildfile generator
|
||||
|
||||
# ----------- Resource Custom Build Step Block -----------
|
||||
ResourceCustomBuildStepBlock.label.settings=Custom Build Steps
|
||||
ResourceCustomBuildStepBlock.label.tool.group=Resource Custom Build Step
|
||||
ResourceCustomBuildStepBlock.label.applicability=Custom Build Step Applicability
|
||||
ResourceCustomBuildStepBlock.label.applicability.rule.before=Apply Custom Build Step Before Other Tools
|
||||
ResourceCustomBuildStepBlock.label.applicability.rule.after=Apply Custom Build Step After Other Tools
|
||||
ResourceCustomBuildStepBlock.label.applicability.rule.override=Apply Custom Build Step Overriding Other Tools
|
||||
ResourceCustomBuildStepBlock.label.applicability.rule.disable=Disable Custom Build Step
|
||||
ResourceCustomBuildStepBlock.label.input.filenames=Additional Input file name(s):
|
||||
ResourceCustomBuildStepBlock.label.output.filenames=Output file name(s):
|
||||
ResourceCustomBuildStepBlock.label.command.cmd=Command:
|
||||
ResourceCustomBuildStepBlock.label.description.desc=Description:
|
||||
ResourceCustomBuildStepBlock.tip.applicability=specifies how to apply the custom build step with respect to other resource configuration tools
|
||||
ResourceCustomBuildStepBlock.tip.inputs=a semicolon separated list of additional input files for this build step. Paths are interpreted as relative to the Project directory.
|
||||
ResourceCustomBuildStepBlock.tip.outputs=a semicolon separated list of the output files produced by this build step. Paths are interpreted as relative to the Build directory.
|
||||
ResourceCustomBuildStepBlock.tip.command=a semicolon separated list of commands or a single command to be executed by this build step. Paths are interpreted as relative to the Build directory.
|
||||
ResourceCustomBuildStepBlock.tip.announcement=a message to be output in the build log upon execution of this build step
|
||||
ResourceCustomBuildStepBlock.defaults.title=Reset Resource Custom Build Step
|
||||
ResourceCustomBuildStepBlock.defaults.message=This action will reset the resource custom build step to the default settings.\n\nDo you want to proceed?
|
||||
|
||||
# ----------- Entry Dialog -----------
|
||||
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
|
||||
BrowseEntryDialog.title.file = Select File
|
||||
|
|
|
@ -0,0 +1,529 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2005 Intel 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:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui;
|
||||
|
||||
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOutputType;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
|
||||
public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
|
||||
|
||||
/*
|
||||
* String constants
|
||||
*/
|
||||
private static final String PREFIX = "ResourceCustomBuildStepBlock"; //$NON-NLS-1$
|
||||
private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
|
||||
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
||||
private static final String SETTINGS_LABEL = LABEL + ".settings"; //$NON-NLS-1$
|
||||
private static final String RCBS_TOOL_GROUP = LABEL + ".tool.group"; //$NON-NLS-1$
|
||||
private static final String RCBS_APPLICABILITY = LABEL + ".applicability"; //$NON-NLS-1$
|
||||
private static final String RCBS_BEFORE = LABEL + ".applicability.rule.before"; //$NON-NLS-1$
|
||||
private static final String RCBS_AFTER = LABEL + ".applicability.rule.after"; //$NON-NLS-1$
|
||||
private static final String RCBS_OVERRIDE = LABEL + ".applicability.rule.override"; //$NON-NLS-1$
|
||||
private static final String RCBS_DISABLE = LABEL + ".applicability.rule.disable"; //$NON-NLS-1$
|
||||
private static final String INPUT_FILENAMES = LABEL + ".input.filenames"; //$NON-NLS-1$
|
||||
private static final String OUTPUT_FILENAMES = LABEL + ".output.filenames"; //$NON-NLS-1$
|
||||
private static final String COMMAND_CMD = LABEL + ".command.cmd"; //$NON-NLS-1$
|
||||
private static final String DESCRIPTION_DESC = LABEL + ".description.desc"; //$NON-NLS-1$
|
||||
private static final String APPLICABILITY_TIP = TIP + ".applicability"; //$NON-NLS-1$
|
||||
private static final String INPUTS_TIP = TIP + ".inputs"; //$NON-NLS-1$
|
||||
private static final String OUTPUTS_TIP = TIP + ".outputs"; //$NON-NLS-1$
|
||||
private static final String COMMAND_TIP = TIP + ".command"; //$NON-NLS-1$
|
||||
private static final String ANNOUNCEMENT_TIP = TIP + ".announcement"; //$NON-NLS-1$
|
||||
private static final String CONFIRM_DEFAULT_TITLE = PREFIX + ".defaults.title"; //$NON-NLS-1$
|
||||
private static final String CONFIRM_DEFAULT_MESSAGE = PREFIX + ".defaults.message"; //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* TODO: Currently, the makefile generator code would need significant work to support
|
||||
* the concept of ordering multiple tools. For CDT 3.0, we will implement the ability to
|
||||
* apply a resource custom build tool as an override to other tools or to be disabled.
|
||||
* When there is more time to enhance the makefile generator code, the RCBS_BEFORE and RCBS_AFTER
|
||||
* entries in this array can be uncommented again.
|
||||
*/
|
||||
private static final String[] rcbsApplicabilityRules = {
|
||||
new String(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE)),
|
||||
// new String(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE)),
|
||||
// new String(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER)),
|
||||
new String(ManagedBuilderUIMessages.getResourceString(RCBS_DISABLE)),
|
||||
};
|
||||
private static final String EMPTY_STRING = new String();
|
||||
|
||||
private static final String rcbsToolId = new String("org.eclipse.cdt.managedbuilder.ui.rcbs"); //$NON-NLS-1$
|
||||
private static final String rcbsToolName = new String("Resource Custom Build Step"); //$NON-NLS-1$
|
||||
private static final String rcbsToolInputTypeId = new String("org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype"); //$NON-NLS-1$
|
||||
private static final String rcbsToolInputTypeName = new String("Resource Custom Build Step Input Type"); //$NON-NLS-1$
|
||||
private static final String rcbsToolOutputTypeId = new String("org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype"); //$NON-NLS-1$
|
||||
private static final String rcbsToolOutputTypeName = new String("Resource Custom Build Step Output Type"); //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* Dialog widgets
|
||||
*/
|
||||
protected Combo rcbsApplicabilitySelector;
|
||||
protected Text buildInputs;
|
||||
protected Text buildOutputs;
|
||||
protected Text buildCommand;
|
||||
protected Text buildDescription;
|
||||
|
||||
/*
|
||||
* Bookeeping variables
|
||||
*/
|
||||
private ResourceBuildPropertyPage resParent;
|
||||
private String resBuildInputs;
|
||||
private String resBuildOutputs;
|
||||
private String resBuildAnnouncement;
|
||||
private String resBuildCommand;
|
||||
// Has the page been changed?
|
||||
private boolean dirty = false;
|
||||
|
||||
private ModifyListener widgetModified = new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
setDirty(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public ResourceCustomBuildStepBlock(ResourceBuildPropertyPage resParent)
|
||||
{
|
||||
super(ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL));
|
||||
super.setContainer(resParent);
|
||||
this.resParent = resParent;
|
||||
}
|
||||
|
||||
public void createControl(Composite resParent) {
|
||||
Composite comp = new Composite(resParent, SWT.NULL);
|
||||
comp.setFont(resParent.getFont());
|
||||
comp.setLayout(new GridLayout(1, true));
|
||||
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
setControl(comp);
|
||||
|
||||
// Create a group to present the controls that make up the rcbs tool
|
||||
final Group rcbsToolGroup = new Group(comp, SWT.NONE);
|
||||
rcbsToolGroup.setFont(resParent.getFont());
|
||||
rcbsToolGroup.setText(ManagedBuilderUIMessages.getResourceString(RCBS_TOOL_GROUP));
|
||||
rcbsToolGroup.setLayout(new GridLayout(1, false));
|
||||
rcbsToolGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
// Create a control for the rcbs Applicability combo and label
|
||||
createRcbsApplicabilityControl(rcbsToolGroup);
|
||||
|
||||
// Create controls for the rcbs Additional Build Input Files Text and Label
|
||||
createBuildInputControl(rcbsToolGroup);
|
||||
|
||||
// Create controls for the rcbs Additional Build Output Files Text and Label
|
||||
createBuildOutputControl(rcbsToolGroup);
|
||||
|
||||
// Create controls for the rcbs Build Command Text and Label
|
||||
createBuildCommandControl(rcbsToolGroup);
|
||||
|
||||
// Create controls for the rcbs Command Description (Announcement) Text and Label
|
||||
createCommandDescriptionControl(rcbsToolGroup);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Creates the group that contains the rcbs applicability combo.
|
||||
*/
|
||||
private void createRcbsApplicabilityControl(Group rcbsApplicabilityGroup) {
|
||||
// One label
|
||||
final Label applicabilityLabel = new Label(rcbsApplicabilityGroup, SWT.LEFT);
|
||||
applicabilityLabel.setFont(rcbsApplicabilityGroup.getFont());
|
||||
applicabilityLabel.setText(ManagedBuilderUIMessages.getResourceString(RCBS_APPLICABILITY));
|
||||
applicabilityLabel.setToolTipText(ManagedBuilderUIMessages.getResourceString(APPLICABILITY_TIP));
|
||||
applicabilityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
rcbsApplicabilitySelector = new Combo(rcbsApplicabilityGroup, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
|
||||
rcbsApplicabilitySelector.setFont(rcbsApplicabilityGroup.getFont());
|
||||
rcbsApplicabilitySelector.setItems(rcbsApplicabilityRules);
|
||||
int idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE));
|
||||
rcbsApplicabilitySelector.select(idx);
|
||||
GridData gd1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
||||
gd1.horizontalSpan = 1;
|
||||
gd1.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
|
||||
rcbsApplicabilitySelector.setLayoutData(gd1);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Creates the controls for the rcbs additional build input file names text and label.
|
||||
*/
|
||||
private void createBuildInputControl(Group inputGroup) {
|
||||
// One label
|
||||
final Label inputLabel = new Label(inputGroup, SWT.LEFT);
|
||||
inputLabel.setFont(inputGroup.getFont());
|
||||
inputLabel.setText(ManagedBuilderUIMessages.getResourceString(INPUT_FILENAMES));
|
||||
inputLabel.setToolTipText(ManagedBuilderUIMessages.getResourceString(INPUTS_TIP));
|
||||
inputLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
// Now we need one text widget
|
||||
buildInputs = new Text(inputGroup, SWT.SINGLE | SWT.BORDER);
|
||||
buildInputs.setFont(inputGroup.getFont());
|
||||
GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
buildInputs.setLayoutData(gd2);
|
||||
buildInputs.addDisposeListener(new DisposeListener() {
|
||||
public void widgetDisposed(DisposeEvent event) {
|
||||
buildInputs = null;
|
||||
}
|
||||
});
|
||||
buildInputs.getAccessible().addAccessibleListener(new AccessibleAdapter(){
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = ManagedBuilderUIMessages.getResourceString(INPUT_FILENAMES);
|
||||
}
|
||||
});
|
||||
buildInputs.addModifyListener(widgetModified);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Creates the controls for the rcbs additional build output file names text and label.
|
||||
*/
|
||||
private void createBuildOutputControl(Group outputGroup) {
|
||||
// One label
|
||||
final Label outputLabel = new Label(outputGroup, SWT.LEFT);
|
||||
outputLabel.setFont(outputGroup.getFont());
|
||||
outputLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_FILENAMES));
|
||||
outputLabel.setToolTipText(ManagedBuilderUIMessages.getResourceString(OUTPUTS_TIP));
|
||||
outputLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
// Now we need one text widget
|
||||
buildOutputs = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
|
||||
buildOutputs.setFont(outputGroup.getFont());
|
||||
GridData gd3 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
buildOutputs.setLayoutData(gd3);
|
||||
buildOutputs.addDisposeListener(new DisposeListener() {
|
||||
public void widgetDisposed(DisposeEvent event) {
|
||||
buildOutputs = null;
|
||||
}
|
||||
});
|
||||
buildOutputs.getAccessible().addAccessibleListener(new AccessibleAdapter(){
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = ManagedBuilderUIMessages.getResourceString(OUTPUT_FILENAMES);
|
||||
}
|
||||
});
|
||||
buildOutputs.addModifyListener(widgetModified);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Creates the controls for the rcbs build command text and label.
|
||||
*/
|
||||
private void createBuildCommandControl(Group commandGroup) {
|
||||
// One label
|
||||
final Label commandLabel = new Label(commandGroup, SWT.LEFT);
|
||||
commandLabel.setFont(commandGroup.getFont());
|
||||
commandLabel.setText(ManagedBuilderUIMessages.getResourceString(COMMAND_CMD));
|
||||
commandLabel.setToolTipText(ManagedBuilderUIMessages.getResourceString(COMMAND_TIP));
|
||||
commandLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
// Now we need one text widget
|
||||
buildCommand = new Text(commandGroup, SWT.SINGLE | SWT.BORDER);
|
||||
buildCommand.setFont(commandGroup.getFont());
|
||||
GridData gd4 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
buildCommand.setLayoutData(gd4);
|
||||
buildCommand.addDisposeListener(new DisposeListener() {
|
||||
public void widgetDisposed(DisposeEvent event) {
|
||||
buildCommand = null;
|
||||
}
|
||||
});
|
||||
buildCommand.getAccessible().addAccessibleListener(new AccessibleAdapter(){
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = ManagedBuilderUIMessages.getResourceString(COMMAND_CMD);
|
||||
}
|
||||
});
|
||||
buildCommand.addModifyListener(widgetModified);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Creates the controls for the rcbs build command description (announcement) text and label.
|
||||
*/
|
||||
private void createCommandDescriptionControl(Group descriptionGroup) {
|
||||
// One label
|
||||
final Label descriptionLabel = new Label(descriptionGroup, SWT.LEFT);
|
||||
descriptionLabel.setFont(descriptionGroup.getFont());
|
||||
descriptionLabel.setText(ManagedBuilderUIMessages.getResourceString(DESCRIPTION_DESC));
|
||||
descriptionLabel.setToolTipText(ManagedBuilderUIMessages.getResourceString(ANNOUNCEMENT_TIP));
|
||||
descriptionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
// Now we need one text widget
|
||||
buildDescription = new Text(descriptionGroup, SWT.SINGLE | SWT.BORDER);
|
||||
buildDescription.setFont(descriptionGroup.getFont());
|
||||
GridData gd5 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
buildDescription.setLayoutData(gd5);
|
||||
buildDescription.addDisposeListener(new DisposeListener() {
|
||||
public void widgetDisposed(DisposeEvent event) {
|
||||
buildDescription = null;
|
||||
}
|
||||
});
|
||||
buildDescription.getAccessible().addAccessibleListener(new AccessibleAdapter(){
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = ManagedBuilderUIMessages.getResourceString(DESCRIPTION_DESC);
|
||||
}
|
||||
});
|
||||
buildDescription.addModifyListener(widgetModified);
|
||||
}
|
||||
|
||||
protected void initializeValues() {
|
||||
setValues();
|
||||
}
|
||||
|
||||
public void updateValues() {
|
||||
setValues();
|
||||
}
|
||||
|
||||
protected void setValues() {
|
||||
IResourceConfiguration resConfig;
|
||||
String[] buildInputsPaths;
|
||||
String[] buildOutputsPaths;
|
||||
boolean foundRcbsTool = false;
|
||||
int idx;
|
||||
/*
|
||||
* Examine the tools defined for the resource configuration.
|
||||
* There should be at most one tool defined for a custom build step which was not an
|
||||
* extension element (not defined by a tool integrator in a manifest).
|
||||
* If the rcbs tool has been defined, set the field values from the defined tool.
|
||||
* If the rcbs tool has not been defined yet, clear the field values.
|
||||
* Finally, set the rcbsApplicability selector from the current value in the resource configuration.
|
||||
*/
|
||||
resConfig = resParent.getCurrentResourceConfig();
|
||||
ITool [] tools = resConfig.getTools();
|
||||
for (int i = 0; i < tools.length; i++) {
|
||||
ITool tool = tools[i];
|
||||
if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
|
||||
buildInputsPaths = tool.getInputTypes()[0].getAdditionalInputs()[0].getPaths();
|
||||
resBuildInputs = ""; //$NON-NLS-1$
|
||||
for ( int j = 0; j < buildInputsPaths.length; j++ ){
|
||||
resBuildInputs += buildInputsPaths[j] + ";"; //$NON-NLS-1$
|
||||
}
|
||||
int len = resBuildInputs.length();
|
||||
resBuildInputs = resBuildInputs.substring(0,len-1);
|
||||
buildInputs.setText(resBuildInputs);
|
||||
|
||||
buildOutputsPaths = tool.getOutputTypes()[0].getOutputNames();
|
||||
resBuildOutputs = ""; //$NON-NLS-1$
|
||||
for ( int j = 0; j < buildOutputsPaths.length; j++ ){
|
||||
resBuildOutputs += buildOutputsPaths[j] + ";"; //$NON-NLS-1$
|
||||
}
|
||||
len = resBuildOutputs.length();
|
||||
resBuildOutputs = resBuildOutputs.substring(0,len-1);
|
||||
buildOutputs.setText(resBuildOutputs);
|
||||
|
||||
resBuildCommand = tool.getToolCommand();
|
||||
buildCommand.setText(resBuildCommand);
|
||||
|
||||
resBuildAnnouncement = tool.getAnnouncement();
|
||||
buildDescription.setText(resBuildAnnouncement);
|
||||
|
||||
foundRcbsTool = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If an rcbs tool has not been created yet, just blank the fields.
|
||||
*/
|
||||
if(!foundRcbsTool) {
|
||||
buildInputs.setText(""); //$NON-NLS-1$
|
||||
buildOutputs.setText(""); //$NON-NLS-1$
|
||||
buildCommand.setText(""); //$NON-NLS-1$
|
||||
buildDescription.setText(""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the state of the rcbs applicability selector.
|
||||
*/
|
||||
switch(resConfig.getRcbsApplicability()){
|
||||
case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE:
|
||||
idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE));
|
||||
break;
|
||||
case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AFTER:
|
||||
idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER));
|
||||
break;
|
||||
case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_BEFORE:
|
||||
idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE));
|
||||
break;
|
||||
case IResourceConfiguration.KIND_DISABLE_RCBS_TOOL:
|
||||
idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_DISABLE));
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* If we get an unexpected value, use the normal default of override.
|
||||
*/
|
||||
idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE));
|
||||
break;
|
||||
}
|
||||
rcbsApplicabilitySelector.select(idx);
|
||||
|
||||
setDirty(false);
|
||||
}
|
||||
|
||||
public void removeValues(String id) {
|
||||
// Nothing to do...
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||
*/
|
||||
public void performDefaults() {
|
||||
IResourceConfiguration resConfig;
|
||||
|
||||
// Display a "Confirm" dialog box, since:
|
||||
// 1. The defaults are immediately applied
|
||||
// 2. The action cannot be undone
|
||||
Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
|
||||
boolean shouldDefault = MessageDialog.openConfirm(shell,
|
||||
ManagedBuilderUIMessages.getResourceString(CONFIRM_DEFAULT_TITLE),
|
||||
ManagedBuilderUIMessages.getResourceString(CONFIRM_DEFAULT_MESSAGE));
|
||||
if (!shouldDefault) return;
|
||||
|
||||
/*
|
||||
* Examine the tools defined for the resource configuration.
|
||||
* There should be at most one tool defined for a custom build step which was not an
|
||||
* extension element (not defined by a tool integrator in a manifest).
|
||||
* If the rcbs tool has been defined, remove the tool from the resource configuration.
|
||||
* Set the rcbsApplicability in the resource configuration to "disabled" by default.
|
||||
* Update the field values.
|
||||
*/
|
||||
resConfig = resParent.getCurrentResourceConfig();
|
||||
ITool [] tools = resConfig.getTools();
|
||||
for (int i = 0; i < tools.length; i++) {
|
||||
ITool tool = tools[i];
|
||||
if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
|
||||
resConfig.removeTool(tool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
resConfig.setRcbsApplicability(IResourceConfiguration.KIND_DISABLE_RCBS_TOOL);
|
||||
setValues();
|
||||
setDirty(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(IProgressMonitor)
|
||||
*/
|
||||
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||
IResourceConfiguration resConfig;
|
||||
boolean foundRcbsTool = false;
|
||||
int idx;
|
||||
|
||||
/*
|
||||
* Gather the users input.
|
||||
* Examine the tools defined for the resource configuration.
|
||||
* There should be at most one tool defined for a custom build step which was not an
|
||||
* extension element (not defined by a tool integrator in a manifest).
|
||||
* If the rcbs tool has been defined, set the tool values from the user supplied values.
|
||||
* If the rcbs tool has not been defined yet, create the tool and set the tool values.
|
||||
* No validity checking of the users input is performed. The user is responsible for providing
|
||||
* proper input.
|
||||
* Finally, set the rcbsApplicability attribute in the resource configuration according to the user's
|
||||
* selection.
|
||||
*/
|
||||
|
||||
resBuildInputs = buildInputs.getText().trim();
|
||||
resBuildOutputs = buildOutputs.getText().trim();
|
||||
resBuildCommand = buildCommand.getText().trim();
|
||||
resBuildAnnouncement = buildDescription.getText().trim();
|
||||
|
||||
resConfig = resParent.getCurrentResourceConfig();
|
||||
ITool [] tools = resConfig.getTools();
|
||||
for (int i = 0; i < tools.length; i++) {
|
||||
ITool tool = tools[i];
|
||||
if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
|
||||
tool.getInputTypes()[0].getAdditionalInputs()[0].setPaths(resBuildInputs);
|
||||
tool.getOutputTypes()[0].setOutputNames(resBuildOutputs);
|
||||
tool.setToolCommand(resBuildCommand);
|
||||
tool.setAnnouncement(resBuildAnnouncement);
|
||||
foundRcbsTool = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!foundRcbsTool) {
|
||||
ITool rcbsTool;
|
||||
IInputType rcbsToolInputType;
|
||||
IAdditionalInput rcbsToolInputTypeAdditionalInput;
|
||||
IOutputType rcbsToolOutputType;
|
||||
|
||||
rcbsTool = resConfig.createTool(null,rcbsToolId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolName,false); //$NON-NLS-1$
|
||||
rcbsToolInputType = rcbsTool.createInputType(null,rcbsToolInputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolInputTypeName,false); //$NON-NLS-1$
|
||||
rcbsToolInputTypeAdditionalInput = rcbsToolInputType.createAdditionalInput(resBuildInputs);
|
||||
rcbsToolInputTypeAdditionalInput.setKind(IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY);
|
||||
rcbsToolOutputType = rcbsTool.createOutputType(null,rcbsToolOutputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolOutputTypeName,false); //$NON-NLS-1$
|
||||
rcbsToolOutputType.setOutputNames(resBuildOutputs);
|
||||
rcbsTool.setCustomBuildStep(true);
|
||||
rcbsTool.setToolCommand(resBuildCommand);
|
||||
rcbsTool.setAnnouncement(resBuildAnnouncement);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the state of the rcbs applicability selector and set the rcbsApplicability attribute in the
|
||||
* resource configuration.
|
||||
*/
|
||||
idx = rcbsApplicabilitySelector.getSelectionIndex();
|
||||
if(idx == rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER))) {
|
||||
resConfig.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AFTER);
|
||||
} else
|
||||
if(idx == rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE))) {
|
||||
resConfig.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_BEFORE);
|
||||
} else
|
||||
if (idx == rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_DISABLE))) {
|
||||
resConfig.setRcbsApplicability(IResourceConfiguration.KIND_DISABLE_RCBS_TOOL);
|
||||
} else {
|
||||
resConfig.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE);
|
||||
}
|
||||
|
||||
setDirty(false);
|
||||
}
|
||||
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the "dirty" state
|
||||
*/
|
||||
public void setDirty(boolean b) {
|
||||
dirty = b;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the "dirty" state
|
||||
*/
|
||||
public boolean isDirty() {
|
||||
return dirty;
|
||||
}
|
||||
|
||||
}
|
|
@ -164,7 +164,7 @@ public class ResourceBuildPropertyPage extends PropertyPage implements
|
|||
IFile file = (IFile)getElement();
|
||||
if(isGeneratedResource(file))
|
||||
error = ManagedBuilderUIMessages.getResourceString(MSG_RC_GENERATED);
|
||||
else if(!isBuildResource(file))
|
||||
else if(file.isDerived())
|
||||
error = ManagedBuilderUIMessages.getResourceString(MSG_RC_NON_BUILD);
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ public class ResourceBuildPropertyPage extends PropertyPage implements
|
|||
public boolean isBuildResource(IFile file, IConfiguration cfg){
|
||||
IResourceConfiguration rcCfg = cfg.getResourceConfiguration(file.getFullPath().toOSString());
|
||||
if(rcCfg != null){
|
||||
ITool tools[] = rcCfg.getTools();
|
||||
ITool tools[] = rcCfg.getToolsToInvoke();
|
||||
if(tools != null && tools.length > 0)
|
||||
return true;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue