separate Rhino-specific portions of javascript analysis
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3731 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
cab3c60f7e
commit
a3dc6411ae
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/js.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.ibm.wala.cast.js.rhino</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
#Tue Jun 23 17:02:07 EDT 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
|
@ -0,0 +1,14 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Rhino Plug-in
|
||||
Bundle-SymbolicName: com.ibm.wala.cast.js.rhino
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-Activator: com.ibm.wala.js.rhino.Activator
|
||||
Bundle-Vendor: IBM
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
com.ibm.wala.cast;bundle-version="1.0.0",
|
||||
com.ibm.wala.cast.js;bundle-version="1.0.0",
|
||||
com.ibm.wala.core;bundle-version="1.1.3"
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.ibm.wala.cast.js.translator
|
|
@ -0,0 +1,4 @@
|
|||
source.. = source/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
#REAL_NAME=`realpath $0`
|
||||
MY_DIR=`pwd`
|
||||
|
||||
TMP=$MY_DIR/tmp
|
||||
|
||||
if [[ ! -e $MY_DIR/js.jar ]]; then
|
||||
mkdir -p $TMP
|
||||
|
||||
cd $TMP
|
||||
|
||||
wget -O rhino1_6R5.zip ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_6R5.zip
|
||||
|
||||
unzip rhino1_6R5.zip rhino1_6R5/js.jar
|
||||
|
||||
cp rhino1_6R5/js.jar $MY_DIR/js.jar
|
||||
|
||||
cd $MY_DIR
|
||||
rm -rf $TMP
|
||||
fi
|
||||
|
||||
if [[ ! -e $MY_DIR/xalan.jar ]]; then
|
||||
mkdir -p $TMP
|
||||
|
||||
cd $TMP
|
||||
|
||||
wget -O xalan-j_2_7_0-bin.tar.gz http://archive.apache.org/dist/xml/xalan-j/xalan-j_2_7_0-bin.tar.gz
|
||||
|
||||
tar xzf xalan-j_2_7_0-bin.tar.gz xalan-j_2_7_0/xalan.jar
|
||||
|
||||
cp xalan-j_2_7_0/xalan.jar $MY_DIR/xalan.jar
|
||||
|
||||
cd $MY_DIR
|
||||
rm -rf $TMP
|
||||
fi
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
package com.ibm.wala.cast.js.translator;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.tree.CAst;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
|
||||
public class CAstRhinoTranslatorFactory implements JavaScriptTranslatorFactory {
|
||||
|
||||
public TranslatorToCAst make(CAst ast, ModuleEntry M, URL sourceURL, String localFileName) {
|
||||
return new CAstRhinoTranslator(M);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.ibm.wala.js.rhino;
|
||||
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends Plugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "com.ibm.wala.js.rhino";
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
|
@ -23,10 +23,6 @@ public class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
|
|||
justThisTest(TestAjaxsltCallGraphShape.class);
|
||||
}
|
||||
|
||||
public void setUp() {
|
||||
Util.setTranslatorFactory(new JavaScriptTranslatorFactory.CAstRhinoFactory());
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForAjaxslt = new Object[][] {
|
||||
|
||||
};
|
||||
|
|
|
@ -23,10 +23,6 @@ public class TestMediawikiCallGraphShape extends TestJSCallGraphShape {
|
|||
justThisTest(TestMediawikiCallGraphShape.class);
|
||||
}
|
||||
|
||||
public void setUp() {
|
||||
Util.setTranslatorFactory(new JavaScriptTranslatorFactory.CAstRhinoFactory());
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForSwineFlu = new Object[][] {
|
||||
|
||||
};
|
||||
|
|
|
@ -23,10 +23,6 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
justThisTest(TestSimpleCallGraphShape.class);
|
||||
}
|
||||
|
||||
public void setUp() {
|
||||
Util.setTranslatorFactory(new JavaScriptTranslatorFactory.CAstRhinoFactory());
|
||||
}
|
||||
|
||||
protected static final Object[][] assertionsForSimple = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/simple.js" } },
|
||||
new Object[] {
|
||||
|
|
|
@ -23,10 +23,6 @@ public class TestSimplePageCallGraphShape extends TestJSCallGraphShape {
|
|||
justThisTest(TestSimplePageCallGraphShape.class);
|
||||
}
|
||||
|
||||
public void setUp() {
|
||||
Util.setTranslatorFactory(new JavaScriptTranslatorFactory.CAstRhinoFactory());
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForPage1 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "page1.html" } },
|
||||
new Object[] { "page1.html",
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="src" path="dat"/>
|
||||
<classpathentry exported="true" kind="lib" path="bin" sourcepath="bin"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/js.jar" sourcepath="com.ibm.wala.cast.jssrc.zip"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xalan.jar" sourcepath="com.ibm.wala.cast.jssrc.zip"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -20,73 +20,7 @@ Export-Package: com.ibm.wala.cast.js,
|
|||
com.ibm.wala.cast.js.ssa,
|
||||
com.ibm.wala.cast.js.translator,
|
||||
com.ibm.wala.cast.js.types,
|
||||
com.ibm.wala.cast.js.util,
|
||||
java_cup.runtime,
|
||||
org.apache.bcel,
|
||||
org.apache.bcel.classfile,
|
||||
org.apache.bcel.generic,
|
||||
org.apache.bcel.util,
|
||||
org.apache.bcel.verifier,
|
||||
org.apache.bcel.verifier.exc,
|
||||
org.apache.bcel.verifier.statics,
|
||||
org.apache.bcel.verifier.structurals,
|
||||
org.apache.regexp,
|
||||
org.apache.xalan,
|
||||
org.apache.xalan.client,
|
||||
org.apache.xalan.extensions,
|
||||
org.apache.xalan.lib,
|
||||
org.apache.xalan.lib.sql,
|
||||
org.apache.xalan.processor,
|
||||
org.apache.xalan.res,
|
||||
org.apache.xalan.serialize,
|
||||
org.apache.xalan.templates,
|
||||
org.apache.xalan.trace,
|
||||
org.apache.xalan.transformer,
|
||||
org.apache.xalan.xslt,
|
||||
org.apache.xalan.xsltc,
|
||||
org.apache.xalan.xsltc.cmdline,
|
||||
org.apache.xalan.xsltc.cmdline.getopt,
|
||||
org.apache.xalan.xsltc.compiler,
|
||||
org.apache.xalan.xsltc.compiler.util,
|
||||
org.apache.xalan.xsltc.dom,
|
||||
org.apache.xalan.xsltc.runtime,
|
||||
org.apache.xalan.xsltc.runtime.output,
|
||||
org.apache.xalan.xsltc.trax,
|
||||
org.apache.xalan.xsltc.util,
|
||||
org.apache.xml.dtm,
|
||||
org.apache.xml.dtm.ref,
|
||||
org.apache.xml.dtm.ref.dom2dtm,
|
||||
org.apache.xml.dtm.ref.sax2dtm,
|
||||
org.apache.xml.res,
|
||||
org.apache.xml.utils,
|
||||
org.apache.xml.utils.res,
|
||||
org.apache.xpath,
|
||||
org.apache.xpath.axes,
|
||||
org.apache.xpath.compiler,
|
||||
org.apache.xpath.domapi,
|
||||
org.apache.xpath.functions,
|
||||
org.apache.xpath.jaxp,
|
||||
org.apache.xpath.objects,
|
||||
org.apache.xpath.operations,
|
||||
org.apache.xpath.patterns,
|
||||
org.apache.xpath.res,
|
||||
org.mozilla.classfile,
|
||||
org.mozilla.javascript,
|
||||
org.mozilla.javascript.continuations,
|
||||
org.mozilla.javascript.debug,
|
||||
org.mozilla.javascript.jdk11,
|
||||
org.mozilla.javascript.jdk13,
|
||||
org.mozilla.javascript.optimizer,
|
||||
org.mozilla.javascript.regexp,
|
||||
org.mozilla.javascript.serialize,
|
||||
org.mozilla.javascript.tools,
|
||||
org.mozilla.javascript.tools.debugger,
|
||||
org.mozilla.javascript.tools.debugger.downloaded,
|
||||
org.mozilla.javascript.tools.idswitch,
|
||||
org.mozilla.javascript.tools.jsc,
|
||||
org.mozilla.javascript.tools.shell,
|
||||
org.mozilla.javascript.xml,
|
||||
org.mozilla.javascript.xmlimpl
|
||||
com.ibm.wala.cast.js.util
|
||||
Require-Bundle: com.ibm.wala.cast,
|
||||
com.ibm.wala.core,
|
||||
com.ibm.wala.cast,
|
||||
|
|
|
@ -47,10 +47,6 @@ public class JavaScriptAnalysisEngine extends AbstractAnalysisEngine {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void buildAnalysisScope() {
|
||||
try {
|
||||
if (translatorFactory == null) {
|
||||
translatorFactory = new JavaScriptTranslatorFactory.CAstRhinoFactory();
|
||||
}
|
||||
|
||||
loaderFactory = new JavaScriptLoaderFactory(translatorFactory);
|
||||
|
||||
SourceFileModule[] files = (SourceFileModule[]) moduleFiles.toArray(new SourceFileModule[moduleFiles.size()]);
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.ibm.wala.types.TypeReference;
|
|||
|
||||
public class Util extends com.ibm.wala.cast.ipa.callgraph.Util {
|
||||
|
||||
private static JavaScriptTranslatorFactory translatorFactory = new JavaScriptTranslatorFactory.CAstRhinoFactory();
|
||||
private static JavaScriptTranslatorFactory translatorFactory;
|
||||
|
||||
public static void setTranslatorFactory(JavaScriptTranslatorFactory translatorFactory) {
|
||||
Util.translatorFactory = translatorFactory;
|
||||
|
|
|
@ -20,11 +20,4 @@ public interface JavaScriptTranslatorFactory {
|
|||
|
||||
TranslatorToCAst make(CAst ast, ModuleEntry M, URL sourceURL, String localFileName);
|
||||
|
||||
public static class CAstRhinoFactory implements JavaScriptTranslatorFactory {
|
||||
|
||||
public TranslatorToCAst make(CAst ast, ModuleEntry M, URL sourceURL, String localFileName) {
|
||||
return new CAstRhinoTranslator(M);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue