mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Build Model and Internal Builder fixes and enhancements
This commit is contained in:
parent
bfbd80c0fa
commit
6140a76f77
12 changed files with 160 additions and 92 deletions
|
@ -2382,13 +2382,13 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
fail("build description creation failed: " + e.getLocalizedMessage());
|
fail("build description creation failed: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
IBuildResource rcs[] = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
IBuildResource rcs[] = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
||||||
assertEquals(rcs.length, 0);
|
assertEquals(rcs.length, 0);
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 0);
|
assertEquals(rcs.length, 0);
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 0);
|
assertEquals(rcs.length, 0);
|
||||||
|
|
||||||
//target
|
//target
|
||||||
|
@ -2400,7 +2400,7 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("build description creation failed: " + e.getLocalizedMessage());
|
fail("build description creation failed: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
||||||
IBuildResource oRcs[] = des.getOutputStep().getInputResources();
|
IBuildResource oRcs[] = des.getOutputStep().getInputResources();
|
||||||
IBuildResource targetRc;
|
IBuildResource targetRc;
|
||||||
assertEquals(rcs.length, 1);
|
assertEquals(rcs.length, 1);
|
||||||
|
@ -2410,10 +2410,10 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
|
|
||||||
targetRc = oRcs[0];
|
targetRc = oRcs[0];
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 0);
|
assertEquals(rcs.length, 0);
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 1);
|
assertEquals(rcs.length, 1);
|
||||||
assertEquals(oRcs.length, 1);
|
assertEquals(oRcs.length, 1);
|
||||||
if(rcs[0] != oRcs[0])
|
if(rcs[0] != oRcs[0])
|
||||||
|
@ -2429,7 +2429,7 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("build description creation failed: " + e.getLocalizedMessage());
|
fail("build description creation failed: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
||||||
oRcs = des.getOutputStep().getInputResources();
|
oRcs = des.getOutputStep().getInputResources();
|
||||||
assertEquals(oRcs.length, 1);
|
assertEquals(oRcs.length, 1);
|
||||||
targetRc = oRcs[0];
|
targetRc = oRcs[0];
|
||||||
|
@ -2451,10 +2451,10 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
fail("rebuild resources do not match");
|
fail("rebuild resources do not match");
|
||||||
|
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 0);
|
assertEquals(rcs.length, 0);
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 5);
|
assertEquals(rcs.length, 5);
|
||||||
if(!resourcesEqual(rcs, oRcs))
|
if(!resourcesEqual(rcs, oRcs))
|
||||||
fail("rebuild resources do not match");
|
fail("rebuild resources do not match");
|
||||||
|
@ -2469,7 +2469,7 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("build description creation failed: " + e.getLocalizedMessage());
|
fail("build description creation failed: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD);
|
||||||
oRcs = des.getOutputStep().getInputResources();
|
oRcs = des.getOutputStep().getInputResources();
|
||||||
assertEquals(oRcs.length, 1);
|
assertEquals(oRcs.length, 1);
|
||||||
targetRc = oRcs[0];
|
targetRc = oRcs[0];
|
||||||
|
@ -2487,10 +2487,10 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
fail("rebuild resources do not match");
|
fail("rebuild resources do not match");
|
||||||
|
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 0);
|
assertEquals(rcs.length, 0);
|
||||||
|
|
||||||
rcs = BuildDescriptionManager.filterBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED);
|
||||||
assertEquals(rcs.length, 3);
|
assertEquals(rcs.length, 3);
|
||||||
if(!resourcesEqual(rcs, oRcs))
|
if(!resourcesEqual(rcs, oRcs))
|
||||||
fail("rebuild resources do not match");
|
fail("rebuild resources do not match");
|
||||||
|
|
|
@ -39,8 +39,9 @@ public class BuildDescriptionManager {
|
||||||
public static final int REMOVED = 0x01;
|
public static final int REMOVED = 0x01;
|
||||||
public static final int REBUILD = 0x02;
|
public static final int REBUILD = 0x02;
|
||||||
public static final int DEPS = 0x04;
|
public static final int DEPS = 0x04;
|
||||||
public static final int DEPS_CMODEL = DEPS & 0x08;
|
public static final int DEPS_CMODEL = DEPS | 0x08;
|
||||||
public static final int DEPS_DEPGEN = DEPS & 0x10;
|
public static final int DEPS_DEPGEN = DEPS | 0x10;
|
||||||
|
public static final int DEPS_DEPFILE_INFO = DEPS | 0x20;
|
||||||
|
|
||||||
private Set fVisitedSteps = new HashSet();
|
private Set fVisitedSteps = new HashSet();
|
||||||
private boolean fUp;
|
private boolean fUp;
|
||||||
|
@ -168,7 +169,7 @@ public class BuildDescriptionManager {
|
||||||
return (IBuildStep[])set.toArray(new IBuildStep[set.size()]);
|
return (IBuildStep[])set.toArray(new IBuildStep[set.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBuildResource[] filterBuildResources(IBuildResource rc[], int rcState){
|
public static IBuildResource[] filterGeneratedBuildResources(IBuildResource rc[], int rcState){
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
|
|
||||||
addBuildResources(rc, list, rcState);
|
addBuildResources(rc, list, rcState);
|
||||||
|
@ -231,8 +232,8 @@ public class BuildDescriptionManager {
|
||||||
* @param des build description
|
* @param des build description
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static void cleanRebuildResources(IBuildDescription des) throws CoreException{
|
public static void cleanGeneratedRebuildResources(IBuildDescription des) throws CoreException{
|
||||||
IBuildResource bRcs[] = filterBuildResources(des.getResources(), REMOVED | REBUILD);
|
IBuildResource bRcs[] = filterGeneratedBuildResources(des.getResources(), REMOVED | REBUILD);
|
||||||
List failList = new ArrayList();
|
List failList = new ArrayList();
|
||||||
|
|
||||||
for(int i = 0; i < bRcs.length; i++){
|
for(int i = 0; i < bRcs.length; i++){
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* 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();
|
|
||||||
}
|
|
|
@ -48,6 +48,11 @@ import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||||
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
|
||||||
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
||||||
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
|
||||||
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
|
||||||
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceDelta;
|
import org.eclipse.core.resources.IResourceDelta;
|
||||||
|
@ -649,7 +654,7 @@ public class BuildDescription implements IBuildDescription {
|
||||||
return fOutputStep;
|
return fOutputStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkFlags(int flags){
|
public boolean checkFlags(int flags){
|
||||||
return (fFlags & flags) == flags;
|
return (fFlags & flags) == flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,14 +887,18 @@ public class BuildDescription implements IBuildDescription {
|
||||||
|
|
||||||
if(outFullPath.isAbsolute()){
|
if(outFullPath.isAbsolute()){
|
||||||
outLocation = outFullPath;
|
outLocation = outFullPath;
|
||||||
if(!fProject.getLocation().isPrefixOf(outLocation))
|
if(fProject.getLocation().isPrefixOf(outLocation))
|
||||||
|
outFullPath = fProject.getFullPath().append(outLocation.removeFirstSegments(fProject.getLocation().segmentCount()));
|
||||||
|
else
|
||||||
outFullPath = null;
|
outFullPath = null;
|
||||||
} else {
|
} else {
|
||||||
if (outFullPath.segmentCount() == 1) {
|
if (outFullPath.segmentCount() == 1) {
|
||||||
outFullPath = outDirPath.append(outFullPath);
|
outFullPath = outDirPath.append(outFullPath);
|
||||||
}
|
|
||||||
|
|
||||||
outLocation = fProject.getLocation().append(outFullPath.removeFirstSegments(1));
|
outLocation = fProject.getLocation().append(outFullPath.removeFirstSegments(1));
|
||||||
|
} else {
|
||||||
|
outLocation = getTopBuildDirLocation().append(outFullPath);
|
||||||
|
outFullPath = getTopBuildDirFullPath().append(outFullPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildResource outRc = createResource(outLocation, outFullPath);
|
BuildResource outRc = createResource(outLocation, outFullPath);
|
||||||
|
@ -1192,6 +1201,54 @@ public class BuildDescription implements IBuildDescription {
|
||||||
BuildResource outRc = createResource(outLocation, outFullPath);
|
BuildResource outRc = createResource(outLocation, outFullPath);
|
||||||
buildArg.addResource(outRc);
|
buildArg.addResource(outRc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(checkFlags(BuildDescriptionManager.DEPS_DEPFILE_INFO)){
|
||||||
|
if(tool != null && buildRc != null){
|
||||||
|
IInputType type = action.getInputType();
|
||||||
|
String ext = null;
|
||||||
|
if(type != null){
|
||||||
|
String exts[] = type.getSourceExtensions(tool);
|
||||||
|
String location = buildRc.getLocation().toOSString();
|
||||||
|
for(int i = 0; i < exts.length; i++){
|
||||||
|
if(location.endsWith(exts[i])){
|
||||||
|
ext = exts[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ext == null)
|
||||||
|
ext = buildRc.getLocation().getFileExtension();
|
||||||
|
|
||||||
|
if(ext != null){
|
||||||
|
IManagedDependencyGeneratorType depGenType = tool.getDependencyGeneratorForExtension(ext);
|
||||||
|
if(depGenType != null){
|
||||||
|
IPath depFiles[] = null;
|
||||||
|
if(depGenType instanceof IManagedDependencyGenerator2){
|
||||||
|
IBuildObject context = tool.getParent();
|
||||||
|
if(context instanceof IToolChain){
|
||||||
|
context = ((IToolChain)context).getParent();
|
||||||
|
}
|
||||||
|
IPath path = buildRc.isProjectResource() ?
|
||||||
|
buildRc.getFullPath().removeFirstSegments(1) :
|
||||||
|
buildRc.getLocation();
|
||||||
|
IManagedDependencyInfo info = ((IManagedDependencyGenerator2)depGenType).getDependencySourceInfo(path, context, tool, getDefaultBuildDirLocation());
|
||||||
|
if(info instanceof IManagedDependencyCommands){
|
||||||
|
depFiles = ((IManagedDependencyCommands)info).getDependencyFiles();
|
||||||
|
}
|
||||||
|
} else if (depGenType.getCalculatorType() == IManagedDependencyGeneratorType.TYPE_COMMAND
|
||||||
|
&& depGenType instanceof IManagedDependencyGenerator) {
|
||||||
|
depFiles = new IPath[1];
|
||||||
|
depFiles[0] = new Path(buildRc.getLocation().segment(buildRc.getLocation().segmentCount() -1 )).removeFileExtension().addFileExtension("d"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
if(depFiles != null){
|
||||||
|
BuildIOType depType = action.createIOType(false, false, null);
|
||||||
|
addOutputs(depFiles, depType, outDirPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,9 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
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;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
|
||||||
|
|
||||||
public class BuildGroup implements IBuildGroup {
|
public class BuildGroup {
|
||||||
private Set fActions = new HashSet();
|
private Set fActions = new HashSet();
|
||||||
private boolean fNeedsRebuild;
|
private boolean fNeedsRebuild;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceDelta;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public class BuildResource implements IBuildResource {
|
public class BuildResource implements IBuildResource {
|
||||||
|
|
|
@ -240,14 +240,33 @@ public class BuildStep implements IBuildStep {
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getCommands(org.eclipse.core.runtime.IPath, java.util.Map, java.util.Map, boolean)
|
* @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) {
|
public IBuildCommand[] getCommands(IPath cwd, Map inputArgValues, Map outputArgValues, boolean resolveAll) {
|
||||||
if(fTool == null)
|
if(fTool == null){
|
||||||
|
String step = null;
|
||||||
|
if(this == fBuildDescription.getInputStep()){
|
||||||
|
step = fBuildDescription.getConfiguration().getPrebuildStep();
|
||||||
|
} else if(this == fBuildDescription.getOutputStep()){
|
||||||
|
step = fBuildDescription.getConfiguration().getPostbuildStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(step != null){
|
||||||
|
String commands[] = step.split(";"); //$NON-NLS-1$
|
||||||
|
if(cwd == null)
|
||||||
|
cwd = calcCWD();
|
||||||
|
|
||||||
|
List list = new ArrayList();
|
||||||
|
for(int i = 0; i < commands.length; i++){
|
||||||
|
IBuildCommand cmds[] = createCommandsFromString(commands[i], cwd, getEnvironment());
|
||||||
|
for(int j = 0; j < cmds.length; j++){
|
||||||
|
list.add(cmds[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (IBuildCommand[])list.toArray(new BuildCommand[list.size()]);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if(cwd == null)
|
if(cwd == null)
|
||||||
cwd = fBuildDescription.getDefaultBuildDirLocation();
|
cwd = calcCWD();
|
||||||
|
|
||||||
if(!cwd.isAbsolute())
|
|
||||||
cwd = fBuildDescription.getConfiguration().getOwner().getProject().getLocation().append(cwd);
|
|
||||||
|
|
||||||
performAsignToOption(cwd);
|
performAsignToOption(cwd);
|
||||||
|
|
||||||
|
@ -270,6 +289,15 @@ public class BuildStep implements IBuildStep {
|
||||||
return createCommandsFromString(info.getCommandLine(), cwd, getEnvironment());
|
return createCommandsFromString(info.getCommandLine(), cwd, getEnvironment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IPath calcCWD(){
|
||||||
|
IPath cwd = fBuildDescription.getDefaultBuildDirLocation();
|
||||||
|
|
||||||
|
if(!cwd.isAbsolute())
|
||||||
|
cwd = fBuildDescription.getConfiguration().getOwner().getProject().getLocation().append(cwd);
|
||||||
|
|
||||||
|
return cwd;
|
||||||
|
}
|
||||||
|
|
||||||
protected Map getEnvironment(){
|
protected Map getEnvironment(){
|
||||||
return fBuildDescription.getEnvironment();
|
return fBuildDescription.getEnvironment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DefaultBuildDescriptionFactory implements IBuildDescriptionFactory
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescriptionFactory#getSupportedMethods()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescriptionFactory#getSupportedMethods()
|
||||||
*/
|
*/
|
||||||
public int getSupportedMethods() {
|
public int getSupportedMethods() {
|
||||||
return BuildDescriptionManager.REMOVED | BuildDescriptionManager.REBUILD;
|
return BuildDescriptionManager.REMOVED | BuildDescriptionManager.REBUILD | BuildDescriptionManager.DEPS_DEPFILE_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,10 @@ import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -90,10 +93,13 @@ public class StepBuilder implements IBuildModelBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return postProcess(status);
|
return postProcess(status, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int postProcess(int status){
|
protected int postProcess(int status, IProgressMonitor monitor){
|
||||||
|
if(status != STATUS_ERROR_LAUNCH){
|
||||||
|
refreshOutputs(monitor);
|
||||||
|
}
|
||||||
switch(status){
|
switch(status){
|
||||||
case STATUS_OK:
|
case STATUS_OK:
|
||||||
break;
|
break;
|
||||||
|
@ -101,24 +107,48 @@ public class StepBuilder implements IBuildModelBuilder {
|
||||||
case STATUS_ERROR_BUILD:
|
case STATUS_ERROR_BUILD:
|
||||||
case STATUS_ERROR_LAUNCH:
|
case STATUS_ERROR_LAUNCH:
|
||||||
default:
|
default:
|
||||||
cleanOutputs();
|
cleanOutputs(monitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cleanOutputs(){
|
protected void refreshOutputs(IProgressMonitor monitor){
|
||||||
|
if(fStep == fStep.getBuildDescription().getInputStep())
|
||||||
|
return;
|
||||||
|
|
||||||
|
IBuildResource rcs[] = fStep.getOutputResources();
|
||||||
|
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
for(int i = 0; i < rcs.length; i++){
|
||||||
|
IPath path = rcs[i].getFullPath();
|
||||||
|
if(path != null){
|
||||||
|
IFile file = root.getFile(path);
|
||||||
|
try {
|
||||||
|
file.refreshLocal(IResource.DEPTH_ZERO, monitor);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
if(DbgUtil.DEBUG){
|
||||||
|
DbgUtil.traceln("failed to refresh resource " //$NON-NLS-1$
|
||||||
|
+ file.getFullPath()
|
||||||
|
+ ", error: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void cleanOutputs(IProgressMonitor monitor){
|
||||||
IBuildResource bRcs[] = fStep.getOutputResources();
|
IBuildResource bRcs[] = fStep.getOutputResources();
|
||||||
for(int i = 0; i < bRcs.length; i++){
|
for(int i = 0; i < bRcs.length; i++){
|
||||||
IResource rc = BuildDescriptionManager.findResourceForBuildResource(bRcs[i]);
|
IResource rc = BuildDescriptionManager.findResourceForBuildResource(bRcs[i]);
|
||||||
if(rc != null){
|
if(rc != null){
|
||||||
try {
|
try {
|
||||||
rc.delete(true, null);
|
rc.delete(true, monitor);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
if(DbgUtil.DEBUG){
|
if(DbgUtil.DEBUG){
|
||||||
DbgUtil.traceln("failed to delete resource "
|
DbgUtil.traceln("failed to delete resource " //$NON-NLS-1$
|
||||||
+ rc.getFullPath()
|
+ rc.getFullPath()
|
||||||
+ ", error: " + e.getLocalizedMessage());
|
+ ", error: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,7 +448,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
//use a build desacription model to calculate the resources to be cleaned
|
//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
|
//only in case there are some changes to the project sources or build information
|
||||||
try{
|
try{
|
||||||
int flags = BuildDescriptionManager.REBUILD;
|
int flags = BuildDescriptionManager.REBUILD | BuildDescriptionManager.DEPS_DEPFILE_INFO;
|
||||||
if(delta != null)
|
if(delta != null)
|
||||||
flags |= BuildDescriptionManager.REMOVED;
|
flags |= BuildDescriptionManager.REMOVED;
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
|
|
||||||
des = BuildDescriptionManager.createBuildDescription(info.getDefaultConfiguration(), getDelta(getProject()), flags);
|
des = BuildDescriptionManager.createBuildDescription(info.getDefaultConfiguration(), getDelta(getProject()), flags);
|
||||||
|
|
||||||
BuildDescriptionManager.cleanRebuildResources(des);
|
BuildDescriptionManager.cleanGeneratedRebuildResources(des);
|
||||||
} catch (Throwable e){
|
} catch (Throwable e){
|
||||||
//TODO: log error
|
//TODO: log error
|
||||||
outputError(getProject().getName(), "error occured while build description calculation: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
outputError(getProject().getName(), "error occured while build description calculation: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
@ -1249,10 +1249,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
|
|
||||||
int status = builder.build(epmOutputStream, epmOutputStream, monitor);
|
int status = builder.build(epmOutputStream, epmOutputStream, monitor);
|
||||||
|
|
||||||
// Force a resync of the projects without allowing the user to cancel.
|
//no refresh is needed since the builder now performs
|
||||||
// This is probably unkind, but short of this there is no way to insure
|
//a refresh automatically after each build step
|
||||||
// the UI is up-to-date with the build results
|
/* monitor.subTask(ManagedMakeMessages
|
||||||
monitor.subTask(ManagedMakeMessages
|
|
||||||
.getResourceString(REFRESH));
|
.getResourceString(REFRESH));
|
||||||
try {
|
try {
|
||||||
currentProject.refreshLocal(
|
currentProject.refreshLocal(
|
||||||
|
@ -1261,7 +1260,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
monitor.subTask(ManagedMakeMessages
|
monitor.subTask(ManagedMakeMessages
|
||||||
.getResourceString(REFRESH_ERROR));
|
.getResourceString(REFRESH_ERROR));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Report either the success or failure of our mission
|
// Report either the success or failure of our mission
|
||||||
buf = new StringBuffer();
|
buf = new StringBuffer();
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,10 @@ public class PropertyManager {
|
||||||
|
|
||||||
protected void setProperty(IConfiguration cfg, IBuildObject bo, String prop, String value){
|
protected void setProperty(IConfiguration cfg, IBuildObject bo, String prop, String value){
|
||||||
Properties props = getProperties(cfg, bo);
|
Properties props = getProperties(cfg, bo);
|
||||||
if(props != null)
|
if(props != null){
|
||||||
props.setProperty(prop, value);
|
props.setProperty(prop, value);
|
||||||
|
serialize(cfg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getProperty(IConfiguration cfg, IBuildObject bo, String prop){
|
protected String getProperty(IConfiguration cfg, IBuildObject bo, String prop){
|
||||||
|
|
|
@ -436,7 +436,6 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
|
||||||
// No state to be saved by the plug-in, but request a
|
// No state to be saved by the plug-in, but request a
|
||||||
// resource delta to be used on next activation.
|
// resource delta to be used on next activation.
|
||||||
context.needDelta();
|
context.needDelta();
|
||||||
PropertyManager.getInstance().serialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue