1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

bug 416024: ManagedBuildManager.locationToFullPath(str) moved to BuildEntryStorage

This commit is contained in:
Andrew Gvozdev 2013-10-20 15:15:37 -04:00
parent b0ea093470
commit 3426670477
2 changed files with 45 additions and 28 deletions

View file

@ -102,6 +102,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.TargetPlatform;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData;
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildEntryStorage;
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
import org.eclipse.cdt.managedbuilder.internal.envvar.EnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
@ -121,6 +122,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
@ -3915,37 +3917,17 @@ public class ManagedBuildManager extends AbstractCExtension {
/**
* Returns a string representing the workspace relative path with ${workspace_loc: stripped
* or null if the String path doesn't contain workspace_log
* or null if the String path doesn't contain workspace_loc
* @param path String path to have workspace_loc removed
* @return workspace path or null
*
* @deprecated as of CDT 8.3. This method is useless as API as it does something very specfic to {@link BuildEntryStorage}.
* It was moved there as private method {@link BuildEntryStorage#locationToFullPath}.
*/
@Deprecated
public static String locationToFullPath(String path){
path = path.trim();
if(!path.startsWith("${")) //$NON-NLS-1$
return null;
final int index = path.lastIndexOf('}');
if(index == -1)
return null;
String varName = "workspace_loc"; //$NON-NLS-1$
String str1 = path.substring(2, index);
String result = null;
if(str1.startsWith(varName)){
str1 = str1.substring(varName.length());
if(str1.length() != 0){
if(str1.startsWith(":")){ //$NON-NLS-1$
result = str1.substring(1);
}
} else {
result = "/"; //$NON-NLS-1$
}
// If the user has a path like ${workspace_loc:/thing}/other/thing
// ensure we return /thing/other/thing
if (index < path.length() - 1)
result += path.substring(index + 1);
}
return result;
Assert.isLegal(false, "Do not use this method"); //$NON-NLS-1$
return null;
}
public static String fullPathToLocation(String path){

View file

@ -591,8 +591,43 @@ public class BuildEntryStorage extends AbstractEntryStorage {
// return new Object[] { value, Boolean.valueOf(false) };
// }
/**
* Returns a string representing the workspace relative path with ${workspace_loc: stripped
* or null if the String path doesn't contain workspace_loc
* @param path String path to have workspace_loc removed
* @return workspace path or null
*/
private static String locationToFullPath(String path){
path = path.trim();
if(!path.startsWith("${")) //$NON-NLS-1$
return null;
final int index = path.lastIndexOf('}');
if(index == -1)
return null;
String varName = "workspace_loc"; //$NON-NLS-1$
String str1 = path.substring(2, index);
String result = null;
if(str1.startsWith(varName)){
str1 = str1.substring(varName.length());
if(str1.length() != 0){
if(str1.startsWith(":")){ //$NON-NLS-1$
result = str1.substring(1);
}
} else {
result = "/"; //$NON-NLS-1$
}
// If the user has a path like ${workspace_loc:/thing}/other/thing
// ensure we return /thing/other/thing
if (index < path.length() - 1)
result += path.substring(index + 1);
}
return result;
}
private static PathInfo optionPathValueToEntry(String str, SupplierBasedCdtVariableSubstitutor subst) {
String unresolvedStr = ManagedBuildManager.locationToFullPath(str);
String unresolvedStr = locationToFullPath(str);
boolean isWorkspacePath = false;
if (unresolvedStr == null) {
unresolvedStr = str;