add 'includeClassFiles' option to EclipseProjectPath
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3437 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
37344b9716
commit
ddbf819cb5
|
@ -13,11 +13,11 @@ package com.ibm.wala.classLoader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
import com.ibm.wala.eclipse.util.EclipseProjectPath;
|
import com.ibm.wala.eclipse.util.EclipseProjectPath;
|
||||||
|
|
||||||
public class EclipseSourceDirectoryTreeModule extends SourceDirectoryTreeModule {
|
public class EclipseSourceDirectoryTreeModule extends SourceDirectoryTreeModule {
|
||||||
|
|
|
@ -58,10 +58,10 @@ public abstract class AbstractJavaAnalysisAction implements IObjectActionDelegat
|
||||||
* Compute an analysis scope for the current selection
|
* Compute an analysis scope for the current selection
|
||||||
*/
|
*/
|
||||||
public static AnalysisScope computeScope(IStructuredSelection selection) throws IOException {
|
public static AnalysisScope computeScope(IStructuredSelection selection) throws IOException {
|
||||||
return computeScope(selection, false);
|
return computeScope(selection, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AnalysisScope computeScope(IStructuredSelection selection, boolean includeSource) throws IOException {
|
public static AnalysisScope computeScope(IStructuredSelection selection, boolean includeSource, boolean includeClassFiles) throws IOException {
|
||||||
if (selection == null) {
|
if (selection == null) {
|
||||||
throw new IllegalArgumentException("null selection");
|
throw new IllegalArgumentException("null selection");
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public abstract class AbstractJavaAnalysisAction implements IObjectActionDelegat
|
||||||
IJavaElement e = (IJavaElement) object;
|
IJavaElement e = (IJavaElement) object;
|
||||||
IJavaProject jp = e.getJavaProject();
|
IJavaProject jp = e.getJavaProject();
|
||||||
try {
|
try {
|
||||||
projectPaths.add(EclipseProjectPath.make(jp, includeSource));
|
projectPaths.add(EclipseProjectPath.make(jp, includeSource, includeClassFiles));
|
||||||
} catch (CoreException e1) {
|
} catch (CoreException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
// skip and continue
|
// skip and continue
|
||||||
|
|
|
@ -45,7 +45,6 @@ import com.ibm.wala.classLoader.BinaryDirectoryTreeModule;
|
||||||
import com.ibm.wala.classLoader.EclipseSourceDirectoryTreeModule;
|
import com.ibm.wala.classLoader.EclipseSourceDirectoryTreeModule;
|
||||||
import com.ibm.wala.classLoader.JarFileModule;
|
import com.ibm.wala.classLoader.JarFileModule;
|
||||||
import com.ibm.wala.classLoader.Module;
|
import com.ibm.wala.classLoader.Module;
|
||||||
import com.ibm.wala.classLoader.SourceDirectoryTreeModule;
|
|
||||||
import com.ibm.wala.client.AbstractAnalysisEngine;
|
import com.ibm.wala.client.AbstractAnalysisEngine;
|
||||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||||
import com.ibm.wala.types.ClassLoaderReference;
|
import com.ibm.wala.types.ClassLoaderReference;
|
||||||
|
@ -105,12 +104,18 @@ public class EclipseProjectPath {
|
||||||
* Should the analysis scope include source files
|
* Should the analysis scope include source files
|
||||||
*/
|
*/
|
||||||
private final boolean includeSource;
|
private final boolean includeSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should the analysis scope include class files generated by the Eclipse build process?
|
||||||
|
*/
|
||||||
|
private final boolean includeClassFiles;
|
||||||
|
|
||||||
protected EclipseProjectPath(IJavaProject project, boolean includeSource) throws IOException, CoreException {
|
protected EclipseProjectPath(IJavaProject project, boolean includeSource, boolean includeClassFiles) throws IOException, CoreException {
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
throw new IllegalArgumentException("null project");
|
throw new IllegalArgumentException("null project");
|
||||||
}
|
}
|
||||||
this.includeSource = includeSource;
|
this.includeSource = includeSource;
|
||||||
|
this.includeClassFiles = includeClassFiles;
|
||||||
this.project = project;
|
this.project = project;
|
||||||
assert project != null;
|
assert project != null;
|
||||||
for (Loader loader : Loader.values()) {
|
for (Loader loader : Loader.values()) {
|
||||||
|
@ -123,11 +128,11 @@ public class EclipseProjectPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EclipseProjectPath make(IJavaProject project) throws IOException, CoreException {
|
public static EclipseProjectPath make(IJavaProject project) throws IOException, CoreException {
|
||||||
return make(project, false);
|
return make(project, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EclipseProjectPath make(IJavaProject project, boolean includeSource) throws IOException, CoreException {
|
public static EclipseProjectPath make(IJavaProject project, boolean includeSource, boolean includeClassFiles) throws IOException, CoreException {
|
||||||
return new EclipseProjectPath(project, includeSource);
|
return new EclipseProjectPath(project, includeSource, includeClassFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -311,7 +316,7 @@ public class EclipseProjectPath {
|
||||||
public AnalysisScope toAnalysisScope(AnalysisScope scope) {
|
public AnalysisScope toAnalysisScope(AnalysisScope scope) {
|
||||||
try {
|
try {
|
||||||
List<Module> l = MapUtil.findOrCreateList(modules, Loader.APPLICATION);
|
List<Module> l = MapUtil.findOrCreateList(modules, Loader.APPLICATION);
|
||||||
if (! includeSource) {
|
if (includeClassFiles) {
|
||||||
File dir = makeAbsolute(project.getOutputLocation()).toFile();
|
File dir = makeAbsolute(project.getOutputLocation()).toFile();
|
||||||
if (!dir.isDirectory()) {
|
if (!dir.isDirectory()) {
|
||||||
System.err.println("PANIC: project output location is not a directory: " + dir);
|
System.err.println("PANIC: project output location is not a directory: " + dir);
|
||||||
|
|
Loading…
Reference in New Issue