1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

Initial commit for the build description model functionality

This commit is contained in:
Mikhail Sennikovsky 2006-03-10 15:21:09 +00:00
parent 6a803d0d95
commit fc147a1d83
48 changed files with 7108 additions and 85 deletions

View file

@ -6119,5 +6119,126 @@
</configuration>
</projectType>
<!-- specific proj types for testing build description model -->
<projectType
isAbstract="false"
isTest="true"
name="MBS30TargetName.gnu.exe"
id="cdt.managedbuild.target.bdm.exe">
<configuration
name="MBS30ConfigName.Dbg"
id="cdt.managedbuild.config.bdm.exe.debug"
cleanCommand="rm -rf"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
<toolChain
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="MBS30ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.bdm.c.linker.exe.debug;cdt.managedbuild.tool.bdm.cpp.linker.exe.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.bdm.exe.debug">
<targetPlatform
id="cdt.managedbuild.target.bdm.platform.exe.debug"
name="MBS30PlatformName.Dbg"
binaryParser="org.eclipse.cdt.core.ELF"
osList="solaris,linux,hpux,aix,qnx"
archList="all">
</targetPlatform>
<builder
id="cdt.managedbuild.target.bdm.builder.exe.debug"
name="MBS30BuilderName.Dbg"
command="make"
arguments="-k"
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
</builder>
<tool
id="cdt.managedbuild.tool.bdm.c.compiler.exe.debug"
superClass="cdt.managedbuild.tool.testgnu30.c.compiler">
<option
id="gnu.c.compiler.exe.debug.optionBdm.optimization.level"
defaultValue="gnu.c.optimization.level.none"
superClass="gnu.c.compiler.option30.optimization.level">
</option>
<option
id="gnu.c.compiler.exe.debug.optionBdm.debugging.level"
defaultValue="gnu.c.debugging.level.max"
superClass="gnu.c.compiler.option30.debugging.level">
</option>
</tool>
<tool
id="cdt.managedbuild.tool.bdm.cpp.compiler.exe.debug"
superClass="cdt.managedbuild.tool.testgnu30.cpp.compiler">
<option
id="gnu.cpp.compiler.exe.debug.optionBdm.optimization.level"
defaultValue="gnu.cpp.compiler.optimization.level.none"
superClass="gnu.cpp.compiler.option30.optimization.level">
</option>
<option
id="gnu.cpp.compiler.exe.debug.optionBdm.debugging.level"
defaultValue="gnu.cpp.compiler.debugging.level.max"
superClass="gnu.cpp.compiler.option30.debugging.level">
</option>
</tool>
<tool
id="cdt.managedbuild.tool.bdm.c.linker.exe.debug"
superClass="cdt.managedbuild.tool.testgnu30.c.linker">
</tool>
<tool
id="cdt.managedbuild.tool.bdm.cpp.linker.exe.debug"
superClass="cdt.managedbuild.tool.testgnu30.cpp.linker">
</tool>
<tool
natureFilter="ccnature"
name="BDM test s1 to o1 tool"
outputFlag="-o"
command="g++"
id="cdt.managedbuild.tool.bdm.tool.1">
<inputType
sources="s1"
multipleOfType="false"
id="cdt.managedbuild.tool.bdm.tool.1.input">
</inputType>
<outputType
outputs="o1"
buildVariable="BDM_O1"
id="cdt.managedbuild.tool.bdm.tool.1.output">
</outputType>
</tool>
<tool
natureFilter="ccnature"
name="BDM test s2 + o1 to o tool"
outputFlag="-o"
command="g++"
id="cdt.managedbuild.tool.bdm.tool.2">
<inputType
sources="s2"
multipleOfType="false"
id="cdt.managedbuild.tool.bdm.tool.2.input">
</inputType>
<inputType
id="cdt.managedbuild.tool.bdm.tool.2.input.addl">
<additionalInput
paths="$(BDM_O1)"
kind="additionalinputdependency">
</additionalInput>
</inputType>
<outputType
outputs="o"
buildVariable="OBJS"
id="cdt.managedbuild.tool.bdm.tool.2.output">
</outputType>
</tool>
</toolChain>
</configuration>
</projectType>
</extension>
</plugin>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Intel Corporation and others.
* Copyright (c) 2004, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -16,6 +16,8 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipFile;
import junit.framework.Assert;
@ -23,14 +25,24 @@ import junit.framework.TestCase;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
@ -50,6 +62,14 @@ import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
public class ManagedBuildTestHelper {
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$
private static final String PATH_SEPERATOR = ";"; //$NON-NLS-1$
/* (non-Javadoc)
* Create a new project named <code>name</code> or return the project in
@ -118,8 +138,16 @@ public class ManagedBuildTestHelper {
static public IFile createFile(IProject project, String name){
IFile file = project.getFile(name);
if( file.exists() ){
if( !file.exists() ){
try {
IPath dirPath = file.getFullPath().removeLastSegments(1).removeFirstSegments(1);
if(dirPath.segmentCount() > 0){
IFolder rc = project.getFolder(dirPath);
if(!rc.exists()){
rc.create(true, true, null);
}
}
// file.create( new ByteArrayInputStream( "#include <stdio.h>\n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null );
file.create( new ByteArrayInputStream( new byte[0] ), false, null );
} catch (CoreException e) {
@ -156,6 +184,25 @@ public class ManagedBuildTestHelper {
}
}
public static IProject loadProject(String name, String path){
IPath zipPath = new Path("resources").append(path).append(name).append(name).addFileExtension("zip");
File zipFile = CTestPlugin.getFileInPlugin(zipPath);
if(zipFile == null) {
Assert.fail("zip file " + zipPath.toString() + " is missing.");
return null;
}
try{
return createProject(name, zipFile, null, null);
}
catch(Exception e){
Assert.fail("fail to create the project: " + e.getLocalizedMessage());
}
return null;
}
static public IProject createProject(String projectName, File zip, IPath location, String projectTypeId) throws CoreException, InvocationTargetException, IOException {
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IProject project= root.getProject(projectName);
@ -236,6 +283,11 @@ public class ManagedBuildTestHelper {
}
}
ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
IConfiguration cfgs[] = newProject.getConfigurations();
for(int i = 0; i < cfgs.length; i++){
cfgs[i].setArtifactName(newProject.getDefaultArtifactName());
}
}
};
NullProgressMonitor monitor = new NullProgressMonitor();
@ -342,7 +394,7 @@ public class ManagedBuildTestHelper {
try {
input = new FileReader(fullPath.toFile());
} catch (Exception e) {
Assert.fail("File " + fullPath.toString() + " could not be read.");
Assert.fail("File " + fullPath.toString() + " could not be read: " + e.getLocalizedMessage());
}
//InputStream input = file.getContents(true); // A different way to read the file...
int c;
@ -462,4 +514,186 @@ public class ManagedBuildTestHelper {
}
b = dir.delete();
}
public static ITool createRcbsTool(IConfiguration cfg, String file, String inputs, String outputs, String cmds){
IProject project = cfg.getOwner().getProject();
IResource f = project.findMember(file);
Assert.assertTrue("file does not exist", f != null);
Assert.assertEquals("resource is not a file", f.getType(), IResource.FILE);
return createRcbsTool(cfg, (IFile)f, inputs, outputs, cmds);
}
public static ITool createRcbsTool(IConfiguration cfg, IFile file, String inputs, String outputs, String cmds){
IResourceConfiguration rcCfg = cfg.getResourceConfiguration(file.getFullPath().toString());
if(rcCfg == null)
rcCfg = cfg.createResourceConfiguration(file);
Assert.assertTrue("failed to create resource configuration", rcCfg != null);
ITool tool = getRcbsTool(rcCfg, true);
setRcbsInputs(tool, inputs);
setRcbsOutputs(tool, outputs);
tool.setToolCommand(cmds);
tool.setAnnouncement("default test rcbs announcement");
rcCfg.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE);
return tool;
}
public static ITool setRcbsInputs(ITool tool, String inputs){
tool.getInputTypes()[0].getAdditionalInputs()[0].setPaths(inputs);
return tool;
}
public static ITool setRcbsOutputs(ITool tool, String outputs){
tool.getOutputTypes()[0].setOutputNames(outputs);
return tool;
}
public static ITool getRcbsTool(IResourceConfiguration rcConfig, boolean create){
ITool rcbsTools[] = getRcbsTools(rcConfig);
ITool rcbsTool = null;
if(rcbsTools != null)
rcbsTool = rcbsTools[0];
else if (create) {
rcbsTool = rcConfig.createTool(null,rcbsToolId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolName,false); //$NON-NLS-1$
rcbsTool.setCustomBuildStep(true);
IInputType rcbsToolInputType = rcbsTool.createInputType(null,rcbsToolInputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolInputTypeName,false); //$NON-NLS-1$
IAdditionalInput rcbsToolInputTypeAdditionalInput = rcbsToolInputType.createAdditionalInput(new String());
rcbsToolInputTypeAdditionalInput.setKind(IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY);
rcbsTool.createOutputType(null,rcbsToolOutputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolOutputTypeName,false); //$NON-NLS-1$
}
return rcbsTool;
}
public static ITool[] getRcbsTools(IResourceConfiguration rcConfig){
List list = new ArrayList();
ITool tools[] = rcConfig.getTools();
for (int i = 0; i < tools.length; i++) {
ITool tool = tools[i];
if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
list.add(tool);
}
}
if(list.size() != 0)
return (ITool[])list.toArray(new ITool[list.size()]);
return null;
}
public static boolean setObjs(IConfiguration cfg, String[] objs){
return setOption(cfg, IOption.OBJECTS, objs);
}
public static boolean setLibs(IConfiguration cfg, String[] objs){
return setOption(cfg, IOption.LIBRARIES, objs);
}
public static boolean setOption(IConfiguration cfg, int type, Object value){
return setOption(cfg.getFilteredTools(), type, value);
}
public static boolean setOption(IResourceConfiguration rcCfg, int type, Object value){
return setOption(rcCfg.getToolsToInvoke()[0], type, value);
}
public static boolean setOption(ITool tools[], int type, Object value){
for(int i = 0; i < tools.length; i++){
if(setOption(tools[i], type, value))
return true;
}
return false;
}
public static IBuildObject[] getOption(IConfiguration cfg, int type){
return getOption(cfg.getFilteredTools(), type);
}
public static IBuildObject[] getOption(IResourceConfiguration rcCfg, int type, Object value){
return getOption(new ITool[]{rcCfg.getToolsToInvoke()[0]}, type);
}
public static IBuildObject[] getOption(ITool tools[], int type){
for(int i = 0; i < tools.length; i++){
IOption option = getOption(tools[i], type);
if(option != null)
return new IBuildObject[]{tools[i],option};
}
return null;
}
public static IOption getOption(IHoldsOptions tool, int type){
IOption opts[] = tool.getOptions();
for(int i = 0; i < opts.length; i++){
IOption option = opts[i];
try {
if(option.getValueType() == type){
return option;
}
} catch (BuildException e) {
}
}
return null;
}
public static boolean setOption(ITool tool, int type, Object value){
IOption option = getOption(tool, type);
if(option == null)
return false;
IBuildObject obj = tool.getParent();
IConfiguration cfg = null;
IResourceConfiguration rcCfg = null;
if(obj instanceof IToolChain)
cfg = ((IToolChain)obj).getParent();
else
rcCfg = (IResourceConfiguration)obj;
try {
if(option.getValueType() == type){
switch(type){
case IOption.BOOLEAN:
{
boolean val = ((Boolean)value).booleanValue();
if(rcCfg != null)
rcCfg.setOption(tool, option, val);
else
cfg.setOption(tool, option, val);
}
return true;
case IOption.ENUMERATED:
case IOption.STRING:
{
String val = (String)value;
if(rcCfg != null)
rcCfg.setOption(tool, option, val);
else
cfg.setOption(tool, option, val);
}
return true;
case IOption.STRING_LIST:
case IOption.INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES:
case IOption.OBJECTS:
{
String val[] = (String[])value;
if(rcCfg != null)
rcCfg.setOption(tool, option, val);
else
cfg.setOption(tool, option, val);
}
return true;
default:
Assert.fail("wrong option type passed");
}
}
} catch (BuildException e) {
}
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* Copyright (c) 2004, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -14,12 +14,13 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.managedbuilder.core.tests.BuildDescriptionModelTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests20;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests_SharedToolOptions;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildDependencyCalculatorTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildEnvironmentTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildMacrosTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildDependencyCalculatorTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildTCSupportedTest;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedCommandLineGeneratorTest;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject21MakefileTests;
@ -46,7 +47,7 @@ public class AllManagedBuildTests {
TestSuite suite = new TestSuite(
"Test for org.eclipse.cdt.managedbuild.core.tests");
//$JUnit-BEGIN$
// TODO uncoment this
// TODO uncoment this
suite.addTest(ManagedBuildCoreTests20.suite());
suite.addTest(ManagedBuildCoreTests.suite());
suite.addTest(ManagedProjectUpdateTests.suite());
@ -61,6 +62,7 @@ public class AllManagedBuildTests {
suite.addTest(MultiVersionSupportTests.suite());
suite.addTest(OptionEnablementTests.suite());
suite.addTest(ManagedBuildDependencyCalculatorTests.suite());
suite.addTest(BuildDescriptionModelTests.suite());
//$JUnit-END$
return suite;
}

View file

@ -6,8 +6,10 @@ Bundle-Version: 3.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.managedbuilder.core,
Export-Package: org.eclipse.cdt.managedbuilder.buildmodel,
org.eclipse.cdt.managedbuilder.core,
org.eclipse.cdt.managedbuilder.envvar,
org.eclipse.cdt.managedbuilder.internal.buildmodel,
org.eclipse.cdt.managedbuilder.internal.core,
org.eclipse.cdt.managedbuilder.internal.envvar,
org.eclipse.cdt.managedbuilder.internal.macros,

View file

@ -0,0 +1,283 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildMultiStatus;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildStatus;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.DbgUtil;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.DefaultBuildDescriptionFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
*
* This class represents the build description manager
* Te build description manager is the entry point
* for all build description-related operations
*
*/
public class BuildDescriptionManager {
public static final int REMOVED = 0x01;
public static final int REBUILD = 0x02;
public static final int DEPS = 0x04;
public static final int DEPS_CMODEL = DEPS & 0x08;
public static final int DEPS_DEPGEN = DEPS & 0x10;
private Set fVisitedSteps = new HashSet();
private boolean fUp;
private IBuildDescription fInfo;
private BuildDescriptionManager(boolean up, IBuildDescription info){
fUp = up;
fInfo = info;
}
/**
* creates the build description
* @param cfg the build configuration for which the description is to be
* created
* @param delta the resource delta or null if none
* @param flags specifies how the build description should be generated
* and what information it should contain.
* Can contain the following flags:
* BuildDescriptionManager.REBUILD,
* BuildDescriptionManager.REMOVED,
* BuildDescriptionManager.DEPS,
* BuildDescriptionManager.DEPS_CMODEL,
* BuildDescriptionManager.DEPS_DEPGEN,
*
*
* @see BuildDescriptionManager#REBUILD
* @see BuildDescriptionManager#REMOVED
* @see BuildDescriptionManager#DEPS
* @see BuildDescriptionManager#DEPS_CMODEL
* @see BuildDescriptionManager#DEPS_DEPGEN
* @return IBuildDescription
* @throws CoreException if the build description creation fails
*/
static public IBuildDescription createBuildDescription(IConfiguration cfg,
IResourceDelta delta,
int flags) throws CoreException {
return DefaultBuildDescriptionFactory.getInstance().createBuildDescription(cfg, delta, flags);
}
/**
* runs though all steps in build description in the dependency order
* and notifies the visitor callback
* the order in which steps are enumerated depends on the "up" argument
*
* @param visitor represents the visitor callback
* @param des represents the build description
* @param up specifies the order in which build steps are to be enumerated
* if true, enumeration will be performed starting from the input step and
* ending with the output state. Otherwise enumeration will be performed
* in the reversed order
*
* @throws CoreException if the operation fails
*/
static public void accept(IStepVisitor visitor, IBuildDescription des, boolean up) throws CoreException {
BuildDescriptionManager util = new BuildDescriptionManager(up, des);
util.doAccept(visitor);
}
private void doAccept(IStepVisitor visitor) throws CoreException{
IBuildStep action = fUp ? fInfo.getInputStep() : fInfo.getOutputStep();
doAccept(visitor, action, true);
}
private boolean doAccept(IStepVisitor visitor, IBuildStep action, boolean doNext) throws CoreException{
IBuildStep[] actions = getSteps(action, fUp);
boolean proceed = true;
for(int i = 0; i < actions.length; i++){
if(!fVisitedSteps.contains(actions[i])){
if(!doAccept(visitor, actions[i], false)){
proceed = false;
break;
}
}
}
if(proceed && !fVisitedSteps.contains(action)){
proceed = visitor.visit(action);
fVisitedSteps.add(action);
}
if(doNext){
IBuildStep[] nextActions = getSteps(action, !fUp);
for(int i = 0; i < nextActions.length; i++){
if(!fVisitedSteps.contains(nextActions[i])){
if(!doAccept(visitor, nextActions[i], true)){
proceed = false;
break;
}
}
}
}
return proceed;
}
public static IBuildStep[] getSteps(IBuildStep step, boolean input){
Set set = new HashSet();
IBuildIOType args[] = input ?
step.getInputIOTypes() :
step.getOutputIOTypes();
for(int i = 0; i < args.length; i++){
IBuildResource rcs[] = args[i].getResources();
for(int j = 0; j < rcs.length; j++){
if(input){
IBuildIOType arg = rcs[j].getProducerIOType();
if(arg != null && arg.getStep() != null)
set.add(arg.getStep());
} else {
IBuildIOType depArgs[] = rcs[j].getDependentIOTypes();
for(int k = 0; k < depArgs.length; k++){
IBuildIOType arg = depArgs[k];
if(arg != null && arg.getStep() != null)
set.add(arg.getStep());
}
}
}
}
return (IBuildStep[])set.toArray(new IBuildStep[set.size()]);
}
public static IBuildResource[] filterBuildResources(IBuildResource rc[], int rcState){
List list = new ArrayList();
addBuildResources(rc, list, rcState);
return (IBuildResource[])list.toArray(new IBuildResource[list.size()]);
}
private static void addBuildResources(IBuildResource rcs[], List list, int rcState){
if(rcs.length == 0)
return;
IBuildStep inputAction = rcs[0].getBuildDescription().getInputStep();
if(DbgUtil.DEBUG)
DbgUtil.traceln(">>found resources to clean:"); //$NON-NLS-1$
for(int i = 0; i < rcs.length; i++){
IBuildResource buildRc = rcs[i];
IPath path = buildRc.getFullPath();
if(path != null
&& ((checkFlags(rcState, REBUILD) && buildRc.needsRebuild())
|| (checkFlags(rcState, REMOVED) && buildRc.isRemoved()))
&& buildRc.getProducerIOType() != null
&& buildRc.getProducerIOType().getStep() != inputAction
&& buildRc.isProjectResource()){
if(DbgUtil.DEBUG)
DbgUtil.traceln(path.toString());
list.add(buildRc);
}
}
if(DbgUtil.DEBUG)
DbgUtil.traceln("<<"); //$NON-NLS-1$
}
private static boolean checkFlags(int var, int flags){
return (var & flags) == flags;
}
/**
* returns the project resource for the given build resource or null
* if the project does not contain the build resource
*
* @param bRc build resource
* @return IResource
*/
public static IResource getResourceFromBuildResource(IBuildResource bRc){
IProject project = bRc.getBuildDescription().getConfiguration().getOwner().getProject();
IPath path = bRc.getFullPath();
if(path != null)
return project.findMember(path.removeFirstSegments(1));
return null;
}
/**
* cleans the resources to be rebuilt
*
* @param des build description
* @throws CoreException
*/
public static void cleanRebuildResources(IBuildDescription des) throws CoreException{
IBuildResource bRcs[] = filterBuildResources(des.getResources(), REMOVED | REBUILD);
List failList = new ArrayList();
for(int i = 0; i < bRcs.length; i++){
IResource rc = getResourceFromBuildResource(bRcs[i]);
if(rc != null){
try {
rc.delete(true, null);
} catch (CoreException e) {
failList.add(new Object[]{rc,e});
}
}
}
if(failList.size() != 0){
BuildMultiStatus status = new BuildMultiStatus("failed to remove resources", null); //$NON-NLS-1$
for(Iterator iter = failList.iterator(); iter.hasNext();){
Object[] err = (Object[])iter.next();
IResource rc = (IResource)err[0];
CoreException e = (CoreException)err[1];
status.add(new BuildStatus(rc.getFullPath().toString(), e));
}
throw new CoreException(status);
}
}
public static IPath getRelPath(IPath cwd, IPath location){
if(!location.isAbsolute())
return location;
IPath path = null;
IPath tmp = cwd;
while(tmp.segmentCount() != 0){
if(tmp.isPrefixOf(location)){
IPath p = location.removeFirstSegments(tmp.segmentCount()).setDevice(null);
if(path == null)
return p;
return path.append(p);
}
if(path == null)
path = new Path(".."); //$NON-NLS-1$
else
path.append(".."); //$NON-NLS-1$
tmp = tmp.removeLastSegments(1);
}
return location;
}
}

View file

@ -0,0 +1,53 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import java.util.Map;
import org.eclipse.core.runtime.IPath;
/**
*
* This interface represents a command to be invoked for building the step
*
*/
public interface IBuildCommand {
/**
* returns the executable path
* the paths could be either relative or absolute
*
* @return IPath
*/
IPath getCommand();
/**
* Returns the array of arguments to be passed to the executable
*
* @return String[]
*/
String[] getArgs();
/**
* Returns the Map representing the environment to be used for the executable process
* The map conntains the String to String pairs representing the variable name and value respectively
*
* @return Map
*/
Map getEnvironment();
/**
* Returns the working directory to be used for the process
*
* @return IPath
*/
IPath getCWD();
}

View file

@ -0,0 +1,74 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.runtime.IPath;
/**
*
* This Build representation holds the hierarchy of inter-related
* build actions and resources
*
*/
public interface IBuildDescription {
/**
* Returns the main input action
*
* @return IBuildAction
*/
IBuildStep getInputStep();
/**
* Returns the main output action
*
* @return IBuildAction
*/
IBuildStep getOutputStep();
/**
* Returns the Build resource for the given resource location
*
* @param location
*
* @return the IBuildResource or null if not found
*/
IBuildResource getResourceForLocation(IPath location);
/**
* Returns all resources used in the build
*
* @return IBuildResource[]
*/
IBuildResource[] getResources();
/**
* Returns all build steps used in the build
*
* @return IBuildResource[]
*/
IBuildStep[] getSteps();
/**
* Returns the build configuration this representation was created for
*
* @return IProject
*/
IConfiguration getConfiguration();
/**
* Returns the default build directory location
*
* @return IPath
*/
IPath getDefaultBuildDirLocation();
}

View file

@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
/**
*
* this interface represents the build description factory
*
*/
public interface IBuildDescriptionFactory {
/**
* creates the build description
* @param cfg the build configuration for which the description is to be
* created
* @param delta the resource delta or null if none
* @param flags specifies how the build description should be generated
* and what information it should contain.
* Can contain the following flags:
* BuildDescriptionManager.REBUILD,
* BuildDescriptionManager.REMOVED,
* BuildDescriptionManager.DEPS,
* BuildDescriptionManager.DEPS_CMODEL,
* BuildDescriptionManager.DEPS_DEPGEN,
*
*
* @see BuildDescriptionManager#REBUILD
* @see BuildDescriptionManager#REMOVED
* @see BuildDescriptionManager#DEPS
* @see BuildDescriptionManager#DEPS_CMODEL
* @see BuildDescriptionManager#DEPS_DEPGEN
* @return IBuildDescription
* @throws CoreException if the build description creation fails
*/
IBuildDescription createBuildDescription(IConfiguration cfg,
IResourceDelta delta,
int flags) throws CoreException;
/**
*
* returns the supported methods of generation the build description
*
* @see BuildDescriptionManager#REBUILD
* @see BuildDescriptionManager#REMOVED
* @see BuildDescriptionManager#DEPS
* @see BuildDescriptionManager#DEPS_CMODEL
* @see BuildDescriptionManager#DEPS_DEPGEN *
*
* @return int
*/
int getSupportedMethods();
}

View file

@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
/**
*
* This interface represents the build group.
* The build group is a group of actions
*
*/
public interface IBuildGroup {
/**
*
* Returns the array of build steps that belong to this group
*
* @return IBuildStep[]
*/
IBuildStep[] getSteps();
/**
*
* Returns true if the build group contains the given step,
* false - otherwise
*
* @param action
* @return boolean
*/
boolean contains(IBuildStep action);
/**
* returns true is the build group needs rebuild,
* false - otherwise
*
* @return boolean
*/
boolean needsRebuild();
}

View file

@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
/**
*
* This interface is used to combine a set of build resources
* that are inputs or outputs for the given action
* into one group
*
*/
public interface IBuildIOType {
/**
* Specifies whether this argument is Action input or output
*
* @return boolean
*/
boolean isInput();
/**
* Specifies a set of resources associated with this argument
*
* @return IBuildResource[]
*/
IBuildResource[] getResources();
/**
* Specifies the build action this argument belongs to
*
* @return IBuildAction
*/
IBuildStep getStep();
}

View file

@ -0,0 +1,93 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import org.eclipse.core.runtime.IPath;
/**
*
* This interface represents the resource used in the build
*
*/
public interface IBuildResource {
/**
* Returns the resource location
*
* @return IPath
*/
IPath getLocation();
/**
* Returns the resource path related to the project directory
* or an absolute path(location) in case the resource
* is located outside the project directory
*
* @return IPath
*/
IPath getFullPath();
/**
* Returns the output argument of the action
* That generates this resource.
* In case the resource is the project source,
* The main input action is returned
* @see IBuildRepresentation.getInputAction()
*
* @return IBuildArgument
*/
IBuildIOType getProducerIOType();
/**
* Returns an array of arguments where this resource is used as an input
*
* @return IBuildArgument[]
*/
IBuildIOType[] getDependentIOTypes();
/**
* Returns true if the resource needs rebuild
*
* @return boolean
*/
boolean needsRebuild();
/**
* Returns true if this resource belongs to the project
*
* @return boolean
*
*/
boolean isProjectResource();
/**
* Returns true if the resource was removed from the build
* Note: the removed state represents is BUILD state rather than
* a file system state.
* If the build resouces is marked as removed that does not mean the
* resource is removed in the file system
* The removed state specifies that the resource is no longer used in the
* build process.
* E.g. the object file could be marked as removed if the source file was deleted
* in the file system
* The removed state information is used primarily for calculation
* of the project part that is to be rebuild
*
* @return boolean
*/
boolean isRemoved();
/**
* returns a build description that holds this step
*
* @return IBuildDescription
*/
IBuildDescription getBuildDescription();
}

View file

@ -0,0 +1,89 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import java.util.Map;
import org.eclipse.core.runtime.IPath;
/**
*
* This interface is used to represent the build action
*
*/
public interface IBuildStep {
/**
* Returns an array of input arguments for this action
* @see IBuildIOType
*
* @return IBuildIOType[]
*/
IBuildIOType[] getInputIOTypes();
/**
* Returns an array of input arguments for this action
* @see IBuildIOType
*
* @return IBuildIOType[]
*/
IBuildIOType[] getOutputIOTypes();
/**
* Returns true if the action needs rebuild, false - otherwise
*
* @return boolean
*/
boolean needsRebuild();
/**
* Returns the complete set of input resources for this action
*
* @return IBuildResource[]
*/
IBuildResource[] getInputResources();
/**
* Returns the complete set of output resources for this action
*
* @return IBuildResource[]
*/
IBuildResource[] getOutputResources();
/**
* Returns true if the action is removed (due to removal
* of the project resources that were ised in thie action)
*
* @return boolean
*/
boolean isRemoved();
/**
* returns a build description that holds this step
*
* @return IBuildDescription
*/
IBuildDescription getBuildDescription();
/**
*
* Returns the set of commands used for building the step
*
* NOTE: This is a preliminary method
*
* @param cwd
* @param inStepMap
* @param outStepMap
* @param resolveAll
* @return
*/
IBuildCommand[] getCommands(IPath cwd, Map inStepMap, Map outStepMap, boolean resolveAll);
}

View file

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import org.eclipse.core.runtime.CoreException;
/**
*
* This interface is used for the build description visitor mechanism
* to represent the visitor
*
* @see BuildDescriptionManager#accept(IStepVisitor, IBuildDescription, boolean)
*
*/
public interface IStepVisitor {
/**
* this call-back method is called by the build description
* visitor mechanism for each step in the build description
*
* @see BuildDescriptionManager#accept(IStepVisitor, IBuildDescription, boolean)
*
* @param step
* @return
* @throws CoreException
*/
boolean visit(IBuildStep step) throws CoreException;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation and others.
* Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -499,5 +499,13 @@ public interface IConfiguration extends IBuildObject {
* @return boolean
*/
public boolean isTemporary();
/**
* Returns whether this configuration requires a full rebuild
*
* @return boolean
*/
public boolean needsFullRebuild();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Symbian Ltd and others.
* Copyright (c) 2005, 2006 Symbian Ltd and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -156,4 +156,17 @@ public interface IHoldsOptions extends IBuildObject {
* Note: changing this option will affect all non-extension configurations using this option!
*/
IOption getOptionToSet(IOption option, boolean adjustExtension) throws BuildException;
/**
* specifies whether the option holder is modified and needs rebuild
*
* @return boolean
*/
public boolean needsRebuild();
/**
* sets the holder rebuild state
* @param rebuild
*/
public void setRebuildState(boolean rebuild);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Intel Corporation and others.
* Copyright (c) 2004, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -218,5 +218,17 @@ public interface IResourceConfiguration extends IBuildObject {
* @return IResource
*/
public IResource getOwner();
/**
* specifies whether the resource configuration is modified and needs rebuild
*
* @return boolean
*/
public boolean needsRebuild();
/**
* sets the resource configuration rebuild state
* @param rebuild
*/
void setRebuildState(boolean rebuild);
}

View file

@ -0,0 +1,73 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
import org.eclipse.core.runtime.IPath;
/**
*
*/
public class BuildCommand implements IBuildCommand {
private IPath fCmd;
private String fArgs[];
private Map fEnv;
private IPath fCWD;
private BuildStep fStep;
public BuildCommand(IPath cmd, String args[], Map env, IPath cwd, BuildStep step){
fCmd = cmd;
if(args != null)
fArgs = (String[])args.clone();
if(env != null)
fEnv = new HashMap(env);
fCWD = cwd;
fStep = step;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getCommand()
*/
public IPath getCommand() {
return fCmd;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getArgs()
*/
public String[] getArgs() {
if(fArgs != null)
return (String[])fArgs.clone();
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getEnvironment()
*/
public Map getEnvironment() {
if(fEnv != null)
return new HashMap(fEnv);
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getCWD()
*/
public IPath getCWD() {
return fCWD;
}
}

View file

@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildGroup;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
public class BuildGroup implements IBuildGroup {
private Set fActions = new HashSet();
private boolean fNeedsRebuild;
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildGroup#getSteps()
*/
public IBuildStep[] getSteps() {
return (IBuildStep[])fActions.toArray(new IBuildStep[fActions.size()]);
}
public void addAction(BuildStep action){
fActions.add(action);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildGroup#contains(org.eclipse.cdt.managedbuilder.builddescription.IBuildStep)
*/
public boolean contains(IBuildStep action) {
return fActions.contains(action);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildGroup#needsRebuild()
*/
public boolean needsRebuild() {
return fNeedsRebuild;
}
public void setRebuildState(boolean rebuild){
fNeedsRebuild = rebuild;
for(Iterator iter = fActions.iterator(); iter.hasNext();){
BuildStep action = (BuildStep)iter.next();
action.setRebuildState(rebuild);
}
}
}

View file

@ -0,0 +1,125 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IOutputType;
public class BuildIOType implements IBuildIOType {
private BuildStep fStep;
private List fResources = new ArrayList();
private boolean fIsInput;
private boolean fIsPrimary;
private String fLinkId;
private IBuildObject fIoType;
protected BuildIOType(BuildStep action, boolean input, boolean primary,/* BuildPattern pattern,*/ IBuildObject ioType ) {
fStep = action;
fIsInput = input;
fIsPrimary = primary;
if(ioType != null){
if(input){
if(ioType instanceof IInputType)
fLinkId = ((IInputType)ioType).getBuildVariable();
else
throw new IllegalArgumentException("wrong arg"); //$NON-NLS-1$
} else {
if(ioType instanceof IOutputType) {
fLinkId = ((IOutputType)ioType).getBuildVariable();
} else
throw new IllegalArgumentException("wrong arg"); //$NON-NLS-1$
}
fIoType = ioType;
} else {
//TODO
}
((BuildDescription)fStep.getBuildDescription()).typeCreated(this);
}
public IBuildResource[] getResources() {
return (BuildResource[])fResources.toArray(new BuildResource[fResources.size()]);
}
public IBuildStep getStep() {
return fStep;
}
public void addResource(BuildResource rc){
fResources.add(rc);
rc.addToArg(this);
if(DbgUtil.DEBUG)
DbgUtil.traceln("resource " + DbgUtil.resourceName(rc) + " added as " //$NON-NLS-1$ //$NON-NLS-2$
+ (fIsInput ? "input" : "output") //$NON-NLS-1$ //$NON-NLS-2$
+ " to the action " + DbgUtil.stepName(fStep)); //$NON-NLS-1$
((BuildDescription)fStep.getBuildDescription()).resourceAddedToType(this, rc);
}
public void removeResource(BuildResource rc){
fResources.remove(rc);
rc.removeFromArg(this);
if(DbgUtil.DEBUG)
DbgUtil.traceln("resource " + DbgUtil.resourceName(rc) + " removed as " //$NON-NLS-1$ //$NON-NLS-2$
+ (fIsInput ? "input" : "output") //$NON-NLS-1$ //$NON-NLS-2$
+ " from the action " + DbgUtil.stepName(fStep)); //$NON-NLS-1$
((BuildDescription)fStep.getBuildDescription()).resourceRemovedFromType(this, rc);
}
public boolean isInput() {
return fIsInput;
}
public boolean isPrimary(){
return fIsPrimary;
}
public String getLinkId(){
if(!fIsInput && fStep.getTool() != null && /*(fLinkId == null || fLinkId.length() == 0) && */
fStep.getTool().getCustomBuildStep()){
IBuildResource rcs[] = getResources();
if(rcs.length != 0){
BuildDescription.ToolAndType tt = ((BuildDescription)fStep.getBuildDescription()).getToolAndType((BuildResource)rcs[0], false);
if(tt != null){
IInputType type = tt.fTool.getPrimaryInputType();
if(type != null)
fLinkId = type.getBuildVariable();
} else {
}
}
}
return fLinkId;
}
public IBuildObject getIoType(){
return fIoType;
}
BuildResource[] remove(){
BuildResource rcs[] = (BuildResource[])getResources();
for(int i = 0; i < rcs.length; i++){
removeResource(rcs[i]);
}
fStep = null;
return rcs;
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.core.runtime.MultiStatus;
/**
*
*/
public class BuildMultiStatus extends MultiStatus {
public BuildMultiStatus(String message, Throwable exception){
super(ManagedBuilderCorePlugin.getUniqueIdentifier(), 0, message, exception);
}
}

View file

@ -0,0 +1,175 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.IPath;
public class BuildResource implements IBuildResource {
private List fDepArgs = new ArrayList();
private BuildIOType fProducerArg;
private boolean fNeedsRebuild;
private boolean fIsRemoved;
private IPath fLocation;
private IPath fFullPath;
private boolean fIsProjectRc;
private BuildDescription fInfo;
protected BuildResource(BuildDescription info, IResource rc){
this(info, rc.getLocation(), rc.getFullPath());
}
protected BuildResource(BuildDescription info, IPath location, IPath fullPath){
fLocation = location;
fInfo = info;
fFullPath = fullPath;
if(fFullPath != null)
fIsProjectRc = fFullPath.segment(0).equals(info.getProject().getName());
IResourceDelta delta = fInfo.getDelta();
if(delta != null && isProjectResource()){
IResourceDelta rcDelta = delta.findMember(getFullPath().removeFirstSegments(1));
if(rcDelta != null){
setRebuildState(true);
if(rcDelta.getKind() == IResourceDelta.REMOVED)
setRemoved();
}
}
info.resourceCreated(this);
if(DbgUtil.DEBUG)
DbgUtil.traceln("resource " + location + " created"); //$NON-NLS-1$ //$NON-NLS-2$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getLocation()
*/
public IPath getLocation() {
return fLocation;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getFullPath()
*/
public IPath getFullPath() {
return fFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getProducerIOType()
*/
public IBuildIOType getProducerIOType() {
return fProducerArg;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getDependentIOTypes()
*/
public IBuildIOType[] getDependentIOTypes() {
return (BuildIOType[])fDepArgs.toArray(new BuildIOType[fDepArgs.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#needsRebuild()
*/
public boolean needsRebuild() {
return fNeedsRebuild;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#isRemoved()
*/
public boolean isRemoved() {
return fIsRemoved;
}
public void setRemoved() {
fIsRemoved = true;
fNeedsRebuild = false;
}
public void setRebuildState(boolean rebuild){
fNeedsRebuild = rebuild;
}
void addToArg(BuildIOType arg){
if(arg.isInput()){
fDepArgs.add(arg);
} else {
if(fProducerArg == null)
fProducerArg = arg;
else {
String err = "ProducerArgument not null!!!\n"; //$NON-NLS-1$
if(DbgUtil.DEBUG){
err = err + "curent producer: " + DbgUtil.dumpStep(fProducerArg.getStep()) + "\n producer attempt: " + DbgUtil.dumpStep(arg.getStep()); //$NON-NLS-1$ //$NON-NLS-2$
}
throw new AssertionError(err);
}
}
}
void removeFromArg(BuildIOType arg){
if(arg.isInput()){
fDepArgs.remove(arg);
} else {
if(fProducerArg == arg)
fProducerArg = null;
else
throw new AssertionError("Resource is not produced by this arg!!!"); //$NON-NLS-1$
}
}
public boolean isProjectResource() {
return fIsProjectRc;
}
BuildIOType[][] clear(){
BuildIOType types[][] = new BuildIOType[2][];
types[0] = new BuildIOType[1];
types[0][0] = fProducerArg;
BuildIOType outs[] = (BuildIOType[])getDependentIOTypes();
types[1] = outs;
if(fProducerArg != null)
fProducerArg.removeResource(this);
for(int i = 0; i < outs.length; i++){
outs[i].removeResource(this);
}
return types;
}
BuildIOType[][] remove(){
BuildIOType types[][] = clear();
if(DbgUtil.DEBUG)
DbgUtil.traceln("resource " + DbgUtil.resourceName(this) + " removed"); //$NON-NLS-1$ //$NON-NLS-2$
fInfo.resourceRemoved(this);
fInfo = null;
return types;
}
public IBuildDescription getBuildDescription(){
return fInfo;
}
}

View file

@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
public class BuildStatus extends Status {
public BuildStatus(String message, Throwable exception) {
super(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), 0, message, exception);
}
}

View file

@ -0,0 +1,401 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroSubstitutor;
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.macros.IFileContextData;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public class BuildStep implements IBuildStep {
private List fInputTypes = new ArrayList();
private List fOutputTypes = new ArrayList();
private ITool fTool;
private BuildGroup fBuildGroup;
private boolean fNeedsRebuild;
private boolean fIsRemoved;
private BuildDescription fBuildDescription;
private IInputType fInputType;
private ITool fLibTool;
protected BuildStep(BuildDescription des, ITool tool, IInputType inputType){
fTool = tool;
fInputType = inputType;
fBuildDescription = des;
if(DbgUtil.DEBUG)
DbgUtil.traceln("step " + DbgUtil.stepName(this) + " created"); //$NON-NLS-1$ //$NON-NLS-2$
des.stepCreated(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputIOTypes()
*/
public IBuildIOType[] getInputIOTypes() {
return (BuildIOType[])fInputTypes.toArray(new BuildIOType[fInputTypes.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputIOTypes()
*/
public IBuildIOType[] getOutputIOTypes() {
return (BuildIOType[])fOutputTypes.toArray(new BuildIOType[fOutputTypes.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#needsRebuild()
*/
public boolean needsRebuild() {
if(fNeedsRebuild
|| (fTool != null && fTool.needsRebuild())
|| (fLibTool != null && fLibTool.needsRebuild()))
return true;
if(fBuildGroup != null && fBuildGroup.needsRebuild())
return true;
return false;
}
public void setRebuildState(boolean rebuild){
fNeedsRebuild = rebuild;
}
public BuildResource[] removeIOType(BuildIOType type) {
BuildResource rcs[] = type.remove();
if(type.isInput())
fInputTypes.remove(type);
else
fOutputTypes.remove(type);
return rcs;
}
BuildResource[][] remove(){
BuildResource[][] rcs = clear();
if(DbgUtil.DEBUG)
DbgUtil.traceln("step " + DbgUtil.stepName(this) + " removed"); //$NON-NLS-1$ //$NON-NLS-2$
fBuildDescription.stepRemoved(this);
fBuildDescription = null;
return rcs;
}
BuildResource[][] clear(){
BuildResource[][] rcs = new BuildResource[2][];
rcs[0] = (BuildResource[])getInputResources();
rcs[1] = (BuildResource[])getOutputResources();
BuildIOType types[] = (BuildIOType[])getInputIOTypes();
for(int i = 0; i < types.length; i++){
removeIOType(types[i]);
}
types = (BuildIOType[])getOutputIOTypes();
for(int i = 0; i < types.length; i++){
removeIOType(types[i]);
}
return rcs;
}
public BuildIOType createIOType(boolean input, boolean primary, /*String ext,*/ IBuildObject ioType) {
if(input){
if(fBuildDescription.getInputStep() == this)
throw new IllegalArgumentException("input step can not have inputs"); //$NON-NLS-1$
} else {
if(fBuildDescription.getOutputStep() == this)
throw new IllegalArgumentException("input step can not have outputs"); //$NON-NLS-1$
}
BuildIOType arg = new BuildIOType(this, input, primary, /*ext,*/ ioType);
if(input)
fInputTypes.add(arg);
else
fOutputTypes.add(arg);
return arg;
}
public void setTool(ITool tool){
fTool = tool;
}
public ITool getTool(){
return fTool;
}
public BuildIOType[] getPrimaryTypes(boolean input){
Iterator iter = input ?
fInputTypes.iterator() :
fOutputTypes.iterator();
List list = new ArrayList();
while(iter.hasNext()){
BuildIOType arg = (BuildIOType)iter.next();
if(arg.isPrimary())
list.add(arg);
}
return (BuildIOType[])list.toArray(new BuildIOType[list.size()]);
}
public BuildIOType getIOTypeForType(IBuildObject ioType, boolean input){
List list;
if(input)
list = fInputTypes;
else
list = fOutputTypes;
if(ioType != null){
for(Iterator iter = list.iterator();iter.hasNext();){
BuildIOType arg = (BuildIOType)iter.next();
if(arg.getIoType() == ioType)
return arg;
}
} else {
if(list.size() > 0)
return (BuildIOType)list.get(0);
}
return null;
}
protected void setGroup(BuildGroup group){
fBuildGroup = group;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputResources()
*/
public IBuildResource[] getInputResources() {
return getResources(true);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputResources()
*/
public IBuildResource[] getOutputResources() {
return getResources(false);
}
public IBuildResource[] getResources(boolean input){
Iterator iter = input ?
fInputTypes.iterator() :
fOutputTypes.iterator();
Set set = new HashSet();
while(iter.hasNext()){
IBuildResource rcs[] = ((BuildIOType)iter.next()).getResources();
for(int j = 0; j < rcs.length; j++){
set.add(rcs[j]);
}
}
return (BuildResource[])set.toArray(new BuildResource[set.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getCommands(org.eclipse.core.runtime.IPath, java.util.Map, java.util.Map, boolean)
*/
public IBuildCommand[] getCommands(IPath cwd, Map inputArgValues, Map outputArgValues, boolean resolveAll) {
if(fTool == null)
return null;
if(!cwd.isAbsolute())
cwd = fBuildDescription.getConfiguration().getOwner().getProject().getLocation().append(cwd);
BuildResource inRc = getRcForMacros(true);
BuildResource outRc = getRcForMacros(false);
IPath inRcPath = inRc != null ? BuildDescriptionManager.getRelPath(cwd, inRc.getLocation()) : null;
IPath outRcPath = outRc != null ? BuildDescriptionManager.getRelPath(cwd, outRc.getLocation()) : null;
IManagedCommandLineGenerator gen = fTool.getCommandLineGenerator();
FileContextData data = new FileContextData(inRcPath, outRcPath, null, fTool);
IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool,
resolveMacros(fTool.getToolCommand(), data, true),
getCommandFlags(inRcPath, outRcPath, resolveAll),
resolveMacros(fTool.getOutputFlag(), data, true),
resolveMacros(fTool.getOutputPrefix(), data, true),
listToString(resourcesToStrings(cwd, getPrimaryResources(false)), " "), //$NON-NLS-1$
resourcesToStrings(cwd, getPrimaryResources(true)),
fTool.getCommandLinePattern());
return createCommandsFromString(info.getCommandLine(), cwd);
}
protected IBuildCommand[] createCommandsFromString(String cmd, IPath cwd){
String[] cmds = cmd.split(" "); //$NON-NLS-1$
IPath c = new Path(cmds[0]);
String[] args = new String[cmds.length - 1];
System.arraycopy(cmds, 1, args, 0, args.length);
return new IBuildCommand[]{new BuildCommand(c, args, null, cwd, this)};
}
private BuildResource[] getPrimaryResources(boolean input){
BuildIOType[] types = getPrimaryTypes(input);
if(types.length == 0)
types = input ? (BuildIOType[])getInputIOTypes() : (BuildIOType[])getOutputIOTypes();
List list = new ArrayList();
for(int i = 0; i < types.length; i++){
BuildResource [] rcs = (BuildResource[])types[i].getResources();
for(int j = 0; j < rcs.length; j++){
list.add(rcs[j]);
}
}
return (BuildResource[])list.toArray(new BuildResource[list.size()]);
}
private String[] resourcesToStrings(IPath cwd, BuildResource rcs[]){
List list = new ArrayList(rcs.length);
for(int i = 0; i < rcs.length; i++){
list.add(BuildDescriptionManager.getRelPath(cwd, rcs[i].getLocation()).toOSString());
}
return (String[])list.toArray(new String[list.size()]);
}
private String resolveMacros(String str, IFileContextData fileData, boolean resolveAll){
try {
String tmp = resolveAll ? ManagedBuildManager.getBuildMacroProvider().resolveValue(str, "", " ", IBuildMacroProvider.CONTEXT_FILE, fileData) //$NON-NLS-1$ //$NON-NLS-2$
:
ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(str, "", " ", IBuildMacroProvider.CONTEXT_FILE, fileData); //$NON-NLS-1$ //$NON-NLS-2$
if((tmp = tmp.trim()).length() != 0)
str = tmp;
} catch (BuildMacroException e) {
}
return str;
}
private String[] getCommandFlags(IPath inRcPath, IPath outRcPath, boolean resolveAll){
try {
return resolveAll ?
((Tool)fTool).getToolCommandFlags(inRcPath, outRcPath,
new DefaultMacroSubstitutor(IBuildMacroProvider.CONTEXT_FILE, new FileContextData(inRcPath, outRcPath, null, fTool), "", " ")) //$NON-NLS-1$ //$NON-NLS-2$
:
fTool.getToolCommandFlags(inRcPath, outRcPath);
} catch (BuildException e) {
}
return new String[0];
}
private String listToString(String[] list, String delimiter){
if(list == null || list.length == 0)
return new String();
StringBuffer buf = new StringBuffer(list[0]);
for(int i = 1; i < list.length; i++){
buf.append(delimiter).append(list[i]);
}
return buf.toString();
}
private BuildResource getRcForMacros(boolean input){
IBuildIOType types[] = getPrimaryTypes(input);
if(types.length != 0){
for(int i = 0; i < types.length; i++){
IBuildResource rcs[] = types[i].getResources();
if(rcs.length != 0)
return (BuildResource)rcs[0];
}
}
types = input ? getInputIOTypes() : getOutputIOTypes();
if(types.length != 0){
for(int i = 0; i < types.length; i++){
IBuildResource rcs[] = types[i].getResources();
if(rcs.length != 0)
return (BuildResource)rcs[0];
}
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#isRemoved()
*/
public boolean isRemoved(){
return fIsRemoved;
}
public void setRemoved() {
fIsRemoved = true;
fNeedsRebuild = false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getBuildDescription()
*/
public IBuildDescription getBuildDescription(){
return fBuildDescription;
}
boolean isMultiAction(){
BuildIOType args[] = getPrimaryTypes(true);
BuildIOType arg = args.length > 0 ? args[0] : null;
if(arg != null){
if(arg.getIoType() != null)
return ((IInputType)arg.getIoType()).getMultipleOfType();
return fTool != null && fTool == ((Configuration)fBuildDescription.getConfiguration()).calculateTargetTool();
}
return false;
}
public IInputType getInputType(){
return fInputType;
}
public void setLibTool(ITool libTool){
fLibTool = libTool;
}
public ITool getLibTool(){
return fLibTool;
}
}

View file

@ -0,0 +1,140 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
import org.eclipse.cdt.managedbuilder.core.ITool;
/*
* this is the build description debug utility class
*/
public class DbgUtil {
public static final boolean DEBUG = false;
private static PrintStream out = System.out;
public static void trace(String str){
out.print(str);
}
public static void traceln(String str){
out.println(str);
}
public static String stepName(IBuildStep action){
ITool tool = action instanceof BuildStep ? ((BuildStep)action).getTool() : null;
if(tool != null)
return tool.getName();
if(action.getBuildDescription().getInputStep() == action)
return "input step"; //$NON-NLS-1$
if(action.getBuildDescription().getOutputStep() == action)
return "output step"; //$NON-NLS-1$
return "<undefined name>"; //$NON-NLS-1$
}
public static String resourceName(IBuildResource rc){
if(rc.getFullPath() != null)
return rc.getFullPath().toString();
return rc.getLocation().toString();
}
public static String dumpType(IBuildIOType type){
StringBuffer buf = new StringBuffer();
buf.append("dumping type: "); //$NON-NLS-1$
buf.append(type.isInput() ? "INPUT" : "OUTPUT"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(ioTypeResources(type));
buf.append("end dumping type"); //$NON-NLS-1$
return buf.toString();
}
public static String ioTypeResources(IBuildIOType type){
StringBuffer buf = new StringBuffer();
IBuildResource rcs[] = type.getResources();
buf.append("\n"); //$NON-NLS-1$
for(int i = 0; i < rcs.length; i++){
buf.append(resourceName(rcs[i]));
buf.append("\n"); //$NON-NLS-1$
}
return buf.toString();
}
public static String dumpStep(IBuildStep step, boolean inputs) {
StringBuffer buf = new StringBuffer();
buf.append("dumping step ").append(stepName(step)).append(inputs ? " inputs" : " outputs"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IBuildIOType types[] = inputs ? step.getInputIOTypes() : step.getOutputIOTypes();
buf.append("\n"); //$NON-NLS-1$
for(int i = 0; i < types.length; i++){
buf.append("ioType " + i + ":"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(ioTypeResources(types[i]));
}
buf.append("end dump step\n"); //$NON-NLS-1$
return buf.toString();
}
public static String dumpStep(IBuildStep step){
return dumpStep(step, true) + dumpStep(step, false);
}
public static String dumpResource(IBuildResource rc){
return dumpResource(rc, true) + dumpResource(rc, false);
}
public static String dumpResource(IBuildResource rc, boolean producer){
StringBuffer buf = new StringBuffer();
buf.append("dumping resource ").append(resourceName(rc)).append(producer ? " producer:" : " deps:"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if(producer){
if(rc.getProducerIOType() != null)
buf.append(dumpStep(rc.getProducerIOType().getStep()));
else
buf.append("\nresourse has no producer\n"); //$NON-NLS-1$
} else {
IBuildIOType types[] = rc.getDependentIOTypes();
if(types.length > 0){
Set set = new HashSet();
for(int i = 0; i < types.length; i++){
if(set.add(types[i].getStep())){
buf.append(dumpStep(types[i].getStep()));
}
}
} else {
buf.append("\n resource has no deps\n"); //$NON-NLS-1$
}
}
buf.append("end dump resource\n"); //$NON-NLS-1$
return buf.toString();
}
public static void flush(){
out.flush();
}
}

View file

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescriptionFactory;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
public class DefaultBuildDescriptionFactory implements IBuildDescriptionFactory {
static private DefaultBuildDescriptionFactory fInstance;
protected DefaultBuildDescriptionFactory(){
}
public static DefaultBuildDescriptionFactory getInstance(){
if(fInstance == null)
fInstance = new DefaultBuildDescriptionFactory();
return fInstance;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescriptionFactory#createBuildDescription(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.core.resources.IResourceDelta, int)
*/
public IBuildDescription createBuildDescription(IConfiguration cfg, IResourceDelta delta, int flags) throws CoreException {
BuildDescription info = new BuildDescription();
info.init(cfg, delta, flags);
return info;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescriptionFactory#getSupportedMethods()
*/
public int getSupportedMethods() {
return BuildDescriptionManager.REMOVED | BuildDescriptionManager.REBUILD;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -30,6 +30,7 @@ public class AdditionalInput implements IAdditionalInput {
private boolean isExtensionAdditionalInput = false;
private boolean isDirty = false;
private boolean resolved = true;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -65,6 +66,7 @@ public class AdditionalInput implements IAdditionalInput {
isExtensionAdditionalInput = isExtensionElement;
if (!isExtensionElement) {
setDirty(true);
setRebuildState(true);
}
}
@ -103,6 +105,7 @@ public class AdditionalInput implements IAdditionalInput {
}
setDirty(true);
setRebuildState(true);
}
/*
@ -226,6 +229,7 @@ public class AdditionalInput implements IAdditionalInput {
if (paths == null || newPaths == null || !(paths.equals(newPaths))) {
paths = newPaths;
isDirty = true;
setRebuildState(true);
}
}
@ -246,6 +250,7 @@ public class AdditionalInput implements IAdditionalInput {
if (kind == null || !(kind.intValue() == newKind)) {
kind = new Integer(newKind);
isDirty = true;
setRebuildState(true);
}
}
@ -285,4 +290,15 @@ public class AdditionalInput implements IAdditionalInput {
}
}
public boolean needsRebuild(){
return rebuildState;
}
public void setRebuildState(boolean rebuild){
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation and others.
* Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -346,7 +346,7 @@ public class Configuration extends BuildObject implements IConfiguration {
// Hook me up
managedProject.addConfiguration(this);
setDirty(true);
rebuildNeeded = true;
setRebuildState(true);
}
/*
@ -719,7 +719,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if (option.getBooleanValue() != value) {
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
rebuildNeeded = true;
// rebuildNeeded = true;
}
return retOpt;
}
@ -734,7 +734,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if (oldValue != null && !oldValue.equals(value)) {
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
rebuildNeeded = true;
// rebuildNeeded = true;
}
return retOpt;
}
@ -769,7 +769,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if(!Arrays.equals(value, oldValue)) {
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
rebuildNeeded = true;
// rebuildNeeded = true;
}
return retOpt;
}
@ -807,7 +807,7 @@ public class Configuration extends BuildObject implements IConfiguration {
getResourceConfigurationList().add(resConfig);
getResourceConfigurationMap().put(resConfig.getResourcePath(), resConfig);
isDirty = true;
rebuildNeeded = true;
// rebuildNeeded = true;
}
public void removeResourceConfiguration(IResourceConfiguration resConfig) {
@ -816,7 +816,7 @@ public class Configuration extends BuildObject implements IConfiguration {
getResourceConfigurationList().remove(resConfig);
getResourceConfigurationMap().remove(resConfig.getResourcePath());
isDirty = true;
rebuildNeeded = true;
// rebuildNeeded = true;
}
/*
* M O D E L A T T R I B U T E A C C E S S O R S
@ -1060,7 +1060,15 @@ public class Configuration extends BuildObject implements IConfiguration {
if (extension == null && artifactExtension == null) return;
if (artifactExtension == null || extension == null || !artifactExtension.equals(extension)) {
artifactExtension = extension;
rebuildNeeded = true;
// rebuildNeeded = true;
if(!isExtensionElement()){
ITool tool = calculateTargetTool();
if(tool != null){
tool.setRebuildState(true);
} else {
setRebuildState(true);
}
}
isDirty = true;
}
}
@ -1072,7 +1080,15 @@ public class Configuration extends BuildObject implements IConfiguration {
if (name == null && artifactName == null) return;
if (artifactName == null || name == null || !artifactName.equals(name)) {
artifactName = name;
rebuildNeeded = true;
if(!isExtensionElement()){
ITool tool = calculateTargetTool();
if(tool != null) {
tool.setRebuildState(true);
} else {
setRebuildState(true);
}
}
// rebuildNeeded = true;
isDirty = true;
}
}
@ -1120,7 +1136,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if(makeArgs == null){ //resetting the build arguments
if(!builder.isExtensionElement()){
builder.setArguments(makeArgs);
rebuildNeeded = true;
// rebuildNeeded = true;
}
}else if(!makeArgs.equals(builder.getArguments())){
if (builder.isExtensionElement()) {
@ -1129,7 +1145,7 @@ public class Configuration extends BuildObject implements IConfiguration {
builder = toolChain.createBuilder(builder, subId, builderName, false);
}
builder.setArguments(makeArgs);
rebuildNeeded = true;
// rebuildNeeded = true;
}
}
@ -1142,7 +1158,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if(command == null){ //resetting the build command
if(!builder.isExtensionElement()){
builder.setCommand(command);
rebuildNeeded = true;
// rebuildNeeded = true;
}
} else if(!command.equals(builder.getCommand())){
if (builder.isExtensionElement()) {
@ -1151,7 +1167,7 @@ public class Configuration extends BuildObject implements IConfiguration {
builder = toolChain.createBuilder(builder, subId, builderName, false);
}
builder.setCommand(command);
rebuildNeeded = true;
// rebuildNeeded = true;
}
}
@ -1162,7 +1178,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if (step == null && prebuildStep == null) return;
if (prebuildStep == null || step == null || !prebuildStep.equals(step)) {
prebuildStep = step;
rebuildNeeded = true;
// rebuildNeeded = true;
isDirty = true;
}
}
@ -1175,7 +1191,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if (step == null && postbuildStep == null) return;
if (postbuildStep == null || step == null || !postbuildStep.equals(step)) {
postbuildStep = step;
rebuildNeeded = true;
// rebuildNeeded = true;
isDirty = true;
}
}
@ -1187,7 +1203,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if (announceStep == null && preannouncebuildStep == null) return;
if (preannouncebuildStep == null || announceStep == null || !preannouncebuildStep.equals(announceStep)) {
preannouncebuildStep = announceStep;
rebuildNeeded = true;
// rebuildNeeded = true;
isDirty = true;
}
}
@ -1199,7 +1215,7 @@ public class Configuration extends BuildObject implements IConfiguration {
if (announceStep == null && postannouncebuildStep == null) return;
if (postannouncebuildStep == null || announceStep == null || !postannouncebuildStep.equals(announceStep)) {
postannouncebuildStep = announceStep;
rebuildNeeded = true;
// rebuildNeeded = true;
isDirty = true;
}
}
@ -1290,7 +1306,39 @@ public class Configuration extends BuildObject implements IConfiguration {
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#needsRebuild()
*/
public boolean needsRebuild() {
return rebuildNeeded;
return needsRebuild(true);
}
public boolean needsFullRebuild() {
return needsRebuild(false);
}
public boolean needsRebuild(boolean checkChildren) {
if(rebuildNeeded || !checkChildren)
return rebuildNeeded;
if(toolChain.needsRebuild())
return true;
for(Iterator iter = resourceConfigurationList.iterator();iter.hasNext();){
IResourceConfiguration rcCfg = (IResourceConfiguration)iter.next();
if(rcCfg.needsRebuild())
return true;
ITool tools[] = rcCfg.getToolsToInvoke();
for(int i = 0; i < tools.length; i++){
if(tools[i].needsRebuild())
return true;
}
}
ITool tools[] = getFilteredTools();
for(int i = 0; i < tools.length; i++){
if(tools[i].needsRebuild())
return true;
}
return false;
}
/* (non-Javadoc)
@ -1314,9 +1362,29 @@ public class Configuration extends BuildObject implements IConfiguration {
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
if(isExtensionElement() && rebuild)
return;
rebuildNeeded = rebuild;
if(rebuild && !isTemporary())
((EnvironmentVariableProvider)ManagedBuildManager.getEnvironmentVariableProvider()).checkBuildPathVariables(this);
if(!rebuildNeeded){
toolChain.setRebuildState(false);
for(Iterator iter = resourceConfigurationList.iterator();iter.hasNext();){
IResourceConfiguration rcCfg = (IResourceConfiguration)iter.next();
rcCfg.setRebuildState(false);
ITool tools[] = rcCfg.getToolsToInvoke();
for(int i = 0; i < tools.length; i++){
tools[i].setRebuildState(false);
}
}
ITool tools[] = getFilteredTools();
for(int i = 0; i < tools.length; i++){
tools[i].setRebuildState(false);
}
}
}
/* (non-Javadoc)
@ -1390,7 +1458,7 @@ public class Configuration extends BuildObject implements IConfiguration {
toolChain.removeOption(opts[j]);
}
rebuildNeeded = true;
// rebuildNeeded = true;
}
/*
@ -1486,4 +1554,32 @@ public class Configuration extends BuildObject implements IConfiguration {
setDirty(true);
}
}
public ITool calculateTargetTool(){
ITool tool = getTargetTool();
if(tool == null){
IConfiguration extCfg;
for(extCfg = this;
extCfg != null && !extCfg.isExtensionElement();
extCfg = extCfg.getParent()){
}
String ext = extCfg != null ? extCfg.getArtifactExtension() :
getArtifactExtension();
// Get all the tools for the current config
ITool[] tools = getFilteredTools();
for (int index = 0; index < tools.length; index++) {
ITool t = tools[index];
if (t.producesFileType(ext)) {
tool = t;
break;
}
}
}
return tool;
}
}

View file

@ -27,7 +27,9 @@ import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
@ -61,7 +63,6 @@ import org.eclipse.core.runtime.SubProgressMonitor;
* @since 1.2
*/
public class GeneratedMakefileBuilder extends ACBuilder {
/**
* @since 1.2
*/
@ -327,13 +328,72 @@ public class GeneratedMakefileBuilder extends ACBuilder {
outputError(getProject().getName(), "Build information is not valid"); //$NON-NLS-1$
return referencedProjects;
}
// Create a makefile generator for the build
IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getBuildfileGenerator(info.getDefaultConfiguration());
generator.initialize(getProject(), info, monitor);
IConfiguration cfg = info.getDefaultConfiguration();
//perform necessary cleaning and build type calculation
if(cfg.needsFullRebuild()){
//configuration rebuild state is set to true,
//full rebuild is needed in any case
//clean first, then make a full build
outputTrace(getProject().getName(), "config rebuild state is set to true, making a full rebuild"); //$NON-NLS-1$
clean(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
fullBuild(info, generator, monitor);
} else {
boolean fullBuildNeeded = info.needsRebuild();
IBuildDescription des = null;
IResourceDelta delta = kind == FULL_BUILD ? null : getDelta(getProject());
if(delta == null)
fullBuildNeeded = true;
if(cfg.needsRebuild() || delta != null){
//use a build desacription model to calculate the resources to be cleaned
//only in case there are some changes to the project sources or build information
try{
int flags = BuildDescriptionManager.REBUILD;
if(delta != null)
flags |= BuildDescriptionManager.REMOVED;
outputTrace(getProject().getName(), "using a build description.."); //$NON-NLS-1$
des = BuildDescriptionManager.createBuildDescription(info.getDefaultConfiguration(), getDelta(getProject()), flags);
BuildDescriptionManager.cleanRebuildResources(des);
} catch (Throwable e){
//TODO: log error
outputError(getProject().getName(), "error occured while build description calculation: " + e.getLocalizedMessage()); //$NON-NLS-1$
//in case an error occured, make it behave in the old stile:
if(info.needsRebuild()){
//make a full clean if an info needs a rebuild
clean(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
fullBuildNeeded = true;
}
else if(delta != null && !fullBuildNeeded){
// Create a delta visitor to detect the build type
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(info);
delta.accept(visitor);
if (visitor.shouldBuildFull()) {
fullBuildNeeded = true;
}
}
}
}
if(fullBuildNeeded){
outputTrace(getProject().getName(), "performing a full build"); //$NON-NLS-1$
fullBuild(info, generator, monitor);
} else {
outputTrace(getProject().getName(), "performing an incremental build"); //$NON-NLS-1$
incrementalBuild(delta, info, generator, monitor);
}
}
/*
// So let's figure out why we got called
if (kind == FULL_BUILD || info.needsRebuild()) {
if (kind == FULL_BUILD) {
outputTrace(getProject().getName(), "Full build needed/requested"); //$NON-NLS-1$
fullBuild(info, generator, monitor);
}
@ -385,6 +445,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
}
}
*/
// Scrub the build info the project
info.setRebuildState(false);
// Ask build mechanism to compute deltas for project dependencies next time
@ -505,7 +566,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
//in case one or more of the generated makefiles (e.g. dep files) are corrupted,
//the builder invocation might fail because of the possible syntax errors, so e.g. "make clean" will not work
//we need to explicitly clean the generated directories
clean(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
// clean(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
// Regenerate the makefiles for this project
checkCancel(monitor);
@ -913,10 +974,18 @@ public class GeneratedMakefileBuilder extends ACBuilder {
} catch (IOException e) {
}
if (launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(),
int state = launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(),
new SubProgressMonitor(monitor,
IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
IProgressMonitor.UNKNOWN));
if(state != CommandLauncher.OK){
errMsg = launcher.getErrorMessage();
if(state == CommandLauncher.COMMAND_CANCELED){
//TODO: the better way of handling cancel is needed
//currently the rebuild state is set to true forcing the full rebuild
//on the next builder invocation
info.getDefaultConfiguration().setRebuildState(true);
}
}
// Force a resync of the projects without allowing the user to cancel.

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Symbian Ltd and others.
* Copyright (c) 2005, 2006 Symbian Ltd and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -62,6 +62,7 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
private Map optionMap;
// Miscellaneous
private boolean isDirty = false;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -189,8 +190,10 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement) {
Option option = new Option(this, superClass, Id, name, isExtensionElement);
addOption(option);
if(!isExtensionElement)
if(!isExtensionElement){
setDirty(true);
setRebuildState(true);
}
return option;
}
@ -214,6 +217,7 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
getOptionList().remove(option);
getOptionMap().remove(option.getId());
setDirty(true);
setRebuildState(true);
}
/* (non-Javadoc)
@ -509,6 +513,9 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getOptionToSet(org.eclipse.cdt.managedbuilder.core.IOption, boolean)
*/
public IOption getOptionToSet(IOption option, boolean adjustExtension) throws BuildException{
IOption setOption = null;
if(option.getOptionHolder() != this)
@ -565,4 +572,40 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
}
return setOption;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#needsRebuild()
*/
public boolean needsRebuild() {
if(rebuildState)
return true;
// Otherwise see if any options need saving
List optionElements = getOptionList();
Iterator iter = optionElements.listIterator();
while (iter.hasNext()) {
Option option = (Option) iter.next();
if (option.needsRebuild()) return true;
}
return rebuildState;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
rebuildState = rebuild;
// Propagate "false" to the children
if (!rebuildState) {
List optionElements = getOptionList();
Iterator iter = optionElements.listIterator();
while (iter.hasNext()) {
Option option = (Option) iter.next();
if(!option.isExtensionElement())
option.setRebuildState(false);
}
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IInputOrder;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -31,6 +31,7 @@ public class InputOrder implements IInputOrder {
private boolean isExtensionInputOrder = false;
private boolean isDirty = false;
private boolean resolved = true;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -108,6 +109,7 @@ public class InputOrder implements IInputOrder {
}
setDirty(true);
setRebuildState(true);
}
/*
@ -216,6 +218,7 @@ public class InputOrder implements IInputOrder {
if (path == null || newPath == null || !(path.equals(newPath))) {
path = newPath;
isDirty = true;
setRebuildState(true);
}
}
@ -234,6 +237,7 @@ public class InputOrder implements IInputOrder {
if (order == null || newOrder == null || !(order.equals(newOrder))) {
order = newOrder;
isDirty = true;
setRebuildState(true);
}
}
@ -251,6 +255,7 @@ public class InputOrder implements IInputOrder {
if (excluded == null || !(b == excluded.booleanValue())) {
excluded = new Boolean(b);
setDirty(true);
setRebuildState(true);
}
}
@ -291,4 +296,14 @@ public class InputOrder implements IInputOrder {
}
}
public boolean needsRebuild(){
return rebuildState;
}
public void setRebuildState(boolean rebuild){
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
}
}

View file

@ -67,6 +67,7 @@ public class InputType extends BuildObject implements IInputType {
private boolean isExtensionInputType = false;
private boolean isDirty = false;
private boolean resolved = true;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -131,6 +132,7 @@ public class InputType extends BuildObject implements IInputType {
ManagedBuildManager.addExtensionInputType(this);
} else {
setDirty(true);
setRebuildState(true);
}
}
@ -237,6 +239,7 @@ public class InputType extends BuildObject implements IInputType {
}
setDirty(true);
setRebuildState(true);
}
/*
@ -756,6 +759,7 @@ public class InputType extends BuildObject implements IInputType {
if (buildVariable == null || variableName == null || !(variableName.equals(buildVariable))) {
buildVariable = variableName;
setDirty(true);
setRebuildState(true);
}
}
@ -785,6 +789,7 @@ public class InputType extends BuildObject implements IInputType {
dependencyContentTypeId = null;
}
setDirty(true);
setRebuildState(true);
}
}
@ -817,6 +822,7 @@ public class InputType extends BuildObject implements IInputType {
}
}
setDirty(true);
setRebuildState(true);
}
/* (non-Javadoc)
@ -908,6 +914,7 @@ public class InputType extends BuildObject implements IInputType {
public void setDependencyGeneratorElement(IConfigurationElement element) {
dependencyGeneratorElement = element;
setDirty(true);
setRebuildState(true);
}
/* (non-Javadoc)
@ -931,6 +938,7 @@ public class InputType extends BuildObject implements IInputType {
if (multipleOfType == null || !(b == multipleOfType.booleanValue())) {
multipleOfType = new Boolean(b);
setDirty(true);
setRebuildState(true);
}
}
@ -955,6 +963,7 @@ public class InputType extends BuildObject implements IInputType {
if (primaryInput == null || !(b == primaryInput.booleanValue())) {
primaryInput = new Boolean(b);
setDirty(true);
setRebuildState(true);
}
}
@ -980,6 +989,7 @@ public class InputType extends BuildObject implements IInputType {
if (id == null || optionId == null || !(optionId.equals(id))) {
optionId = id;
setDirty(true);
setRebuildState(true);
}
}
@ -1005,6 +1015,7 @@ public class InputType extends BuildObject implements IInputType {
if (id == null || assignToOptionId == null || !(assignToOptionId.equals(id))) {
assignToOptionId = id;
setDirty(true);
setRebuildState(true);
}
}
@ -1034,6 +1045,7 @@ public class InputType extends BuildObject implements IInputType {
sourceContentTypeId = null;
}
setDirty(true);
setRebuildState(true);
}
}
@ -1064,6 +1076,7 @@ public class InputType extends BuildObject implements IInputType {
}
}
setDirty(true);
setRebuildState(true);
}
/* (non-Javadoc)
@ -1218,4 +1231,45 @@ public class InputType extends BuildObject implements IInputType {
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
public boolean needsRebuild(){
if(rebuildState)
return true;
Iterator typeIter = getInputOrderList().iterator();
while (typeIter.hasNext()) {
InputOrder current = (InputOrder)typeIter.next();
if (current.needsRebuild()) return true;
}
typeIter = getAdditionalInputList().iterator();
while (typeIter.hasNext()) {
AdditionalInput current = (AdditionalInput)typeIter.next();
if (current.needsRebuild()) return true;
}
return rebuildState;
}
public void setRebuildState(boolean rebuild){
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
// Propagate "false" to the children
if (!rebuild) {
Iterator typeIter = getInputOrderList().iterator();
while (typeIter.hasNext()) {
InputOrder current = (InputOrder)typeIter.next();
current.setRebuildState(false);
}
typeIter = getAdditionalInputList().iterator();
while (typeIter.hasNext()) {
AdditionalInput current = (AdditionalInput)typeIter.next();
current.setRebuildState(false);
}
}
}
}

View file

@ -949,6 +949,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
// Save it
defaultConfig = configuration;
defaultConfigId = configuration.getId();
defaultConfig.setRebuildState(true);
// TODO: is this appropriate?
persistDefaultConfiguration();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation and others.
* Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -86,6 +86,7 @@ public class Option extends BuildObject implements IOption {
* MBS 2.0 model OptionReference element
*/
private boolean isUdjusted = false;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -137,6 +138,7 @@ public class Option extends BuildObject implements IOption {
ManagedBuildManager.addExtensionOption(this);
} else {
setDirty(true);
setRebuildState(true);
}
}
@ -264,8 +266,10 @@ public class Option extends BuildObject implements IOption {
valueHandlerExtraArgument = new String(option.valueHandlerExtraArgument);
}
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
setRebuildState(true);
}
}
/*
@ -1337,8 +1341,10 @@ public class Option extends BuildObject implements IOption {
*/
public void setDefaultValue(Object v) {
defaultValue = v;
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
/* (non-Javadoc)
@ -1352,8 +1358,10 @@ public class Option extends BuildObject implements IOption {
} else {
categoryId = null;
}
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
}
@ -1364,8 +1372,10 @@ public class Option extends BuildObject implements IOption {
if (cmd == null && command == null) return;
if (cmd == null || command == null || !cmd.equals(command)) {
command = cmd;
if(!isExtensionElement())
if(!isExtensionElement()){
isDirty = true;
rebuildState = true;
}
}
}
@ -1376,8 +1386,10 @@ public class Option extends BuildObject implements IOption {
if (cmd == null && commandFalse == null) return;
if (cmd == null || commandFalse == null || !cmd.equals(commandFalse)) {
commandFalse = cmd;
if(!isExtensionElement())
isDirty = true;
if(!isExtensionElement()){
isDirty = true;
rebuildState = true;
}
}
}
@ -1388,8 +1400,10 @@ public class Option extends BuildObject implements IOption {
if (tooltip == null && tip == null) return;
if (tooltip == null || tip == null || !tooltip.equals(tip)) {
tip = tooltip;
if(!isExtensionElement())
if(!isExtensionElement()){
isDirty = true;
rebuildState = true;
}
}
}
@ -1399,8 +1413,10 @@ public class Option extends BuildObject implements IOption {
public void setResourceFilter(int filter) {
if (resourceFilter == null || !(filter == resourceFilter.intValue())) {
resourceFilter = new Integer(filter);
if(!isExtensionElement())
if(!isExtensionElement()){
isDirty = true;
rebuildState = true;
}
}
}
@ -1410,8 +1426,10 @@ public class Option extends BuildObject implements IOption {
public void setBrowseType(int type) {
if (browseType == null || !(type == browseType.intValue())) {
browseType = new Integer(type);
if(!isExtensionElement())
if(!isExtensionElement()){
isDirty = true;
rebuildState = true;
}
}
}
@ -1424,8 +1442,10 @@ public class Option extends BuildObject implements IOption {
} else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
@ -1439,8 +1459,10 @@ public class Option extends BuildObject implements IOption {
} else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
@ -1463,8 +1485,10 @@ public class Option extends BuildObject implements IOption {
else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
/* (non-Javadoc)
@ -1472,8 +1496,10 @@ public class Option extends BuildObject implements IOption {
*/
public void setValue(Object v) {
value = v;
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
/* (non-Javadoc)
@ -1483,8 +1509,10 @@ public class Option extends BuildObject implements IOption {
// TODO: Verify that this is a valid type
if (valueType == null || valueType.intValue() != type) {
valueType = new Integer(type);
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
}
@ -1505,8 +1533,10 @@ public class Option extends BuildObject implements IOption {
*/
public void setValueHandlerElement(IConfigurationElement element) {
valueHandlerElement = element;
if(!isExtensionElement())
if(!isExtensionElement()){
setDirty(true);
rebuildState = true;
}
}
/* (non-Javadoc)
@ -1557,8 +1587,10 @@ public class Option extends BuildObject implements IOption {
valueHandlerExtraArgument == null ||
!extraArgument.equals(valueHandlerExtraArgument)) {
valueHandlerExtraArgument = extraArgument;
if(!isExtensionElement())
if(!isExtensionElement()){
isDirty = true;
rebuildState = true;
}
}
}
@ -1864,4 +1896,14 @@ public class Option extends BuildObject implements IOption {
}
}
public boolean needsRebuild() {
return rebuildState;
}
public void setRebuildState(boolean rebuild) {
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -60,6 +60,7 @@ public class OutputType extends BuildObject implements IOutputType {
private boolean isExtensionOutputType = false;
private boolean isDirty = false;
private boolean resolved = true;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -110,6 +111,7 @@ public class OutputType extends BuildObject implements IOutputType {
ManagedBuildManager.addExtensionOutputType(this);
} else {
setDirty(true);
setRebuildState(true);
}
}
@ -186,6 +188,7 @@ public class OutputType extends BuildObject implements IOutputType {
nameProvider = outputType.nameProvider;
setDirty(true);
setRebuildState(true);
}
/*
@ -468,6 +471,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (buildVariable == null || variableName == null || !(variableName.equals(buildVariable))) {
buildVariable = variableName;
setDirty(true);
setRebuildState(true);
}
}
@ -492,6 +496,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (multipleOfType == null || !(b == multipleOfType.booleanValue())) {
multipleOfType = new Boolean(b);
setDirty(true);
setRebuildState(true);
}
}
@ -518,6 +523,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (namePattern == null || pattern == null || !(pattern.equals(namePattern))) {
namePattern = pattern;
setDirty(true);
setRebuildState(true);
}
}
@ -539,6 +545,7 @@ public class OutputType extends BuildObject implements IOutputType {
public void setNameProviderElement(IConfigurationElement element) {
nameProviderElement = element;
setDirty(true);
setRebuildState(true);
}
/* (non-Javadoc)
@ -582,6 +589,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (id == null || optionId == null || !(optionId.equals(id))) {
optionId = id;
setDirty(true);
setRebuildState(true);
}
}
@ -611,6 +619,7 @@ public class OutputType extends BuildObject implements IOutputType {
outputContentTypeId = null;
}
setDirty(true);
setRebuildState(true);
}
}
@ -636,6 +645,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (outputs == null || exts == null || !(exts.equals(outputs))) {
outputs = exts;
setDirty(true);
setRebuildState(true);
}
}
@ -687,6 +697,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (outputPrefix == null || prefix == null || !(prefix.equals(outputPrefix))) {
outputPrefix = prefix;
setDirty(true);
setRebuildState(true);
}
}
@ -715,6 +726,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (outputNames == null || names == null || !(names.equals(outputNames))) {
outputNames = names;
setDirty(true);
setRebuildState(true);
}
}
@ -746,6 +758,7 @@ public class OutputType extends BuildObject implements IOutputType {
primaryInputTypeId = null;
}
setDirty(true);
setRebuildState(true);
}
}
@ -770,6 +783,7 @@ public class OutputType extends BuildObject implements IOutputType {
if (primaryOutput == null || !(b == primaryOutput.booleanValue())) {
primaryOutput = new Boolean(b);
setDirty(true);
setRebuildState(true);
}
}
@ -859,4 +873,15 @@ public class OutputType extends BuildObject implements IOutputType {
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
public boolean needsRebuild(){
return rebuildState;
}
public void setRebuildState(boolean rebuild){
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -407,8 +407,9 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
if(rcCfg != null && !oldPath.equals(newPath)){
config.removeResourceConfiguration(rcCfg);
rcCfg.setResourcePath(newPath.toString());
rcCfg.setRebuildState(true);
((Configuration)config).addResourceConfiguration((ResourceConfiguration)rcCfg);
config.setRebuildState(true);
// config.setRebuildState(true);
return true;
}
return false;
@ -418,7 +419,7 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
IResourceConfiguration rcCfg = config.getResourceConfiguration(path.toString());
if(rcCfg != null){
config.removeResourceConfiguration(rcCfg);
config.setRebuildState(true);
// config.setRebuildState(true);
return true;
}
return false;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -21,11 +21,10 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IResource;
@ -52,6 +51,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
private boolean isExtensionResourceConfig = false;
private boolean isDirty = false;
private boolean resolved = true;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -128,6 +128,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
isExcluded = new Boolean(false);
toolsToInvoke = EMPTY_STRING;
rcbsApplicability = new Integer(KIND_DISABLE_RCBS_TOOL);
setRebuildState(true);
}
/**
@ -203,6 +204,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
}
setDirty(true);
setRebuildState(true);
}
/*
@ -424,6 +426,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
public void addTool(Tool tool) {
getToolList().add(tool);
getToolMap().put(tool.getId(), tool);
setRebuildState(true);
}
/* (non-Javadoc)
@ -434,6 +437,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
public void removeTool(ITool tool) {
getToolList().remove(tool);
getToolMap().remove(tool);
setRebuildState(true);
}
/*
@ -631,6 +635,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
if (rcbsApplicability == null || !(rcbsApplicability.intValue() == newValue)) {
rcbsApplicability = new Integer(newValue);
isDirty = true;
setRebuildState(true);
}
}
@ -641,7 +646,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
if (isExcluded == null || excluded != isExcluded.booleanValue()) {
isExcluded = new Boolean(excluded);
setDirty(true);
parent.setRebuildState(true);
setRebuildState(true);
}
}
@ -654,6 +659,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
if (resPath == null || !path.equals(resPath)) {
resPath = path;
setDirty(true);
setRebuildState(true);
}
}
@ -770,7 +776,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
retOpt.setValue(value);
// TODO: This causes the entire project to be rebuilt. Is there a way to only have this
// file rebuilt? "Clean" its output? Change its modification date?
parent.setRebuildState(true);
// parent.setRebuildState(true);
}
return retOpt;
}
@ -786,7 +792,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
retOpt.setValue(value);
// TODO: This causes the entire project to be rebuilt. Is there a way to only have this
// file rebuilt? "Clean" its output? Change its modification date?
parent.setRebuildState(true);
// parent.setRebuildState(true);
}
return retOpt;
}
@ -823,7 +829,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
retOpt.setValue(value);
// TODO: This causes the entire project to be rebuilt. Is there a way to only have this
// file rebuilt? "Clean" its output? Change its modification date?
parent.setRebuildState(true);
// parent.setRebuildState(true);
}
return retOpt;
}
@ -858,4 +864,38 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
((Tool)iter.next()).updateManagedBuildRevision(revision);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#needsRebuild()
*/
public boolean needsRebuild() {
if(rebuildState)
return true;
ITool tools[] = getToolsToInvoke();
for(int i = 0; i < tools.length; i++){
if(tools[i].needsRebuild())
return true;
}
return rebuildState;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
if(isExtensionResourceConfiguration() && rebuild)
return;
rebuildState = rebuild;
if(!rebuildState){
ITool tools[] = getToolsToInvoke();
for(int i = 0; i < tools.length; i++){
tools[i].setRebuildState(false);
}
}
}
}

View file

@ -125,6 +125,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
private boolean resolved = resolvedDefault;
private IConfigurationElement previousMbsVersionConversionElement = null;
private IConfigurationElement currentMbsVersionConversionElement = null;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -216,6 +217,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
ManagedBuildManager.addExtensionTool(this);
} else {
setDirty(true);
setRebuildState(true);
}
}
@ -248,6 +250,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
ManagedBuildManager.addExtensionTool(this);
} else {
setDirty(true);
setRebuildState(true);
}
}
@ -421,6 +424,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
}
setDirty(true);
setRebuildState(true);
}
/*
@ -2004,6 +2008,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
if (cmd == null || command == null || !cmd.equals(command)) {
command = cmd;
isDirty = true;
setRebuildState(true);
return true;
} else {
return false;
@ -2017,6 +2022,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
if (pattern == null && commandLinePattern == null) return;
if (pattern == null || commandLinePattern == null || !pattern.equals(commandLinePattern)) {
commandLinePattern = pattern;
setRebuildState(true);
isDirty = true;
}
}
@ -2028,6 +2034,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
if (flag == null && outputFlag == null) return;
if (outputFlag == null || flag == null || !(flag.equals(outputFlag))) {
outputFlag = flag;
setRebuildState(true);
isDirty = true;
}
}
@ -2039,6 +2046,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
if (prefix == null && outputPrefix == null) return;
if (outputPrefix == null || prefix == null || !(prefix.equals(outputPrefix))) {
outputPrefix = prefix;
setRebuildState(true);
isDirty = true;
}
}
@ -2822,4 +2830,58 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
return globalSpecs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.internal.core.HoldsOptions#needsRebuild()
*/
public boolean needsRebuild() {
if(rebuildState)
return true;
// Check my children
List typeElements = getInputTypeList();
Iterator iter = typeElements.listIterator();
while (iter.hasNext()) {
InputType type = (InputType) iter.next();
if (type.needsRebuild()) return true;
}
typeElements = getOutputTypeList();
iter = typeElements.listIterator();
while (iter.hasNext()) {
OutputType type = (OutputType) iter.next();
if (type.needsRebuild()) return true;
}
return super.needsRebuild();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.internal.core.HoldsOptions#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
if(!rebuild){
super.setRebuildState(rebuild);
if (!rebuild) {
List typeElements = getInputTypeList();
Iterator iter = typeElements.listIterator();
while (iter.hasNext()) {
InputType type = (InputType) iter.next();
type.setRebuildState(false);
}
typeElements = getOutputTypeList();
iter = typeElements.listIterator();
while (iter.hasNext()) {
OutputType type = (OutputType) iter.next();
type.setRebuildState(false);
}
}
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Intel Corporation and others.
* Copyright (c) 2004, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -92,6 +92,7 @@ public class ToolChain extends HoldsOptions implements IToolChain {
private IConfigurationElement previousMbsVersionConversionElement = null;
private IConfigurationElement currentMbsVersionConversionElement = null;
private boolean rebuildState;
/*
* C O N S T R U C T O R S
@ -185,6 +186,7 @@ public class ToolChain extends HoldsOptions implements IToolChain {
ManagedBuildManager.addExtensionToolChain(this);
} else {
setDirty(true);
setRebuildState(true);
}
}
@ -363,6 +365,7 @@ public class ToolChain extends HoldsOptions implements IToolChain {
}
setDirty(true);
setRebuildState(true);
}
/*
@ -1727,4 +1730,25 @@ public class ToolChain extends HoldsOptions implements IToolChain {
builder.updateManagedBuildRevision(revision);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.internal.core.HoldsOptions#needsRebuild()
*/
public boolean needsRebuild() {
if(rebuildState)
return true;
return super.needsRebuild();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.internal.core.HoldsOptions#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
if(isExtensionElement() && rebuild)
return;
rebuildState = rebuild;
if(!rebuild)
super.setRebuildState(rebuild);
}
}

View file

@ -1251,4 +1251,17 @@ public class ToolReference implements IToolReference {
public IOption getOptionToSet(IOption option, boolean adjustExtension){
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#needsRebuild()
*/
public boolean needsRebuild() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -273,12 +273,12 @@ public class UserDefinedEnvironmentSupplier extends
if(context == null)
return;
if(context instanceof IConfiguration){
((IConfiguration)context).setRebuildState(true);
cfgVarsModified((IConfiguration)context);
}
else if(context instanceof IManagedProject){
IConfiguration cfgs[] = ((IManagedProject)context).getConfigurations();
for(int i = 0; i < cfgs.length; i++){
cfgs[i].setRebuildState(true);
cfgVarsModified(cfgs[i]);
}
}
else if(context instanceof IWorkspace){
@ -289,7 +289,7 @@ public class UserDefinedEnvironmentSupplier extends
if(info != null){
IConfiguration cfgs[] = info.getManagedProject().getConfigurations();
for(int j = 0; j < cfgs.length; j++){
cfgs[j].setRebuildState(true);
cfgVarsModified(cfgs[j]);
}
}
}
@ -297,6 +297,11 @@ public class UserDefinedEnvironmentSupplier extends
}
}
protected void cfgVarsModified(IConfiguration cfg){
cfg.setRebuildState(true);
EnvironmentVariableProvider.getDefault().checkBuildPathVariables(cfg);
}
protected String getValidName(String name){
if(name == null || (name = name.trim()).length() == 0)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -334,4 +334,26 @@ public class BuildMacroProvider implements IBuildMacroProvider {
public boolean canKeepMacrosInBuildfile(IBuilder builder){
return MacroResolver.canKeepMacrosInBuildfile(builder);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#resolveStringListValues(java.lang.String[], java.lang.String, java.lang.String, int, java.lang.Object)
*/
public String[] resolveStringListValues(String[] value, String nonexistentMacrosValue, String listDelimiter, int contextType, Object contextData) throws BuildMacroException {
IMacroContextInfo info = getMacroContextInfo(contextType,contextData);
if(info != null)
return MacroResolver.resolveStringListValues(value,
getMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter), true);
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider#resolveStringListValuesToMakefileFormat(java.lang.String[], java.lang.String, java.lang.String, int, java.lang.Object)
*/
public String[] resolveStringListValuesToMakefileFormat(String[] value, String nonexistentMacrosValue, String listDelimiter, int contextType, Object contextData) throws BuildMacroException {
IMacroContextInfo info = getMacroContextInfo(contextType,contextData);
if(info != null)
return MacroResolver.resolveStringListValues(value,
getBuildfileMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter), true);
return null;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -114,6 +114,18 @@ public interface IBuildMacroProvider{
int contextType,
Object contextData) throws BuildMacroException;
/**
*
* resolves macros in the array of string-list values
*
* @see isStringListValue
*/
public String[] resolveStringListValues(String value[],
String nonexistentMacrosValue,
String listDelimiter,
int contextType,
Object contextData) throws BuildMacroException;
/**
*
* resolves all macros in the string to the makefile format. That is:
@ -155,6 +167,18 @@ public interface IBuildMacroProvider{
int contextType,
Object contextData) throws BuildMacroException;
/**
* resolves macros in the array of string-list values
* macros are resolved to the makefile format
*
* @see isStringListValue
*/
public String[] resolveStringListValuesToMakefileFormat(String value[],
String nonexistentMacrosValue,
String listDelimiter,
int contextType,
Object contextData) throws BuildMacroException;
/**
*

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -510,7 +510,7 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
}
if (rebuildNeeded && !rcbsStillDisabledSoNoRebuild) {
rcConfig.getParent().setRebuildState(true);
// rcConfig.getParent().setRebuildState(true);
}
setDirty(false);

View file

@ -657,7 +657,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
// file rebuilt? "Clean" its output? Change its modification date?
//realCfg.setRebuildState(true);
//} else {
realCfg.setRebuildState(true);
// realCfg.setRebuildState(true);
//}
}
currentValue = ((ITool)realHo).getCommandLinePattern();
@ -668,7 +668,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
// file rebuilt? "Clean" its output? Change its modification date?
//realCfg.setRebuildState(true);
//} else {
realCfg.setRebuildState(true);
// realCfg.setRebuildState(true);
//}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Intel Corporation and others.
* Copyright (c) 2004, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -487,7 +487,7 @@ public class ResourceBuildPropertyPage extends AbstractBuildPropertyPage impleme
ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
if (getCurrentResourceConfigClone().isDirty()) {
selectedConfiguration.setRebuildState(true);
// selectedConfiguration.setRebuildState(true);
getCurrentResourceConfigClone().setDirty(false);
}