diff options
author | Chris Recoskie | 2009-04-28 12:02:33 +0000 |
---|---|---|
committer | Chris Recoskie | 2009-04-28 12:02:33 +0000 |
commit | 09f3368f3ea11bb2f0b9202e57b248cfe3fe5e91 (patch) | |
tree | 87886ecf90506ea1c461ec86ec82bb3b6da74386 /build/org.eclipse.cdt.managedbuilder.core | |
parent | 1e31821df493d0cf7727febf0e58858c0ec43b74 (diff) | |
download | org.eclipse.cdt-09f3368f3ea11bb2f0b9202e57b248cfe3fe5e91.tar.gz org.eclipse.cdt-09f3368f3ea11bb2f0b9202e57b248cfe3fe5e91.tar.xz org.eclipse.cdt-09f3368f3ea11bb2f0b9202e57b248cfe3fe5e91.zip |
RESOLVED - bug 273636: changes to enable MBS on EFS projects
https://bugs.eclipse.org/bugs/show_bug.cgi?id=273636
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core')
9 files changed, 181 insertions, 67 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/.project b/build/org.eclipse.cdt.managedbuilder.core/.project index d7e94687d3b..cab798d8b70 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/.project +++ b/build/org.eclipse.cdt.managedbuilder.core/.project @@ -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> diff --git a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF index 79d3d7dde1d..f7d9855579e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF +++ b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF @@ -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 diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java index 36c876943d9..d8add31d574 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java @@ -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)); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/IBuildResource.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/IBuildResource.java index 6b727b35bc3..6a51d5b9f53 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/IBuildResource.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/IBuildResource.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.managedbuilder.buildmodel; +import java.net.URI; + import org.eclipse.core.runtime.IPath; /** @@ -26,15 +28,21 @@ 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. * In case the resource is the project source, diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java index ed41005f1ee..61c457a9d05 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java @@ -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$ /** diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 0a0106663df..0085146e4f0 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -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); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java index e9ae89ec102..736b365bfea 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java @@ -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)); } + 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(IResource rc){ - return createResource(calcResourceLocation(rc), rc.getFullPath()); + return createResource(calcResourceLocation(rc), rc.getLocationURI()); } - public BuildResource createResource(IPath location, IPath fullPath){ + 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; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java index bd5e360f831..57ed9b47575 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java @@ -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; + } + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java index 4d016f83046..3882725fa0a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java @@ -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()); } /** |