mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix for 275137 (Internal builder claims nothing needs to be built)
This commit is contained in:
parent
fe1cb2e90f
commit
a3767b2d5c
4 changed files with 73 additions and 32 deletions
|
@ -21,14 +21,16 @@ import org.eclipse.core.runtime.IPath;
|
||||||
*/
|
*/
|
||||||
public interface IBuildResource {
|
public interface IBuildResource {
|
||||||
/**
|
/**
|
||||||
* Returns the resource location
|
* Returns the absolute path to the resource as seen on the target machine.
|
||||||
*
|
*
|
||||||
* @return IPath
|
* @return IPath
|
||||||
*/
|
*/
|
||||||
IPath getLocation();
|
IPath getLocation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the full path to the build resource as seen on the target machine.
|
* In case the resource is a workspace resource,
|
||||||
|
* returns the full workspace path for the resource
|
||||||
|
* otherwise returns null
|
||||||
*
|
*
|
||||||
* @return IPath
|
* @return IPath
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -71,6 +71,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.pdomdepgen.PDOMDependencyGenerator;
|
import org.eclipse.cdt.managedbuilder.pdomdepgen.PDOMDependencyGenerator;
|
||||||
import org.eclipse.core.filesystem.EFS;
|
import org.eclipse.core.filesystem.EFS;
|
||||||
import org.eclipse.core.filesystem.IFileStore;
|
import org.eclipse.core.filesystem.IFileStore;
|
||||||
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -254,6 +255,8 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IPath calcResourceLocation(IResource rc){
|
protected IPath calcResourceLocation(IResource rc){
|
||||||
|
|
||||||
|
//return rc.getFullPath();
|
||||||
IPath rcLocation = rc.getLocation();
|
IPath rcLocation = rc.getLocation();
|
||||||
if(rcLocation == null){
|
if(rcLocation == null){
|
||||||
IPath fullPath = rc.getFullPath();
|
IPath fullPath = rc.getFullPath();
|
||||||
|
@ -1020,29 +1023,42 @@ public class BuildDescription implements IBuildDescription {
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
for(int k = 0; k < paths.length; k++){
|
for(int k = 0; k < paths.length; k++){
|
||||||
IPath outFullPath = paths[k];
|
IPath outFullPath = paths[k];
|
||||||
IPath outLocation;
|
IPath outWorkspacePath = paths[k];
|
||||||
|
IPath outProjPath;
|
||||||
|
|
||||||
if(outFullPath.isAbsolute()){
|
|
||||||
outLocation = outFullPath;
|
|
||||||
|
|
||||||
IPath projLocation = new Path(fProject.getLocationURI().getPath());
|
IPath projLocation = new Path(fProject.getLocationURI().getPath());
|
||||||
|
|
||||||
if(projLocation.isPrefixOf(outLocation))
|
if(outFullPath.isAbsolute()){
|
||||||
outFullPath = projLocation.append(outLocation.removeFirstSegments(projLocation.segmentCount()));
|
outProjPath = outFullPath;
|
||||||
else
|
|
||||||
outFullPath = null;
|
if(projLocation.isPrefixOf(outProjPath)) {
|
||||||
|
// absolute location really points to same place the project lives, so it IS a project file
|
||||||
|
outProjPath = outProjPath.removeFirstSegments(projLocation.segmentCount());
|
||||||
|
outFullPath = projLocation.append(outProjPath.removeFirstSegments(projLocation.segmentCount()));
|
||||||
|
outWorkspacePath = fProject.getFullPath().append(outProjPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// absolute path to somewhere outside the workspace
|
||||||
|
outProjPath = null;
|
||||||
|
outWorkspacePath = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (outFullPath.segmentCount() == 1) {
|
if (outFullPath.segmentCount() == 1) {
|
||||||
outFullPath = outDirPath.append(outFullPath);
|
outFullPath = projLocation.append(outDirPath.removeFirstSegments(1).append(outFullPath));
|
||||||
outLocation = getProjectLocation().append(outFullPath.removeFirstSegments(1));
|
outProjPath = outDirPath.removeFirstSegments(1).append(outWorkspacePath);
|
||||||
|
outWorkspacePath = fProject.getFullPath().append(outProjPath);
|
||||||
} else {
|
} else {
|
||||||
outLocation = getTopBuildDirLocation().append(outFullPath);
|
outProjPath = fProject.getFullPath().removeFirstSegments(1).append(outDirPath.removeFirstSegments(1).append(outWorkspacePath));
|
||||||
outFullPath = getTopBuildDirFullPath().append(outFullPath);
|
|
||||||
|
if(outDirPath.isPrefixOf(outFullPath)) {
|
||||||
|
outFullPath.removeFirstSegments(outDirPath.segmentCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
outFullPath = projLocation.append(outDirPath.removeFirstSegments(1).append(outFullPath.lastSegment()));
|
||||||
|
outWorkspacePath = fProject.getFullPath().append(outProjPath);;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildResource outRc = createResource(outLocation, getURIForFullPath(outFullPath));
|
BuildResource outRc = createResource(outWorkspacePath, getURIForFullPath(outFullPath));
|
||||||
list.add(outRc);
|
list.add(outRc);
|
||||||
buildArg.addResource(outRc);
|
buildArg.addResource(outRc);
|
||||||
|
|
||||||
|
@ -1056,10 +1072,22 @@ public class BuildDescription implements IBuildDescription {
|
||||||
// Basically, assume that we use the same type of URI that the project uses.
|
// 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.
|
// Create one using the same info, except point the path at the path provided.
|
||||||
URI projURI = fProject.getLocationURI();
|
URI projURI = fProject.getLocationURI();
|
||||||
|
|
||||||
|
try {
|
||||||
|
IFileStore projStore = EFS.getStore(projURI);
|
||||||
|
|
||||||
|
if(projStore.toLocalFile(EFS.NONE, null) != null) {
|
||||||
|
// local file
|
||||||
|
return URIUtil.toURI(fullPath);
|
||||||
|
}
|
||||||
|
} catch (CoreException e1) {
|
||||||
|
ManagedBuilderCorePlugin.log(e1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URI newURI = new URI(projURI.getScheme(), projURI.getUserInfo(),
|
URI newURI = new URI(projURI.getScheme(), projURI.getUserInfo(),
|
||||||
projURI.getHost(), projURI.getPort(), fullPath
|
projURI.getHost(), projURI.getPort(), fullPath.toString(), projURI.getQuery(), projURI
|
||||||
.toPortableString(), projURI.getQuery(), projURI
|
|
||||||
.getFragment());
|
.getFragment());
|
||||||
return newURI;
|
return newURI;
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
|
@ -1938,7 +1966,8 @@ public class BuildDescription implements IBuildDescription {
|
||||||
inLocation = calcResourceLocation(res);
|
inLocation = calcResourceLocation(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildResource rc = createResource(inLocation, getURIForFullPath(inFullPath));
|
|
||||||
|
BuildResource rc = createResource(inFullPath, getURIForFullPath(inLocation));
|
||||||
buildArg.addResource(rc);
|
buildArg.addResource(rc);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -1975,15 +2004,15 @@ public class BuildDescription implements IBuildDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildResource createResource(IResource rc){
|
public BuildResource createResource(IResource rc){
|
||||||
return createResource(calcResourceLocation(rc), rc.getLocationURI());
|
return createResource(rc.getFullPath(), rc.getLocationURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildResource createResource(IPath projPath, URI locationURI){
|
public BuildResource createResource(IPath fullWorkspacePath, URI locationURI){
|
||||||
|
|
||||||
BuildResource rc = (BuildResource)getBuildResource(projPath);
|
BuildResource rc = (BuildResource)getBuildResource(fullWorkspacePath);
|
||||||
|
|
||||||
if(rc == null)
|
if(rc == null)
|
||||||
rc = new BuildResource(this, projPath, locationURI);
|
rc = new BuildResource(this, fullWorkspacePath, locationURI);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
||||||
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.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ public class BuildResource implements IBuildResource {
|
||||||
private BuildIOType fProducerArg;
|
private BuildIOType fProducerArg;
|
||||||
private boolean fNeedsRebuild;
|
private boolean fNeedsRebuild;
|
||||||
private boolean fIsRemoved;
|
private boolean fIsRemoved;
|
||||||
private IPath fLocation;
|
private IPath fFullWorkspacePath;
|
||||||
private boolean fIsProjectRc;
|
private boolean fIsProjectRc;
|
||||||
private BuildDescription fInfo;
|
private BuildDescription fInfo;
|
||||||
private URI fLocationURI;
|
private URI fLocationURI;
|
||||||
|
@ -39,35 +40,44 @@ public class BuildResource implements IBuildResource {
|
||||||
this(info, info.calcResourceLocation(rc), rc.getLocationURI());
|
this(info, info.calcResourceLocation(rc), rc.getLocationURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BuildResource(BuildDescription info, IPath projectPath, URI locationURI){
|
protected BuildResource(BuildDescription info, IPath fullWorkspacePath, URI locationURI){
|
||||||
|
|
||||||
if(locationURI == null)
|
if(locationURI == null)
|
||||||
throw new IllegalArgumentException(); // must point to somewhere!
|
throw new IllegalArgumentException(); // must point to somewhere!
|
||||||
|
|
||||||
fLocationURI = locationURI;
|
fLocationURI = locationURI;
|
||||||
|
|
||||||
fLocation = projectPath;
|
fFullWorkspacePath = fullWorkspacePath;
|
||||||
fInfo = info;
|
fInfo = info;
|
||||||
|
|
||||||
fIsProjectRc = (projectPath != null);
|
fIsProjectRc = (fullWorkspacePath != null);
|
||||||
|
|
||||||
info.resourceCreated(this);
|
info.resourceCreated(this);
|
||||||
|
|
||||||
if(DbgUtil.DEBUG)
|
if(DbgUtil.DEBUG)
|
||||||
DbgUtil.trace("resource " + projectPath + " created"); //$NON-NLS-1$ //$NON-NLS-2$
|
DbgUtil.trace("resource " + fullWorkspacePath + " created"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getLocation()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getLocation()
|
||||||
*/
|
*/
|
||||||
public IPath getLocation() {
|
public IPath getLocation() {
|
||||||
return fLocation;
|
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(fFullWorkspacePath);
|
||||||
|
if(resource == null) {
|
||||||
|
return new Path(fLocationURI.getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resource.getLocation() != null)
|
||||||
|
return resource.getLocation();
|
||||||
|
else
|
||||||
|
return new Path(fLocationURI.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getFullPath()
|
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getFullPath()
|
||||||
*/
|
*/
|
||||||
public IPath getFullPath() {
|
public IPath getFullPath() {
|
||||||
return new Path(fLocationURI.getPath());
|
return fFullWorkspacePath;
|
||||||
|
//return new Path(getLocationURI().getPath().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -2438,7 +2438,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
||||||
|
|
||||||
if(localFile != null) {
|
if(localFile != null) {
|
||||||
// it's a local file... use project location for proper path formatting
|
// it's a local file... use project location for proper path formatting
|
||||||
projectLocation = project.getLocation().addTrailingSeparator().toOSString();
|
projectLocation = project.getLocation().addTrailingSeparator().toString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// remote... get the path from the URI
|
// remote... get the path from the URI
|
||||||
|
|
Loading…
Add table
Reference in a new issue