more separation for JS eclipse stuff

This commit is contained in:
dolby 2012-08-21 16:06:01 -04:00
parent a54707f22e
commit 53cad9e7ba
8 changed files with 38 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.jdt.test</name>
<name>com.ibm.wala.ide.jdt.test</name>
<comment></comment>
<projects>
</projects>

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA CAst Java JDT Test Plug-in
Bundle-SymbolicName: com.ibm.wala.cast.java.jdt.test
Bundle-SymbolicName: com.ibm.wala.ide.jdt.test
Bundle-Version: 1.0.0
Bundle-Activator: com.ibm.wala.cast.java.jdt.test.Activator
Bundle-Vendor: IBM
@ -9,7 +9,7 @@ Require-Bundle: com.ibm.wala.cast.java.test;bundle-version="1.0.0",
com.ibm.wala.cast.test;bundle-version="1.0.0",
com.ibm.wala.ide.tests;bundle-version="1.1.3",
com.ibm.wala.core.tests;bundle-version="1.1.3",
com.ibm.wala.cast.java.jdt;bundle-version="1.0.0",
com.ibm.wala.ide.jdt;bundle-version="1.0.0",
com.ibm.wala.cast.java;bundle-version="1.0.0",
com.ibm.wala.cast;bundle-version="1.0.0",
com.ibm.wala.ide;bundle-version="1.1.3",

View File

@ -16,7 +16,7 @@
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.java.jdt.test/source/com/ibm/wala/cast/java/test/JDTJava15IRTests.java"/>
<listEntry value="/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJava15IRTests.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -28,7 +28,7 @@
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JDK 1.6"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.JDTJava15IRTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcom.ibm.wala.tracefile=/tmp/jdt15tests.txt -Xms40m -XX:MaxPermSize=128m -Xmx2048m -ea"/>
<stringAttribute key="pde.version" value="3.3"/>

View File

@ -16,7 +16,7 @@
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.java.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaIRTests.java"/>
<listEntry value="/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaIRTests.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -27,7 +27,7 @@
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.JDTJavaIRTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcom.ibm.wala.tracefile=/tmp/jdt15tests.txt -Xmx1024M -ea"/>
<stringAttribute key="pde.version" value="3.3"/>

View File

@ -16,7 +16,7 @@
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.java.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaIRTests.java"/>
<listEntry value="/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaIRTests.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -28,7 +28,7 @@
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JDK 1.6"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.JDTJavaIRTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcom.ibm.wala.tracefile=/tmp/jdt15tests.txt -Xms40m -XX:MaxPermSize=128m -Xmx2048m -ea"/>
<stringAttribute key="pde.version" value="3.3"/>

View File

@ -10,9 +10,21 @@ import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.core.JavaScriptModelException;
import com.ibm.wala.cast.js.types.JavaScriptTypes;
import com.ibm.wala.types.ClassLoaderReference;
public class JavaScriptEclipseProjectPath extends EclipseProjectPath<IIncludePathEntry, IJavaScriptProject> {
public enum JSLoader implements ILoader {
JAVASCRIPT(JavaScriptTypes.jsLoader);
private ClassLoaderReference ref;
JSLoader(ClassLoaderReference ref) {
this.ref = ref;
}
}
protected JavaScriptEclipseProjectPath(IJavaScriptProject p) throws IOException,
CoreException {
super(AnalysisScopeType.SOURCE_FOR_PROJ_AND_LINKED_PROJS);
@ -44,12 +56,12 @@ public class JavaScriptEclipseProjectPath extends EclipseProjectPath<IIncludePat
@Override
protected void resolveClasspathEntry(IJavaScriptProject project,
IIncludePathEntry entry,
com.ibm.wala.ide.util.EclipseProjectPath.Loader loader,
ILoader loader,
boolean includeSource, boolean cpeFromMainProject) {
IIncludePathEntry e = JavaScriptCore.getResolvedIncludepathEntry(entry);
switch (e.getEntryKind()) {
case IIncludePathEntry.CPE_SOURCE:
resolveSourcePathEntry(Loader.JAVASCRIPT, true, cpeFromMainProject, e.getPath(), null, "js");
resolveSourcePathEntry(JSLoader.JAVASCRIPT, true, cpeFromMainProject, e.getPath(), null, "js");
}
}

View File

@ -7,9 +7,7 @@ Bundle-Version: 1.1.3.qualifier
Bundle-Activator: com.ibm.wala.ide.plugin.CorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: com.ibm.wala.cast.js.rhino;bundle-version="1.0.0",
com.ibm.wala.cast.js;bundle-version="1.0.0",
com.ibm.wala.cast;bundle-version="1.0.0",
Require-Bundle: com.ibm.wala.cast;bundle-version="1.0.0",
com.ibm.wala.core,
com.ibm.wala.shrike,
org.eclipse.pde.core,

View File

@ -36,7 +36,6 @@ import org.eclipse.pde.internal.core.ClasspathUtilCore;
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.PDEStateHelper;
import com.ibm.wala.cast.js.types.JavaScriptTypes;
import com.ibm.wala.classLoader.BinaryDirectoryTreeModule;
import com.ibm.wala.classLoader.JarFileModule;
import com.ibm.wala.classLoader.Module;
@ -68,17 +67,21 @@ public abstract class EclipseProjectPath<E, P> {
protected abstract E resolve(E entry);
protected abstract void resolveClasspathEntry(P project, E entry, Loader loader, boolean includeSource, boolean cpeFromMainProject);
protected abstract void resolveClasspathEntry(P project, E entry, ILoader loader, boolean includeSource, boolean cpeFromMainProject);
protected abstract void resolveProjectClasspathEntries(P project, boolean includeSource);
interface ILoader {
};
/**
* Eclipse projects are modeled with 3 loaders, as described above.
*/
public enum Loader {
public enum Loader implements ILoader {
APPLICATION(ClassLoaderReference.Application), EXTENSION(ClassLoaderReference.Extension), PRIMORDIAL(
ClassLoaderReference.Primordial), JAVASCRIPT(JavaScriptTypes.jsLoader);
ClassLoaderReference.Primordial);
private ClassLoaderReference ref;
@ -98,7 +101,7 @@ public abstract class EclipseProjectPath<E, P> {
// SJF: Intentionally do not use HashMapFactory, since the Loader keys in the following must use
// identityHashCode. TODO: fix this source of non-determinism?
protected final Map<Loader, List<Module>> modules = new HashMap<Loader, List<Module>>();
protected final Map<ILoader, List<Module>> modules = new HashMap<ILoader, List<Module>>();
/**
* Classpath entries that have already been resolved and added to the scope.
@ -112,7 +115,7 @@ public abstract class EclipseProjectPath<E, P> {
protected EclipseProjectPath(AnalysisScopeType scopeType) throws IOException, CoreException {
this.scopeType = scopeType;
for (Loader loader : Loader.values()) {
for (ILoader loader : Loader.values()) {
MapUtil.findOrCreateList(modules, loader);
}
}
@ -133,7 +136,7 @@ public abstract class EclipseProjectPath<E, P> {
}
protected void resolveLibraryPathEntry(Loader loader, IPath p) throws IOException {
protected void resolveLibraryPathEntry(ILoader loader, IPath p) throws IOException {
File file = makeAbsolute(p).toFile();
JarFile j;
try {
@ -151,7 +154,7 @@ public abstract class EclipseProjectPath<E, P> {
}
}
protected void resolveSourcePathEntry(Loader loader, boolean includeSource, boolean cpeFromMainProject, IPath p, IPath o, String fileExtension) {
protected void resolveSourcePathEntry(ILoader loader, boolean includeSource, boolean cpeFromMainProject, IPath p, IPath o, String fileExtension) {
if (includeSource) {
List<Module> s = MapUtil.findOrCreateList(modules, loader);
s.add(new EclipseSourceDirectoryTreeModule(p, fileExtension));
@ -162,7 +165,7 @@ public abstract class EclipseProjectPath<E, P> {
}
}
protected void resolveProjectPathEntry(Loader loader, boolean includeSource, IPath p) throws IOException {
protected void resolveProjectPathEntry(ILoader loader, boolean includeSource, IPath p) throws IOException {
IPath projectPath = makeAbsolute(p);
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
@ -219,7 +222,7 @@ public abstract class EclipseProjectPath<E, P> {
/**
* traverse a bundle description and populate the analysis scope accordingly
*/
private void resolveBundleDescriptionClassPath(P project, BundleDescription bd, Loader loader, boolean includeSource) throws CoreException,
private void resolveBundleDescriptionClassPath(P project, BundleDescription bd, ILoader loader, boolean includeSource) throws CoreException,
IOException {
assert bd != null;
if (alreadyProcessed(bd)) {
@ -273,7 +276,7 @@ public abstract class EclipseProjectPath<E, P> {
return true;
}
protected void resolveClasspathEntries(P project, List l, Loader loader, boolean includeSource, boolean entriesFromTopLevelProject) {
protected void resolveClasspathEntries(P project, List l, ILoader loader, boolean includeSource, boolean entriesFromTopLevelProject) {
for (int i = 0; i < l.size(); i++) {
resolveClasspathEntry(project, resolve((E)l.get(i)), loader, includeSource, entriesFromTopLevelProject);
}