mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
fix for 137674
This commit is contained in:
parent
9174d8ce58
commit
d849fab5d1
10 changed files with 262 additions and 29 deletions
|
@ -1218,30 +1218,46 @@ public class BuildDescription implements IBuildDescription {
|
|||
if(ext == null)
|
||||
ext = buildRc.getLocation().getFileExtension();
|
||||
|
||||
if(ext != null){
|
||||
IManagedDependencyGeneratorType depGenType = tool.getDependencyGeneratorForExtension(ext);
|
||||
if(depGenType != null){
|
||||
if (ext != null) {
|
||||
IManagedDependencyGeneratorType depGenType = tool
|
||||
.getDependencyGeneratorForExtension(ext);
|
||||
if (depGenType != null) {
|
||||
IPath depFiles[] = null;
|
||||
if(depGenType instanceof IManagedDependencyGenerator2){
|
||||
if (depGenType instanceof IManagedDependencyGenerator2) {
|
||||
IBuildObject context = tool.getParent();
|
||||
if(context instanceof IToolChain){
|
||||
context = ((IToolChain)context).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();
|
||||
IPath path = buildRc.isProjectResource() ? buildRc
|
||||
.getFullPath().removeFirstSegments(1)
|
||||
: buildRc.getLocation();
|
||||
|
||||
IResource resource = buildRc.isProjectResource() ? fProject
|
||||
.findMember(buildRc.getLocation())
|
||||
: null;
|
||||
|
||||
IManagedDependencyInfo info = ((IManagedDependencyGenerator2) depGenType)
|
||||
.getDependencySourceInfo(path, resource,
|
||||
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$
|
||||
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);
|
||||
|
||||
if (depFiles != null) {
|
||||
BuildIOType depType = action.createIOType(false,
|
||||
false, null);
|
||||
addOutputs(depFiles, depType, outDirPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.makegen;
|
|||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
|
||||
|
@ -58,6 +59,32 @@ public interface IManagedDependencyGenerator2 extends IManagedDependencyGenerato
|
|||
*
|
||||
* @param source The source file for which dependencies should be calculated
|
||||
* The IPath can be either relative to the project directory, or absolute in the file system.
|
||||
* @param resource The IResource corresponding to the source file, or null if the file
|
||||
* is not a workspace resource.
|
||||
* @param buildContext The IConfiguration or IResourceConfiguration that
|
||||
* contains the context in which the source file will be built
|
||||
* @param tool The tool associated with the source file
|
||||
* @param topBuildDirectory The top build directory of the configuration. This is
|
||||
* the working directory for the tool. This IPath is relative to the project directory.
|
||||
* @return IManagedDependencyInfo
|
||||
*/
|
||||
public IManagedDependencyInfo getDependencySourceInfo(
|
||||
IPath source,
|
||||
IResource resource,
|
||||
IBuildObject buildContext,
|
||||
ITool tool,
|
||||
IPath topBuildDirectory);
|
||||
|
||||
/**
|
||||
* Returns an instance of IManagedDependencyInfo for this source file.
|
||||
* IManagedDependencyCalculator, IManagedDependencyCommands
|
||||
* and IManagedDependencyPreBuild are all derived from
|
||||
* IManagedDependencyInfo, and any one of the three can be returned.
|
||||
* This is called when getCalculatorType returns TYPE_BUILD_COMMANDS,
|
||||
* TYPE_CUSTOM or TYPE_PREBUILD_COMMANDS.
|
||||
*
|
||||
* @param source The source file for which dependencies should be calculated
|
||||
* The IPath can be either relative to the project directory, or absolute in the file system.
|
||||
* @param buildContext The IConfiguration or IResourceConfiguration that
|
||||
* contains the context in which the source file will be built
|
||||
* @param tool The tool associated with the source file
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
|
@ -54,6 +55,13 @@ public class DefaultGCCDependencyCalculator2 implements
|
|||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
return new DefaultGCCDependencyCalculator2Commands(source, resource, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
return new DefaultGCCDependencyCalculator2Commands(source, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.resources.IProject;;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
/**
|
||||
* This dependency calculator uses the GCC -MMD -MF -MP -MT options in order to
|
||||
|
@ -39,6 +40,7 @@ public class DefaultGCCDependencyCalculator2Commands implements
|
|||
|
||||
// Member variables set by the constructor
|
||||
IPath source;
|
||||
IResource resource;
|
||||
IBuildObject buildContext;
|
||||
ITool tool;
|
||||
IPath topBuildDirectory;
|
||||
|
@ -55,14 +57,16 @@ public class DefaultGCCDependencyCalculator2Commands implements
|
|||
*
|
||||
* @param source The source file for which dependencies should be calculated
|
||||
* The IPath can be either relative to the project directory, or absolute in the file system.
|
||||
* @param resource The IResource corresponding to the source file.
|
||||
* @param buildContext The IConfiguration or IResourceConfiguration that
|
||||
* contains the context in which the source file will be built
|
||||
* @param tool The tool associated with the source file
|
||||
* @param topBuildDirectory The top build directory of the configuration. This is
|
||||
* the working directory for the tool. This IPath is relative to the project directory.
|
||||
*/
|
||||
public DefaultGCCDependencyCalculator2Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
public DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
this.source = source;
|
||||
this.resource = resource;
|
||||
this.buildContext = buildContext;
|
||||
this.tool = tool;
|
||||
this.topBuildDirectory = topBuildDirectory;
|
||||
|
@ -81,7 +85,24 @@ public class DefaultGCCDependencyCalculator2Commands implements
|
|||
|
||||
// A separate rule is needed for the resource in the case where explicit file-specific macros
|
||||
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
|
||||
needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
|
||||
|
||||
/* fix for 137674
|
||||
*
|
||||
* We only need an explicit rule if one of the following is true:
|
||||
* - The resource is linked, and its full path to its real location contains special characters
|
||||
* - The resource is not linked, but its project relative path contains special characters
|
||||
*/
|
||||
boolean resourceNameRequiresExplicitRule = true;
|
||||
|
||||
if(resource != null)
|
||||
{
|
||||
resourceNameRequiresExplicitRule = (resource.isLinked() && GnuMakefileGenerator
|
||||
.containsSpecialCharacters(sourceLocation.toString()))
|
||||
|| (!resource.isLinked() && GnuMakefileGenerator
|
||||
.containsSpecialCharacters(resource.getProjectRelativePath().toString()));
|
||||
}
|
||||
|
||||
needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
|
||||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|
||||
|| MacroResolver.getReferencedExplitFileMacros(
|
||||
tool.getToolCommand(),
|
||||
|
@ -91,6 +112,36 @@ public class DefaultGCCDependencyCalculator2Commands implements
|
|||
|
||||
if (needExplicitRuleForFile) genericCommands = new Boolean(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. This constructor calls
|
||||
* DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource,
|
||||
* IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a
|
||||
* null resource. The net result of this is that dependency rules will
|
||||
* always be explicit and will never use pattern rules, as it is impossible
|
||||
* for the calculator to know whether the resource is linked or not.
|
||||
*
|
||||
* @param source
|
||||
* The source file for which dependencies should be calculated
|
||||
* The IPath can be either relative to the project directory, or
|
||||
* absolute in the file system.
|
||||
* @param buildContext
|
||||
* The IConfiguration or IResourceConfiguration that contains the
|
||||
* context in which the source file will be built
|
||||
* @param tool
|
||||
* The tool associated with the source file
|
||||
* @param topBuildDirectory
|
||||
* The top build directory of the configuration. This is the
|
||||
* working directory for the tool. This IPath is relative to the
|
||||
* project directory.
|
||||
*
|
||||
* @see DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
|
||||
*/
|
||||
public DefaultGCCDependencyCalculator2Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
|
||||
{
|
||||
this(source, (IResource) null, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -61,8 +62,14 @@ public class DefaultGCCDependencyCalculator3 implements
|
|||
return IManagedBuilderMakefileGenerator.DEP_EXT;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.core.resources.IResource, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
return new DefaultGCCDependencyCalculator3Commands(source, resource, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.resources.IProject;;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
/**
|
||||
* This dependency calculator uses the same dependency management technique as the
|
||||
|
@ -50,6 +51,7 @@ public class DefaultGCCDependencyCalculator3Commands implements
|
|||
|
||||
// Member variables set by the constructor
|
||||
IPath source;
|
||||
IResource resource;
|
||||
IBuildObject buildContext;
|
||||
ITool tool;
|
||||
IPath topBuildDirectory;
|
||||
|
@ -74,8 +76,9 @@ public class DefaultGCCDependencyCalculator3Commands implements
|
|||
* @param topBuildDirectory The top build directory of the configuration. This is
|
||||
* the working directory for the tool. This IPath is relative to the project directory.
|
||||
*/
|
||||
public DefaultGCCDependencyCalculator3Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
public DefaultGCCDependencyCalculator3Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
this.source = source;
|
||||
this.resource = resource;
|
||||
this.buildContext = buildContext;
|
||||
this.tool = tool;
|
||||
this.topBuildDirectory = topBuildDirectory;
|
||||
|
@ -96,7 +99,24 @@ public class DefaultGCCDependencyCalculator3Commands implements
|
|||
|
||||
// A separate rule is needed for the resource in the case where explicit file-specific macros
|
||||
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
|
||||
needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
|
||||
|
||||
/* fix for 137674
|
||||
*
|
||||
* We only need an explicit rule if one of the following is true:
|
||||
* - The resource is linked, and its full path to its real location contains special characters
|
||||
* - The resource is not linked, but its project relative path contains special characters
|
||||
*/
|
||||
boolean resourceNameRequiresExplicitRule = true;
|
||||
|
||||
if(resource != null)
|
||||
{
|
||||
resourceNameRequiresExplicitRule = (resource.isLinked() && GnuMakefileGenerator
|
||||
.containsSpecialCharacters(sourceLocation.toString()))
|
||||
|| (!resource.isLinked() && GnuMakefileGenerator
|
||||
.containsSpecialCharacters(resource.getProjectRelativePath().toString()));
|
||||
}
|
||||
|
||||
needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
|
||||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|
||||
|| MacroResolver.getReferencedExplitFileMacros(
|
||||
tool.getToolCommand(),
|
||||
|
@ -108,6 +128,35 @@ public class DefaultGCCDependencyCalculator3Commands implements
|
|||
genericCommands = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. This constructor calls
|
||||
* DefaultGCCDependencyCalculator3Commands(IPath source, IResource resource,
|
||||
* IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a
|
||||
* null resource. The net result of this is that dependency rules will
|
||||
* always be explicit and will never use pattern rules, as it is impossible
|
||||
* for the calculator to know whether the resource is linked or not.
|
||||
*
|
||||
* @param source
|
||||
* The source file for which dependencies should be calculated
|
||||
* The IPath can be either relative to the project directory, or
|
||||
* absolute in the file system.
|
||||
* @param buildContext
|
||||
* The IConfiguration or IResourceConfiguration that contains the
|
||||
* context in which the source file will be built
|
||||
* @param tool
|
||||
* The tool associated with the source file
|
||||
* @param topBuildDirectory
|
||||
* The top build directory of the configuration. This is the
|
||||
* working directory for the tool. This IPath is relative to the
|
||||
* project directory.
|
||||
*
|
||||
* @see DefaultGCCDependencyCalculator3Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
|
||||
*/
|
||||
public DefaultGCCDependencyCalculator3Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
|
||||
{
|
||||
this(source, (IResource) null, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#areCommandsGeneric()
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
||||
|
@ -48,6 +49,14 @@ public class DefaultGCCDependencyCalculatorPreBuild implements
|
|||
return IManagedBuilderMakefileGenerator.DEP_EXT;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
return new DefaultGCCDependencyCalculatorPreBuildCommands(source, resource, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
|
@ -46,6 +47,7 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
|
|||
|
||||
// Member variables set by the constructor
|
||||
IPath source;
|
||||
IResource resource;
|
||||
IBuildObject buildContext;
|
||||
ITool tool;
|
||||
IPath topBuildDirectory;
|
||||
|
@ -68,8 +70,9 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
|
|||
* @param topBuildDirectory The top build directory of the configuration. This is
|
||||
* the working directory for the tool. This IPath is relative to the project directory.
|
||||
*/
|
||||
public DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
public DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
|
||||
this.source = source;
|
||||
this.resource = resource;
|
||||
this.buildContext = buildContext;
|
||||
this.tool = tool;
|
||||
this.topBuildDirectory = topBuildDirectory;
|
||||
|
@ -88,7 +91,24 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
|
|||
|
||||
// A separate rule is needed for the resource in the case where explicit file-specific macros
|
||||
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
|
||||
needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
|
||||
|
||||
/* fix for 137674
|
||||
*
|
||||
* We only need an explicit rule if one of the following is true:
|
||||
* - The resource is linked, and its full path to its real location contains special characters
|
||||
* - The resource is not linked, but its project relative path contains special characters
|
||||
*/
|
||||
boolean resourceNameRequiresExplicitRule = true;
|
||||
|
||||
if(resource != null)
|
||||
{
|
||||
resourceNameRequiresExplicitRule = (resource.isLinked() && GnuMakefileGenerator
|
||||
.containsSpecialCharacters(sourceLocation.toString()))
|
||||
|| (!resource.isLinked() && GnuMakefileGenerator
|
||||
.containsSpecialCharacters(resource.getProjectRelativePath().toString()));
|
||||
}
|
||||
|
||||
needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
|
||||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|
||||
|| MacroResolver.getReferencedExplitFileMacros(
|
||||
tool.getToolCommand(),
|
||||
|
@ -99,6 +119,35 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
|
|||
if (needExplicitRuleForFile) genericCommands = new Boolean(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. This constructor calls
|
||||
* DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IResource resource,
|
||||
* IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a
|
||||
* null resource. The net result of this is that dependency rules will
|
||||
* always be explicit and will never use pattern rules, as it is impossible
|
||||
* for the calculator to know whether the resource is linked or not.
|
||||
*
|
||||
* @param source
|
||||
* The source file for which dependencies should be calculated
|
||||
* The IPath can be either relative to the project directory, or
|
||||
* absolute in the file system.
|
||||
* @param buildContext
|
||||
* The IConfiguration or IResourceConfiguration that contains the
|
||||
* context in which the source file will be built
|
||||
* @param tool
|
||||
* The tool associated with the source file
|
||||
* @param topBuildDirectory
|
||||
* The top build directory of the configuration. This is the
|
||||
* working directory for the tool. This IPath is relative to the
|
||||
* project directory.
|
||||
*
|
||||
* @see DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
|
||||
*/
|
||||
public DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
|
||||
{
|
||||
this(source, (IResource) null, buildContext, tool, topBuildDirectory);
|
||||
}
|
||||
|
||||
public boolean areCommandsGeneric() {
|
||||
if (genericCommands != null) return genericCommands.booleanValue();
|
||||
// If the context is a Configuration, yes
|
||||
|
|
|
@ -2100,7 +2100,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
depGen = (IManagedDependencyGenerator2)t;
|
||||
doDepGen = (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS);
|
||||
IBuildObject buildContext = (resConfig != null) ? (IBuildObject)resConfig : (IBuildObject)config;
|
||||
depInfo = depGen.getDependencySourceInfo(resource.getProjectRelativePath(), buildContext, tool, getBuildWorkingDir());
|
||||
|
||||
depInfo = depGen.getDependencySourceInfo(resource.getProjectRelativePath(), resource, buildContext, tool, getBuildWorkingDir());
|
||||
|
||||
if (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS) {
|
||||
depCommands = (IManagedDependencyCommands)depInfo;
|
||||
depFiles = depCommands.getDependencyFiles();
|
||||
|
@ -2158,7 +2160,20 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
|
||||
// A separate rule is needed for the resource in the case where explicit file-specific macros
|
||||
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
|
||||
boolean needExplicitRuleForFile = containsSpecialCharacters(sourceLocation.toString()) ||
|
||||
|
||||
/* fix for 137674
|
||||
*
|
||||
* We only need an explicit rule if one of the following is true:
|
||||
* - The resource is linked, and its full path to its real location contains special characters
|
||||
* - The resource is not linked, but its project relative path contains special characters
|
||||
*/
|
||||
|
||||
boolean resourceNameRequiresExplicitRule = (resource.isLinked() && containsSpecialCharacters(sourceLocation
|
||||
.toString()))
|
||||
|| (!resource.isLinked() && containsSpecialCharacters(resource
|
||||
.getProjectRelativePath().toString()));
|
||||
|
||||
boolean needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
|
||||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|
||||
|| MacroResolver.getReferencedExplitFileMacros(tool
|
||||
.getToolCommand(), IBuildMacroProvider.CONTEXT_FILE,
|
||||
|
@ -4143,7 +4158,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
|||
calcType == IManagedDependencyGeneratorType.TYPE_PREBUILD_COMMANDS) {
|
||||
IManagedDependencyGenerator2 depGen = (IManagedDependencyGenerator2)depType;
|
||||
IManagedDependencyInfo depInfo = depGen.getDependencySourceInfo(
|
||||
deletedFile.getProjectRelativePath(), config, tool, getBuildWorkingDir());
|
||||
deletedFile.getProjectRelativePath(), deletedFile, config, tool, getBuildWorkingDir());
|
||||
if (depInfo != null) {
|
||||
if (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS) {
|
||||
IManagedDependencyCommands depCommands = (IManagedDependencyCommands)depInfo;
|
||||
|
|
|
@ -819,8 +819,10 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
|
|||
IManagedDependencyGenerator2 depGen2 = (IManagedDependencyGenerator2)depGen;
|
||||
IManagedDependencyInfo depInfo = null;
|
||||
for (int i=0; i<inputs.size(); i++) {
|
||||
|
||||
depInfo = depGen2.getDependencySourceInfo(
|
||||
Path.fromOSString((String)inputs.get(i)), config, tool, makeGen.getBuildWorkingDir());
|
||||
|
||||
if (depInfo instanceof IManagedDependencyCalculator) {
|
||||
IManagedDependencyCalculator depCalc = (IManagedDependencyCalculator)depInfo;
|
||||
IPath[] depPaths = depCalc.getDependencies();
|
||||
|
|
Loading…
Add table
Reference in a new issue