mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-08 11:03:28 +02:00
Bug 269023 URI support added to EPM, add IBuildDescription#getDefaultBuildDirLocationURI(...) & use the URI location of the build dir for build output error parsing.
This commit is contained in:
parent
9953f12da4
commit
8743008765
5 changed files with 65 additions and 9 deletions
|
@ -10,6 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.buildmodel;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -77,10 +79,20 @@ public interface IBuildDescription {
|
|||
|
||||
/**
|
||||
* Returns the default build directory location
|
||||
*
|
||||
* @return IPath
|
||||
*/
|
||||
IPath getDefaultBuildDirLocation();
|
||||
|
||||
/**
|
||||
* Returns the default build directory location URI
|
||||
* @return URI build dir location or null if one couldn't be found
|
||||
* @since 6.0
|
||||
*/
|
||||
URI getDefaultBuildDirLocationURI();
|
||||
|
||||
/**
|
||||
* The Workspace FullPath of the build directory
|
||||
* @return
|
||||
*/
|
||||
IPath getDefaultBuildDirFullPath();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -126,6 +127,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -4103,7 +4105,34 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
}
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the Build Location URI or null if one couldn't be found
|
||||
* @param cfg
|
||||
* @param builder
|
||||
* @return build location URI or null if one couldn't be found
|
||||
* @since 6.0
|
||||
*/
|
||||
public static URI getBuildLocationURI(IConfiguration cfg, IBuilder builder) {
|
||||
if(cfg.getOwner() == null)
|
||||
return null;
|
||||
|
||||
IProject project = cfg.getOwner().getProject();
|
||||
IPath buildDirectory = builder.getBuildLocation();
|
||||
if (buildDirectory != null && !buildDirectory.isEmpty()) {
|
||||
IResource res = project.getParent().findMember(buildDirectory);
|
||||
if (res instanceof IContainer && res.exists()) {
|
||||
return res.getLocationURI();
|
||||
}
|
||||
} else {
|
||||
URI uri = project.getLocationURI();
|
||||
if (buildDirectory != null && builder.isManagedBuildOn())
|
||||
return URIUtil.append(uri, cfg.getName());
|
||||
return uri;
|
||||
}
|
||||
return org.eclipse.core.filesystem.URIUtil.toURI(buildDirectory);
|
||||
}
|
||||
|
||||
private static IPath getPathForResource(IResource resource) {
|
||||
return new Path(resource.getLocationURI().getPath());
|
||||
}
|
||||
|
|
|
@ -1013,7 +1013,12 @@ public class BuildDescription implements IBuildDescription {
|
|||
IPath projLocation = getProjectLocation();
|
||||
return projLocation.append(getTopBuildDirFullPath().removeFirstSegments(1));
|
||||
}
|
||||
|
||||
|
||||
private URI getTopBuildDirLocationURI(){
|
||||
return org.eclipse.core.runtime.URIUtil.makeAbsolute(URIUtil.toURI(getTopBuildDirFullPath().removeFirstSegments(1)),
|
||||
fProject.getLocationURI());
|
||||
}
|
||||
|
||||
private IPath getProjectLocation() {
|
||||
return new Path(fProject.getLocationURI().getPath());
|
||||
}
|
||||
|
@ -2225,6 +2230,10 @@ public class BuildDescription implements IBuildDescription {
|
|||
return getTopBuildDirLocation();
|
||||
}
|
||||
|
||||
public URI getDefaultBuildDirLocationURI() {
|
||||
return getTopBuildDirLocationURI();
|
||||
}
|
||||
|
||||
public IPath getDefaultBuildDirFullPath() {
|
||||
return getTopBuildDirFullPath();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -1011,7 +1012,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
|
||||
// Hook up an error parser manager
|
||||
String[] errorParsers = builder.getErrorParsers();
|
||||
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocation(), this, errorParsers);
|
||||
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocationURI(), this, errorParsers);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
// This variable is necessary to ensure that the EPM stream stay open
|
||||
// until we explicitly close it. See bug#123302.
|
||||
|
@ -1227,7 +1228,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
|
||||
// Hook up an error parser manager
|
||||
String[] errorParsers = cfg.getErrorParserList();
|
||||
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocation(), this, errorParsers);
|
||||
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocationURI(), this, errorParsers);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
// This variable is necessary to ensure that the EPM stream stay open
|
||||
// until we explicitly close it. See bug#123302.
|
||||
|
@ -1928,6 +1929,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
removeAllMarkers(currProject);
|
||||
|
||||
IPath workingDirectory = ManagedBuildManager.getBuildLocation(cfg, builder);
|
||||
URI workingDirectoryURI = ManagedBuildManager.getBuildLocationURI(cfg, builder);
|
||||
|
||||
String[] targets = getTargets(kind, builder);
|
||||
if (targets.length != 0 && targets[targets.length - 1].equals(builder.getCleanBuildTarget())) //$NON-NLS-1$
|
||||
|
@ -1957,7 +1959,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
last = new Integer(100);
|
||||
}
|
||||
StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue());
|
||||
ErrorParserManager epm = new ErrorParserManager(currProject, workingDirectory, this, builder.getErrorParsers());
|
||||
ErrorParserManager epm = new ErrorParserManager(currProject, workingDirectoryURI, this, builder.getErrorParsers());
|
||||
epm.setOutputStream(streamMon);
|
||||
OutputStream stdout = epm.getOutputStream();
|
||||
OutputStream stderr = epm.getOutputStream();
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -64,6 +65,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
|||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
|
||||
/**
|
||||
* This is the incremental builder associated with a managed build project. It dynamically
|
||||
|
@ -874,6 +876,8 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
try {
|
||||
// Figure out the working directory for the build and make sure there is a makefile there
|
||||
IPath workingDirectory = getWorkingDirectory().append(buildDir);
|
||||
final URI workingDirectoryURI = URIUtil.append(getProject().getLocationURI(), buildDir.toOSString());
|
||||
|
||||
IWorkspace workspace = currentProject.getWorkspace();
|
||||
if (workspace == null) {
|
||||
return;
|
||||
|
@ -964,7 +968,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
|
||||
// Hook up an error parser manager
|
||||
String[] errorParsers = info.getDefaultConfiguration().getErrorParserList();
|
||||
ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectory, this, errorParsers);
|
||||
ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectoryURI, this, errorParsers);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
// This variable is necessary to ensure that the EPM stream stay open
|
||||
// until we explicitly close it. See bug#123302.
|
||||
|
@ -1262,7 +1266,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
|
||||
// Hook up an error parser manager
|
||||
String[] errorParsers = cfg.getErrorParserList();
|
||||
ErrorParserManager epm = new ErrorParserManager(getProject(), des.getDefaultBuildDirLocation(), this, errorParsers);
|
||||
ErrorParserManager epm = new ErrorParserManager(getProject(), des.getDefaultBuildDirLocationURI(), this, errorParsers);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
// This variable is necessary to ensure that the EPM stream stay open
|
||||
// until we explicitly close it. See bug#123302.
|
||||
|
@ -1455,7 +1459,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
|
||||
// Hook up an error parser manager
|
||||
String[] errorParsers = cfg.getErrorParserList();
|
||||
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocation(), this, errorParsers);
|
||||
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocationURI(), this, errorParsers);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
// This variable is necessary to ensure that the EPM stream stay open
|
||||
// until we explicitly close it. See bug#123302.
|
||||
|
|
Loading…
Add table
Reference in a new issue