mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for [Bug 202805] custom IManagedBuilderMakefileGenerator.getBuildWorkingDir() is nor called
This commit is contained in:
parent
8d1c3416a8
commit
e67e534b88
3 changed files with 66 additions and 32 deletions
|
@ -357,7 +357,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
cfgDes = cfgDess[0];
|
cfgDes = cfgDess[0];
|
||||||
rf = cfgDes.getRootFolderDescription();
|
rf = cfgDes.getRootFolderDescription();
|
||||||
settings = rf.getLanguageSettings();
|
settings = rf.getLanguageSettings();
|
||||||
ICLanguageSettingEntry updatedEntries[] = null;
|
ICLanguageSettingEntry updatedEntries[] = new ICLanguageSettingEntry[0];
|
||||||
for(int i = 0; i < settings.length; i++){
|
for(int i = 0; i < settings.length; i++){
|
||||||
ICLanguageSetting setting = settings[i];
|
ICLanguageSetting setting = settings[i];
|
||||||
ICLanguageSettingEntry[] entries = setting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH);
|
ICLanguageSettingEntry[] entries = setting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH);
|
||||||
|
|
|
@ -55,11 +55,13 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
|
@ -377,8 +379,10 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
||||||
if(builder.customizedEnvironment != null)
|
if(builder.customizedEnvironment != null)
|
||||||
customizedEnvironment = (HashMap)builder.customizedEnvironment.clone();
|
customizedEnvironment = (HashMap)builder.customizedEnvironment.clone();
|
||||||
appendEnvironment = builder.appendEnvironment;
|
appendEnvironment = builder.appendEnvironment;
|
||||||
|
if(isBuildPathEditable()){
|
||||||
if(!getBuildPath().equals(builder.getBuildPath()))
|
if(!getBuildPath().equals(builder.getBuildPath()))
|
||||||
setBuildPath(builder.getBuildPath());
|
setBuildPath(builder.getBuildPath());
|
||||||
|
}
|
||||||
if(builder.customBuildProperties != null)
|
if(builder.customBuildProperties != null)
|
||||||
customBuildProperties = (HashMap)builder.customBuildProperties.clone();
|
customBuildProperties = (HashMap)builder.customBuildProperties.clone();
|
||||||
|
|
||||||
|
@ -1728,31 +1732,62 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isBuildPathEditable(){
|
||||||
|
return !isManagedBuildOn();
|
||||||
|
}
|
||||||
|
|
||||||
public String getDefaultBuildPath(){
|
public String getDefaultBuildPath(){
|
||||||
Configuration cfg = (Configuration)getConfguration();
|
Configuration cfg = (Configuration)getConfguration();
|
||||||
String path = null;
|
IPath buildPath;
|
||||||
if(cfg != null){
|
String result;
|
||||||
if(isManagedBuildOn()){
|
|
||||||
path = cfg.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Builder extBuilder = (Builder)ManagedBuildManager.getExtensionBuilder(this);
|
||||||
|
// String attr = extBuilder.getBuildPathAttribute();
|
||||||
|
if(cfg != null){
|
||||||
if(!isExtensionElement() && !cfg.isPreference()){
|
if(!isExtensionElement() && !cfg.isPreference()){
|
||||||
IProject project = cfg.getOwner().getProject();
|
IProject project = cfg.getOwner().getProject();
|
||||||
IPath buildPath = project.getFullPath();
|
// if(attr == null){
|
||||||
|
if(isManagedBuildOn()){
|
||||||
|
IManagedBuilderMakefileGenerator gen = getBuildFileGenerator();
|
||||||
|
if(gen instanceof IManagedBuilderMakefileGenerator2){
|
||||||
|
((IManagedBuilderMakefileGenerator2)gen).initialize(IncrementalProjectBuilder.FULL_BUILD, cfg, this, new NullProgressMonitor());
|
||||||
|
} else {
|
||||||
|
gen.initialize(project, ManagedBuildManager.getBuildInfo(project), new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
|
||||||
|
buildPath = gen.getBuildWorkingDir();
|
||||||
|
if(buildPath == null)
|
||||||
|
buildPath = new Path(cfg.getName());
|
||||||
|
} else {
|
||||||
|
buildPath = Path.EMPTY;
|
||||||
|
}
|
||||||
|
// } else {
|
||||||
|
// buildPath = new Path(attr);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if(!buildPath.isAbsolute()){
|
||||||
|
buildPath = project.getFullPath().append(buildPath);
|
||||||
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
if(path != null)
|
|
||||||
buildPath = buildPath.append(path);
|
|
||||||
|
|
||||||
path = buildPath.toString();
|
result = buildPath.toString();
|
||||||
path = mngr.generateVariableExpression("workspace_loc", path); //$NON-NLS-1$
|
result = mngr.generateVariableExpression("workspace_loc", result); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
result = buildPath.toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(isManagedBuildOn()){
|
||||||
|
result = cfg.getName();
|
||||||
|
if(result == null)
|
||||||
|
result = ""; //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
result = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if(path == null){
|
result = ""; //$NON-NLS-1$
|
||||||
path = ""; //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public boolean isWorkspaceBuildPath(){
|
/* public boolean isWorkspaceBuildPath(){
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier;
|
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the Environment Variable Supplier used to supply variables
|
* This is the Environment Variable Supplier used to supply variables
|
||||||
|
@ -30,10 +29,10 @@ import org.eclipse.core.runtime.Path;
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class MbsEnvironmentSupplier implements IEnvironmentVariableSupplier {
|
public class MbsEnvironmentSupplier implements IEnvironmentVariableSupplier {
|
||||||
private static final String fVariableNames[] = new String[]{
|
// private static final String fVariableNames[] = new String[]{
|
||||||
"CWD", //$NON-NLS-1$
|
// "CWD", //$NON-NLS-1$
|
||||||
"PWD" //$NON-NLS-1$
|
// "PWD" //$NON-NLS-1$
|
||||||
};
|
// };
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
|
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
|
||||||
|
@ -76,14 +75,14 @@ public class MbsEnvironmentSupplier implements IEnvironmentVariableSupplier {
|
||||||
*/
|
*/
|
||||||
public IEnvironmentVariable[] getVariables(Object context) {
|
public IEnvironmentVariable[] getVariables(Object context) {
|
||||||
if(context instanceof IConfiguration){
|
if(context instanceof IConfiguration){
|
||||||
List variables = new ArrayList(fVariableNames.length);
|
List variables = new ArrayList(2);
|
||||||
for(int i = 0; i < fVariableNames.length; i++){
|
IBuildEnvironmentVariable var = getConfigurationVariable("CWD",(IConfiguration)context);
|
||||||
IBuildEnvironmentVariable var = getConfigurationVariable(fVariableNames[i],(IConfiguration)context);
|
if(var != null){
|
||||||
if(var != null)
|
|
||||||
variables.add(var);
|
variables.add(var);
|
||||||
}
|
variables.add(new BuildEnvVar("PWD", var.getValue(), IBuildEnvironmentVariable.ENVVAR_REPLACE, null));
|
||||||
if(variables.size() == 0)
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
return (IEnvironmentVariable[])variables.toArray(new IBuildEnvironmentVariable[variables.size()]);
|
return (IEnvironmentVariable[])variables.toArray(new IBuildEnvironmentVariable[variables.size()]);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue