1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

RESOLVED - bug 273636: changes to enable MBS on EFS projects

https://bugs.eclipse.org/bugs/show_bug.cgi?id=273636
This commit is contained in:
Chris Recoskie 2009-04-28 12:02:33 +00:00
parent 1e31821df4
commit 09f3368f3e
18 changed files with 263 additions and 114 deletions

View file

@ -60,6 +60,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@SuppressWarnings("restriction")
public class BuildDescriptionModelTests extends TestCase {
private static final String PREFIX = "BuildDescription_";
private static final String PROJ_PATH = "testBuildDescriptionProjects";
@ -68,15 +69,15 @@ public class BuildDescriptionModelTests extends TestCase {
private Runnable fCleaner = fCompositeCleaner;
private class CompositeCleaner implements Runnable{
private List fRunnables = new ArrayList();
private List<Runnable> fRunnables = new ArrayList<Runnable>();
public void addRunnable(Runnable r){
fRunnables.add(r);
}
public void run() {
for(Iterator iter = fRunnables.iterator(); iter.hasNext();){
Runnable r = (Runnable)iter.next();
for(Iterator<Runnable> iter = fRunnables.iterator(); iter.hasNext();){
Runnable r = iter.next();
r.run();
}
fRunnables.clear();
@ -84,7 +85,7 @@ public class BuildDescriptionModelTests extends TestCase {
}
private class ProjectCleaner implements Runnable{
List fProjList = new ArrayList();
List<String> fProjList = new ArrayList<String>();
public ProjectCleaner(){
}
@ -106,8 +107,8 @@ public class BuildDescriptionModelTests extends TestCase {
}
public void run() {
for(Iterator iter = fProjList.iterator(); iter.hasNext();){
String name = (String)iter.next();
for(Iterator<String> iter = fProjList.iterator(); iter.hasNext();){
String name = iter.next();
ManagedBuildTestHelper.removeProject(name);
}
fProjList.clear();
@ -143,7 +144,7 @@ public class BuildDescriptionModelTests extends TestCase {
if(aAsmRc != des.createResource("a.asm"))
fail("new build resource created for the same resource");
if(aAsmRc != des.createResource(aAsm.getLocation(), aAsm.getFullPath()))
if(aAsmRc != des.createResource(aAsm.getLocation(), aAsm.getLocationURI()))
fail("new build resource created for the same resource");
assertEquals(aAsmRc.getProducerIOType(), null);
@ -157,6 +158,7 @@ public class BuildDescriptionModelTests extends TestCase {
if(type == null)
fail("failed to create output type");
assertNotNull(type);
assertEquals(type.getStep(), inStep);
type.addResource(aAsmRc);
@ -558,21 +560,21 @@ public class BuildDescriptionModelTests extends TestCase {
}
*/
private void doTestStep(IBuildStep step, IBuildStep oStep, boolean up){
Map inMap = new HashMap();
Map outMap = new HashMap();
Map<IBuildIOType, IBuildIOType> inMap = new HashMap<IBuildIOType, IBuildIOType>();
Map<IBuildIOType, IBuildIOType> outMap = new HashMap<IBuildIOType, IBuildIOType>();
stepsMatch(step, oStep, inMap, outMap, true);
Map map = up ? outMap : inMap;
Map<IBuildIOType, IBuildIOType> map = up ? outMap : inMap;
for(Iterator iter = map.entrySet().iterator();iter.hasNext();){
for(Iterator<?> iter = map.entrySet().iterator();iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
doTestType((IBuildIOType)entry.getKey(), (IBuildIOType)entry.getValue());
}
}
private void doTestType(IBuildIOType type, IBuildIOType oType){
Map map = new HashMap();
Map<IBuildResource, IBuildResource> map = new HashMap<IBuildResource, IBuildResource>();
typesMatch(type, oType, map, true);
@ -583,7 +585,7 @@ public class BuildDescriptionModelTests extends TestCase {
}
private void doTestResource(IBuildResource rc, IBuildResource oRc, boolean up){
Map outMap = new HashMap();
Map<IBuildIOType, IBuildIOType> outMap = new HashMap<IBuildIOType, IBuildIOType>();
doTestResourceMatch(rc, oRc, outMap);
@ -591,7 +593,7 @@ public class BuildDescriptionModelTests extends TestCase {
typesMatch(rc.getProducerIOType(), oRc.getProducerIOType(), null, true);
doTestStep(rc.getProducerIOType().getStep(), oRc.getProducerIOType().getStep(), up);
} else {
Set stepSet = new HashSet();
Set<IBuildStep> stepSet = new HashSet<IBuildStep>();
for(Iterator iter = outMap.entrySet().iterator(); iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
@ -607,7 +609,7 @@ public class BuildDescriptionModelTests extends TestCase {
}
}
private void doTestResourceMatch(IBuildResource rc, IBuildResource oRc, Map outTypeMap){
private void doTestResourceMatch(IBuildResource rc, IBuildResource oRc, Map<IBuildIOType, IBuildIOType> outTypeMap){
doTrace("matching resource " + DbgUtil.resourceName(rc));
@ -642,11 +644,11 @@ public class BuildDescriptionModelTests extends TestCase {
}
private boolean stepsMatch(IBuildStep step, IBuildStep oStep, Map inTypeMap, Map outTypeMap, boolean failOnErr){
private boolean stepsMatch(IBuildStep step, IBuildStep oStep, Map<IBuildIOType, IBuildIOType> inTypeMap, Map<IBuildIOType, IBuildIOType> outTypeMap, boolean failOnErr){
return stepsMatch(step, oStep, inTypeMap, outTypeMap, true, failOnErr);
}
private boolean stepsMatch(IBuildStep step, IBuildStep oStep, Map inTypeMap, Map outTypeMap, boolean checkSteps, boolean failOnErr){
private boolean stepsMatch(IBuildStep step, IBuildStep oStep, Map<IBuildIOType, IBuildIOType> inTypeMap, Map<IBuildIOType, IBuildIOType> outTypeMap, boolean checkSteps, boolean failOnErr){
IBuildIOType inTypes[] = step.getInputIOTypes();
IBuildIOType oInTypes[] = oStep.getInputIOTypes();
@ -709,7 +711,7 @@ public class BuildDescriptionModelTests extends TestCase {
return getCorType(type, oTypes, null, true);
}
private IBuildIOType getCorType(IBuildIOType type, IBuildIOType oTypes[], Map rcMap, boolean checkSteps){
private IBuildIOType getCorType(IBuildIOType type, IBuildIOType oTypes[], Map<IBuildResource, IBuildResource> rcMap, boolean checkSteps){
for(int i = 0; i < oTypes.length; i++){
if(typesMatch(type, oTypes[i], rcMap, checkSteps, false))
return oTypes[i];
@ -746,11 +748,11 @@ public class BuildDescriptionModelTests extends TestCase {
*/
}
private boolean typesMatch(IBuildIOType type, IBuildIOType oType, Map rcMap, boolean failOnError){
private boolean typesMatch(IBuildIOType type, IBuildIOType oType, Map<IBuildResource, IBuildResource> rcMap, boolean failOnError){
return typesMatch(type, oType, rcMap, true, failOnError);
}
private boolean typesMatch(IBuildIOType type, IBuildIOType oType, Map rcMap, boolean checkStep, boolean failOnError){
private boolean typesMatch(IBuildIOType type, IBuildIOType oType, Map<IBuildResource, IBuildResource> rcMap, boolean checkStep, boolean failOnError){
// doTrace("matching io type");
if(type.isInput() != oType.isInput()){
@ -766,8 +768,8 @@ public class BuildDescriptionModelTests extends TestCase {
return false;
if(resourcesMatch(rcs, oRcs, rcMap)){
Map inMap = new HashMap();
Map outMap = new HashMap();
Map<IBuildIOType, IBuildIOType> inMap = new HashMap<IBuildIOType, IBuildIOType>();
Map<IBuildIOType, IBuildIOType> outMap = new HashMap<IBuildIOType, IBuildIOType>();
if(!checkStep)
return true;
return stepsMatch(type.getStep(), oType.getStep(), inMap, outMap, false, failOnError);
@ -779,7 +781,7 @@ public class BuildDescriptionModelTests extends TestCase {
return false;
}
private boolean resourcesMatch(IBuildResource rcs[], IBuildResource oRcs[], Map rcMap){
private boolean resourcesMatch(IBuildResource rcs[], IBuildResource oRcs[], Map<IBuildResource, IBuildResource> rcMap){
if(rcs.length != oRcs.length)
return false;

View file

@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>

View file

@ -2,25 +2,25 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
Bundle-Version: 5.0.100.qualifier
Bundle-Version: 5.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.build.core.scannerconfig,
org.eclipse.cdt.build.internal.core.scannerconfig,
org.eclipse.cdt.build.internal.core.scannerconfig2,
org.eclipse.cdt.build.internal.core.scannerconfig;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.build.internal.core.scannerconfig2;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.managedbuilder.buildmodel,
org.eclipse.cdt.managedbuilder.buildproperties,
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,
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.managedbuilder.internal.core;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.managedbuilder.internal.envvar;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.managedbuilder.internal.macros;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.managedbuilder.macros,
org.eclipse.cdt.managedbuilder.makegen,
org.eclipse.cdt.managedbuilder.makegen.gnu,
org.eclipse.cdt.managedbuilder.makegen.internal,
org.eclipse.cdt.managedbuilder.makegen.internal;x-internal:=true;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
org.eclipse.cdt.managedbuilder.pdomdepgen,
org.eclipse.cdt.managedbuilder.projectconverter,
org.eclipse.cdt.managedbuilder.scannerconfig,
@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.cdt.make.core;visibility:=reexport
org.eclipse.cdt.make.core;visibility:=reexport,
org.eclipse.core.filesystem;bundle-version="1.2.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: com.ibm.icu.text

View file

@ -59,7 +59,7 @@ public class BuildDescriptionManager {
*/
public static final int DEPFILES = 1 << 3;
private Set fVisitedSteps = new HashSet();
private Set<IBuildStep> fVisitedSteps = new HashSet<IBuildStep>();
private boolean fUp;
private IBuildDescription fInfo;
@ -94,6 +94,9 @@ public class BuildDescriptionManager {
return DefaultBuildDescriptionFactory.getInstance().createBuildDescription(cfg, delta, flags);
}
/**
* @noreference This method is not intended to be referenced by clients.
*/
static public IBuildDescription createBuildDescription(IConfiguration cfg,
IConfigurationBuildState bs,
IResourceDelta delta,
@ -162,7 +165,7 @@ public class BuildDescriptionManager {
}
public static IBuildStep[] getSteps(IBuildStep step, boolean input){
Set set = new HashSet();
Set<IBuildStep> set = new HashSet<IBuildStep>();
IBuildIOType args[] = input ?
step.getInputIOTypes() :
@ -186,17 +189,17 @@ public class BuildDescriptionManager {
}
}
return (IBuildStep[])set.toArray(new IBuildStep[set.size()]);
return set.toArray(new IBuildStep[set.size()]);
}
public static IBuildResource[] filterGeneratedBuildResources(IBuildResource rc[], int rcState){
List list = new ArrayList();
List<IBuildResource> list = new ArrayList<IBuildResource>();
addBuildResources(rc, list, rcState);
return (IBuildResource[])list.toArray(new IBuildResource[list.size()]);
return list.toArray(new IBuildResource[list.size()]);
}
private static void addBuildResources(IBuildResource rcs[], List list, int rcState){
private static void addBuildResources(IBuildResource rcs[], List<IBuildResource> list, int rcState){
if(rcs.length == 0)
return;
IBuildStep inputAction = rcs[0].getBuildDescription().getInputStep();
@ -254,7 +257,7 @@ public class BuildDescriptionManager {
*/
public static void cleanGeneratedRebuildResources(IBuildDescription des) throws CoreException{
IBuildResource bRcs[] = filterGeneratedBuildResources(des.getResources(), REMOVED | REBUILD);
List failList = new ArrayList();
List<Object[]> failList = new ArrayList<Object[]>();
for(int i = 0; i < bRcs.length; i++){
if(!bRcs[i].isProjectResource())
@ -272,8 +275,8 @@ public class BuildDescriptionManager {
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();
for(Iterator<Object[]> iter = failList.iterator(); iter.hasNext();){
Object[] err = iter.next();
IResource rc = (IResource)err[0];
CoreException e = (CoreException)err[1];
status.add(new BuildStatus(rc.getFullPath().toString(), e));

View file

@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.buildmodel;
import java.net.URI;
import org.eclipse.core.runtime.IPath;
/**
@ -26,14 +28,20 @@ public interface IBuildResource {
IPath getLocation();
/**
* In case the resource is a workspace resource,
* returns the full workspace path for the resource
* otherwise returns null
* Returns the full path to the build resource as seen on the target machine.
*
* @return IPath
*/
IPath getFullPath();
/**
* Returns a URI that can be used by EFS to access the build resource.
*
* @return URI
* @since 5.1
*/
URI getLocationURI();
/**
* Returns the output io type of the step
* that generates this resource.

View file

@ -89,6 +89,9 @@ public interface IBuilder extends IBuildObject, IMakeBuilderInfo {
static final String DEFAULT_TARGET_CLEAN = "clean"; //$NON-NLS-1$
static final String DEFAULT_TARGET_AUTO = "all"; //$NON-NLS-1$
/**
* @since 5.1
*/
static final String ATTRIBUTE_COMMAND_LAUNCHER = "commandLauncher"; //$NON-NLS-1$
/**

View file

@ -4094,7 +4094,7 @@ public class ManagedBuildManager extends AbstractCExtension {
buildDirectory = res.getLocation();
}
} else {
buildDirectory = project.getLocation();
buildDirectory = getPathForResource(project);
if (buildDirectory != null) {
if (builder.isManagedBuildOn())
@ -4104,6 +4104,10 @@ public class ManagedBuildManager extends AbstractCExtension {
return buildDirectory;
}
private static IPath getPathForResource(IResource resource) {
return new Path(resource.getLocationURI().getPath());
}
public static IBuilder[] createBuilders(IProject project, Map args){
return ManagedBuilderCorePlugin.createBuilders(project, args);
}

View file

@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -67,6 +69,8 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
import org.eclipse.cdt.managedbuilder.pdomdepgen.PDOMDependencyGenerator;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -1003,9 +1007,14 @@ public class BuildDescription implements IBuildDescription {
}
private IPath getTopBuildDirLocation(){
return fProject.getLocation().append(getTopBuildDirFullPath().removeFirstSegments(1));
IPath projLocation = getProjectLocation();
return projLocation.append(getTopBuildDirFullPath().removeFirstSegments(1));
}
private IPath getProjectLocation() {
return new Path(fProject.getLocationURI().getPath());
}
private BuildResource[] addOutputs(IPath paths[], BuildIOType buildArg, IPath outDirPath){
if(paths != null){
List list = new ArrayList();
@ -1016,21 +1025,24 @@ public class BuildDescription implements IBuildDescription {
if(outFullPath.isAbsolute()){
outLocation = outFullPath;
if(fProject.getLocation().isPrefixOf(outLocation))
outFullPath = fProject.getFullPath().append(outLocation.removeFirstSegments(fProject.getLocation().segmentCount()));
IPath projLocation = new Path(fProject.getLocationURI().getPath());
if(projLocation.isPrefixOf(outLocation))
outFullPath = projLocation.append(outLocation.removeFirstSegments(projLocation.segmentCount()));
else
outFullPath = null;
} else {
if (outFullPath.segmentCount() == 1) {
outFullPath = outDirPath.append(outFullPath);
outLocation = fProject.getLocation().append(outFullPath.removeFirstSegments(1));
outLocation = getProjectLocation().append(outFullPath.removeFirstSegments(1));
} else {
outLocation = getTopBuildDirLocation().append(outFullPath);
outFullPath = getTopBuildDirFullPath().append(outFullPath);
}
}
BuildResource outRc = createResource(outLocation, outFullPath);
BuildResource outRc = createResource(outLocation, getURIForFullPath(outFullPath));
list.add(outRc);
buildArg.addResource(outRc);
@ -1040,6 +1052,24 @@ public class BuildDescription implements IBuildDescription {
return null;
}
private URI getURIForFullPath(IPath fullPath) {
// Basically, assume that we use the same type of URI that the project uses.
// Create one using the same info, except point the path at the path provided.
URI projURI = fProject.getLocationURI();
try {
URI newURI = new URI(projURI.getScheme(), projURI.getUserInfo(),
projURI.getHost(), projURI.getPort(), fullPath
.toPortableString(), projURI.getQuery(), projURI
.getFragment());
return newURI;
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
private void calculateOutputs(BuildStep action, BuildIOType arg, BuildResource buildRc) throws CoreException {
BuildResource rcs[] = null;
ITool tool = action.getTool();
@ -1344,11 +1374,11 @@ public class BuildDescription implements IBuildDescription {
String outExt = tool.getOutputExtension(inExt);
outFullPath = resolvePercent(outFullPath.addFileExtension(outExt), buildRc.getLocation());
outLocation = fProject.getLocation().append(outFullPath.removeFirstSegments(1));
outLocation = getProjectLocation().append(outFullPath.removeFirstSegments(1));
BuildIOType buildArg = action.createIOType(false, true, null);
BuildResource outRc = createResource(outLocation, outFullPath);
BuildResource outRc = createResource(outLocation, getURIForFullPath(outFullPath));
buildArg.addResource(outRc);
}
@ -1432,8 +1462,8 @@ public class BuildDescription implements IBuildDescription {
private IPath locationToRel(IPath location){
if(fProject.getLocation().isPrefixOf(location))
return location.removeFirstSegments(fProject.getLocation().segmentCount()).setDevice(null);
if(getProjectLocation().isPrefixOf(location))
return location.removeFirstSegments(getProjectLocation().segmentCount()).setDevice(null);
//TODO
return location;
}
@ -1897,8 +1927,8 @@ public class BuildDescription implements IBuildDescription {
}
if(inFullPath == null && files.length > 0)
inFullPath = files[0].getFullPath();
if(inFullPath == null && fProject.getLocation().isPrefixOf(inLocation)){
inFullPath = fProject.getFullPath().append(inLocation.removeFirstSegments(fProject.getLocation().segmentCount()));
if(inFullPath == null && getProjectLocation().isPrefixOf(inLocation)){
inFullPath = fProject.getFullPath().append(inLocation.removeFirstSegments(getProjectLocation().segmentCount()));
}
} else {
IPath projPath = inFullPath;
@ -1906,14 +1936,9 @@ public class BuildDescription implements IBuildDescription {
IResource res = ResourcesPlugin.getWorkspace().getRoot().getFile(inFullPath);//.findMember(inFullPath);
inLocation = calcResourceLocation(res);
/* if(res != null)
inLocation = res.getLocation();
else
inLocation = fProject.getLocation().append(projPath);
*/
}
BuildResource rc = createResource(inLocation, inFullPath);
BuildResource rc = createResource(inLocation, getURIForFullPath(inFullPath));
buildArg.addResource(rc);
return rc;
@ -1929,19 +1954,36 @@ public class BuildDescription implements IBuildDescription {
}
public BuildResource createResource(IPath projPath){
return createResource(fProject.getLocation().append(projPath),fProject.getFullPath().append(projPath));
return createResource(projPath, createProjectRelativeURI(projPath));
}
public BuildResource createResource(IResource rc){
return createResource(calcResourceLocation(rc), rc.getFullPath());
private URI createProjectRelativeURI(IPath projPath) {
URI projURI = fProject.getLocationURI();
IFileStore projStore = null;
try {
projStore = EFS.getStore(projURI);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(projStore == null)
return null;
IFileStore childStore = projStore.getFileStore(projPath);
return childStore.toURI();
}
public BuildResource createResource(IPath location, IPath fullPath){
public BuildResource createResource(IResource rc){
return createResource(calcResourceLocation(rc), rc.getLocationURI());
}
public BuildResource createResource(IPath projPath, URI locationURI){
BuildResource rc = (BuildResource)getBuildResource(location);
BuildResource rc = (BuildResource)getBuildResource(projPath);
if(rc == null)
rc = new BuildResource(this, location, fullPath);
rc = new BuildResource(this, projPath, locationURI);
return rc;
}

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@ -22,32 +23,38 @@ import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public class BuildResource implements IBuildResource {
private List fDepArgs = new ArrayList();
private List<BuildIOType> fDepArgs = new ArrayList<BuildIOType>();
private BuildIOType fProducerArg;
private boolean fNeedsRebuild;
private boolean fIsRemoved;
private IPath fLocation;
private IPath fFullPath;
private boolean fIsProjectRc;
private BuildDescription fInfo;
private URI fLocationURI;
protected BuildResource(BuildDescription info, IResource rc){
this(info, info.calcResourceLocation(rc), rc.getFullPath());
this(info, info.calcResourceLocation(rc), rc.getLocationURI());
}
protected BuildResource(BuildDescription info, IPath location, IPath fullPath){
fLocation = location;
protected BuildResource(BuildDescription info, IPath projectPath, URI locationURI){
if(locationURI == null)
throw new IllegalArgumentException(); // must point to somewhere!
fLocationURI = locationURI;
fLocation = projectPath;
fInfo = info;
fFullPath = fullPath;
if(fFullPath != null)
fIsProjectRc = fFullPath.segment(0).equals(info.getProject().getName());
fIsProjectRc = (projectPath != null);
info.resourceCreated(this);
if(DbgUtil.DEBUG)
DbgUtil.trace("resource " + location + " created"); //$NON-NLS-1$ //$NON-NLS-2$
DbgUtil.trace("resource " + projectPath + " created"); //$NON-NLS-1$ //$NON-NLS-2$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getLocation()
@ -60,7 +67,7 @@ public class BuildResource implements IBuildResource {
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getFullPath()
*/
public IPath getFullPath() {
return fFullPath;
return new Path(fLocationURI.getPath());
}
/* (non-Javadoc)
@ -74,7 +81,7 @@ public class BuildResource implements IBuildResource {
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getDependentIOTypes()
*/
public IBuildIOType[] getDependentIOTypes() {
return (BuildIOType[])fDepArgs.toArray(new BuildIOType[fDepArgs.size()]);
return fDepArgs.toArray(new BuildIOType[fDepArgs.size()]);
}
/* (non-Javadoc)
@ -183,11 +190,11 @@ public class BuildResource implements IBuildResource {
}
public IBuildStep[] getDependentSteps() {
Set set = new HashSet();
for(Iterator iter = fDepArgs.iterator(); iter.hasNext();){
set.add(((BuildIOType)iter.next()).getStep());
Set<IBuildStep> set = new HashSet<IBuildStep>();
for(Iterator<BuildIOType> iter = fDepArgs.iterator(); iter.hasNext();){
set.add(iter.next().getStep());
}
return (BuildStep[])set.toArray(new BuildStep[set.size()]);
return set.toArray(new BuildStep[set.size()]);
}
public IBuildStep getProducerStep() {
@ -208,4 +215,11 @@ public class BuildResource implements IBuildResource {
return buf.toString();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource#getLocationURI()
*/
public URI getLocationURI() {
return fLocationURI;
}
}

View file

@ -13,6 +13,7 @@
package org.eclipse.cdt.managedbuilder.makegen.gnu;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -70,6 +71,8 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@ -2012,7 +2015,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// if( (rcInfo.isExcluded()) )
// continue;
addFragmentMakefileEntriesForSource(buildVarToRuleStringMap, ruleBuffer,
folder, relativePath, resource, resource.getLocation(), rcInfo, null, false);
folder, relativePath, resource, getPathForResource(resource), rcInfo, null, false);
}
}
@ -2159,7 +2162,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// because the file is not under the project. We use this resource in the calls to the dependency generator
generateOutputResource = project.getFile(generatedOutput);
} else {
generatedOutput = project.getLocation().append(getBuildWorkingDir()).append((IPath)generatedOutputs.get(k));
generatedOutput = getPathForResource(project).append(getBuildWorkingDir()).append((IPath)generatedOutputs.get(k));
generateOutputResource = project.getFile(getBuildWorkingDir().append((IPath)generatedOutputs.get(k)));
}
IResourceInfo nextRcInfo;
@ -2194,6 +2197,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
}
}
/**
* Gets a path for a resource by extracting the Path field from its
* location URI.
* @return IPath
* @since 5.1
*/
protected IPath getPathForResource(IResource resource) {
return new Path(resource.getLocationURI().getPath());
}
/* (non-Javadoc)
* Adds the source file to the appropriate build variable
*
@ -2415,12 +2429,31 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* then we must get the actual location of the resource, rather
* than the relative path.
*/
String projectLocation = project.getLocation().toString();
String projectLocation = null;
// is the project local? if so we might have to convert the paths to local format
try {
IFileStore fileStore = EFS.getStore(project.getLocationURI());
File localFile = fileStore.toLocalFile(EFS.NONE, null);
if(localFile != null) {
// it's a local file... use project location for proper path formatting
projectLocation = project.getLocation().addTrailingSeparator().toOSString();
}
else {
// remote... get the path from the URI
projectLocation = project.getLocationURI().getPath().toString();
}
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Output file location needed for the file-specific build macros
IPath outputLocation = Path.fromOSString(primaryOutputName);
if (!outputLocation.isAbsolute()) {
outputLocation = project.getLocation().append(getBuildWorkingDir()).append(primaryOutputName);
outputLocation = getPathForResource(project).append(getBuildWorkingDir()).append(primaryOutputName);
}
// A separate rule is needed for the resource in the case where explicit file-specific macros
@ -2644,7 +2677,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
IPath addlPath = addlInputPaths[i];
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
if (!addlPath.isAbsolute()) {
IPath tempPath = project.getLocation().append(addlPath);
IPath tempPath = getPathForResource(project).append(addlPath);
if (tempPath != null) {
addlPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), tempPath);
}
@ -3854,7 +3887,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
String relativePath, IPath sourceLocation, boolean generatedSource) {
// Add the source file path to the makefile line that adds source files to the build variable
String srcName;
IPath projectLocation = project.getLocation();
IPath projectLocation = getPathForResource(project);
IPath dirLocation = projectLocation;
if (generatedSource) {
dirLocation = dirLocation.append(getBuildWorkingDir());
@ -4618,7 +4651,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* Return the configuration's top build directory as an absolute path
*/
public IPath getTopBuildDir() {
return project.getLocation().append(getBuildWorkingDir());
return getPathForResource(project).append(getBuildWorkingDir());
}
/**

View file

@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>

View file

@ -9,7 +9,7 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.managedbuilder.gnu.cygwin,
org.eclipse.cdt.managedbuilder.gnu.ui
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[5.0.0,6.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[5.1.0,6.0.0)",
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
org.eclipse.core.resources
Bundle-ActivationPolicy: lazy

View file

@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>

View file

@ -8,6 +8,7 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.managedbuilder.internal.ui.workingsets,
org.eclipse.cdt.managedbuilder.ui.actions,
org.eclipse.cdt.managedbuilder.ui.preferences,
org.eclipse.cdt.managedbuilder.ui.properties,
org.eclipse.cdt.managedbuilder.ui.wizards
Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
@ -15,7 +16,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[5.0.0,6.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[5.1.0,6.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,

View file

@ -30,6 +30,9 @@ public abstract class AbstractToolSettingUI extends FieldEditorPreferencePage {
this(info, GRID);
}
/**
* @since 5.0
*/
protected AbstractToolSettingUI(IResourceInfo info, int style) {
super(style);
noDefaultAndApplyButton();

View file

@ -449,10 +449,16 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
}
}
/**
* @since 5.0
*/
protected void addFilter(ViewerFilter filter) {
optionList.addFilter(filter);
}
/**
* @since 5.0
*/
@SuppressWarnings("unchecked")
protected void setOption(IOption op1, IOption op2, IHoldsOptions dst, IResourceInfo res){
try {
@ -601,6 +607,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
* Unlike the default provider, that provider also contains
* the user-modified macros that are not applied yet
* If the "Build Macros" tab is not available, returns the default BuildMacroProvider
* @noreference This method is not intended to be referenced by clients.
*/
public BuildMacroProvider obtainMacroProvider(){
return (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();

View file

@ -208,6 +208,11 @@ implements IExecutableExtension, IWizardWithMemory
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
ICProjectDescription des = mngr.getProjectDescription(newProject, false);
if(des == null ) {
return false;
}
if(des.isCdtProjectCreating()){
des = mngr.getProjectDescription(newProject, true);
des.setCdtProjectCreated();

View file

@ -133,6 +133,20 @@
natureFilter="cnature"
outputFlag="-o"
superClass="org.eclipse.cdt.managedbuilder.xlc.ui.tool.abstractCompiler">
<inputType
dependencyContentType="org.eclipse.cdt.core.cHeader"
dependencyExtensions="h"
id="cdt.managedbuild.tool.xlc.c.compiler.input"
primaryInput="true"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"
sourceContentType="org.eclipse.cdt.core.cSource"
sources="c">
</inputType>
<outputType
outputs="o"
buildVariable="OBJS"
id="cdt.managedbuild.tool.xlc.c.compiler.output">
</outputType>
<option
name="%Option.Cstdinc"
category="xlc.c.compiler.category.Input"
@ -240,13 +254,19 @@
outputFlag="-o"
superClass="org.eclipse.cdt.managedbuilder.xlc.ui.tool.abstractCompiler">
<inputType
dependencyContentType="org.eclipse.cdt.core.cxxHeader"
dependencyExtensions="h,H,hpp"
id="cdt.managedbuild.tool.xlc.cpp.compiler.input"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP"
sourceContentType="org.eclipse.cdt.core.cxxSource"
sources="c,C,cc,cxx,cpp">
dependencyContentType="org.eclipse.cdt.core.cxxHeader"
dependencyExtensions="h,H,hpp"
id="cdt.managedbuild.tool.xlc.cpp.compiler.input"
primaryInput="true"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP"
sourceContentType="org.eclipse.cdt.core.cxxSource"
sources="c,C,cc,cxx,cpp">
</inputType>
<outputType
buildVariable="OBJS"
id="org.eclipse.cdt.managedbuilder.xlc.cpp.compiler.output"
outputs="o">
</outputType>
<option
category="xlc.c.compiler.category.Input"
command="-+"
@ -2989,21 +3009,6 @@
name="%Option.optdebug"
valueType="boolean">
</option>
<inputType
dependencyContentType="org.eclipse.cdt.core.cHeader"
dependencyExtensions="h"
id="cdt.managedbuild.tool.xlc.c.compiler.input"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"
sourceContentType="org.eclipse.cdt.core.cSource"
sources="c">
</inputType>
<outputType
outputs="o"
buildVariable="OBJS"
id="cdt.managedbuild.tool.xlc.c.compiler.output">
</outputType>
<option
applicabilityCalculator="org.eclipse.cdt.managedbuilder.xlc.ui.properties.XLCApplicabilityCalculator"
category="xlc.c.compiler.category.output"