Create new com.ibm.wala.cast.java.ecj project.

The new project only depends on the minimal Eclipse plugins to make the
ECJ frontend work.  Hence, it should be amenable to creating a Maven
Central jar.
This commit is contained in:
Manu Sridharan 2016-05-24 11:39:00 +02:00
parent 94a4c5277f
commit 8129d960b9
21 changed files with 121 additions and 28 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.ecj</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>

View File

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -0,0 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA CAst Java ECJ frontend
Bundle-SymbolicName: com.ibm.wala.cast.java.ecj
Bundle-Version: 1.3.10.qualifier
Bundle-Vendor: IBM
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.ibm.wala.cast.java,
com.ibm.wala.core,
org.eclipse.core.runtime,
org.eclipse.jdt.core,
com.ibm.wala.cast,
com.ibm.wala.shrike
Export-Package: com.ibm.wala.cast.java.client,
com.ibm.wala.cast.java.translator.jdt

View File

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>WALA</artifactId>
<groupId>com.ibm.wala</groupId>
<version>1.3.10-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.ecj</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -1,4 +1,4 @@
package com.ibm.wala.ide.util;
package com.ibm.wala.cast.java.ecj.util;
import java.io.File;
import java.io.IOException;

View File

@ -0,0 +1,40 @@
package com.ibm.wala.cast.java.translator.jdt.ejc;
import java.io.IOException;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.ClassLoaderImpl;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class ECJClassLoaderFactory extends ClassLoaderFactoryImpl {
public ECJClassLoaderFactory(SetOfClasses exclusions) {
super(exclusions);
}
// TODO remove code duplication with JDTClassLoaderFactory
@Override
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent,
AnalysisScope scope) throws IOException {
if (classLoaderReference.equals(JavaSourceAnalysisScope.SOURCE)) {
ClassLoaderImpl cl = makeSourceLoader(classLoaderReference, cha, parent);
cl.init(scope.getModules(classLoaderReference));
return cl;
} else {
return super.makeNewClassLoader(classLoaderReference, cha, parent, scope);
}
}
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent)
throws IOException {
return new ECJSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, false);
}
}

View File

@ -25,6 +25,7 @@ Require-Bundle: com.ibm.wala.cast.java.test;bundle-version="1.0.0",
org.eclipse.ui.ide,
org.eclipse.ui.ide.application,
org.eclipse.ant.launching,
org.eclipse.jdt.launching.macosx;resolution:=optional
org.eclipse.jdt.launching.macosx;resolution:=optional,
com.ibm.wala.cast.java.ecj
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

View File

@ -18,10 +18,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.pde.core,
org.eclipse.ui.ide,
org.eclipse.jdt.launching,
org.eclipse.jdt
org.eclipse.jdt,
com.ibm.wala.cast.java.ecj
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.ibm.wala.cast.java.client,
com.ibm.wala.cast.java.translator.jdt,
com.ibm.wala.ide.jdt,
com.ibm.wala.ide.util

View File

@ -58,6 +58,7 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import com.ibm.wala.cast.java.translator.Java2IRTranslator;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator;
import com.ibm.wala.classLoader.DirectoryTreeModule;
import com.ibm.wala.classLoader.JarFileModule;
import com.ibm.wala.classLoader.Module;

View File

@ -1,24 +0,0 @@
package com.ibm.wala.cast.java.translator.jdt.ejc;
import java.io.IOException;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.cast.java.translator.jdt.JDTClassLoaderFactory;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class ECJClassLoaderFactory extends JDTClassLoaderFactory {
public ECJClassLoaderFactory(SetOfClasses exclusions) {
super(exclusions);
}
@Override
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent)
throws IOException {
return new ECJSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, dump);
}
}

View File

@ -31,6 +31,8 @@
<module>com.ibm.wala.cast.java</module>
<module>com.ibm.wala.cast.java.test</module>
<module>com.ibm.wala.cast.java.test.data</module>
<module>com.ibm.wala.cast.java.ecj</module>
<module>com.ibm.wala.ide-feature</module>
<module>com.ibm.wala.ide</module>