Commit e03954fe authored by Andrey Loskutov's avatar Andrey Loskutov

Updated to asm 6.0, fixed build after project move

parent 7323d7a7
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry combineaccessrules="false" kind="src" path="/asm3"/>
<classpathentry kind="src" path="src"/>
<classpathentry excluding="JCL/" kind="src" path="test"/>
<classpathentry exported="true" kind="lib" path="lib/asm-6.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/asm-analysis-6.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/asm-commons-6.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/asm-tree-6.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/asm-util-6.0.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible" pattern="**/jdt/internal/**"/>
......
output
doc
.fbwarnings
/bin/
/lib/
......@@ -2,16 +2,20 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bytecode Outline
Bundle-SymbolicName: de.loskutov.BytecodeOutline;singleton:=true
Bundle-Version: 2.5.0
Bundle-Version: 2.5.0.qualifier
Bundle-ClassPath: .,
lib/asm-debug-all.jar
lib/asm-6.0.jar,
lib/asm-analysis-6.0.jar,
lib/asm-commons-6.0.jar,
lib/asm-tree-6.0.jar,
lib/asm-util-6.0.jar
Bundle-Activator: de.loskutov.bco.BytecodeOutlinePlugin
Bundle-Vendor: Andrey Loskutov
Require-Bundle: org.eclipse.ui,
org.eclipse.ui.editors,
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.jdt.core;bundle-version="3.6.0",
org.eclipse.jdt.core;bundle-version="3.13.0",
org.eclipse.ui.workbench.texteditor,
org.eclipse.jdt.ui,
org.eclipse.ui.ide,
......
......@@ -7,14 +7,17 @@ bin.includes = LICENSE.txt,\
about.html,\
.project,\
.settings/,\
lib/asm-debug-all.jar,\
about.ini,\
about.properties,\
about32.png
about32.png,\
lib/asm-6.0.jar,\
lib/asm-analysis-6.0.jar,\
lib/asm-commons-6.0.jar,\
lib/asm-tree-6.0.jar,\
lib/asm-util-6.0.jar
jars.compile.order = .
source.. = src/,\
test/
output.. = bin/
jre.compilation.profile = J2SE-1.5
......@@ -3,7 +3,6 @@
<!-- defines the location of the asm project via asm.project.dir -->
<property file="${user.home}/asm-build.properties"/>
<!-- TODO right now we define bco.version/plugin.id here, but we shall read it from MANIFEST.MF -->
<property file="build.properties"/>
<!-- defines product.version from asm etc -->
......@@ -23,11 +22,29 @@
<fileset dir="${saxon.home}" includes="*.jar"/>
</path>
<target name="init">
<tstamp><format property="plugin.date" pattern="yyyyMMddHHmm" /></tstamp>
<target name="get-git-revision">
<exec executable="git" spawn="false" outputproperty="git.revision">
<arg value="log"/>
<arg value="--pretty=format:%h"/>
<arg value="-n"/>
<arg value="1"/>
</exec>
<echo>Got git revision ${git.revision}</echo>
</target>
<target name="init" depends="getasm,get-git-revision">
<property name="plugin.qualifier" value="${plugin.date}-${git.revision}" />
<!-- read plugin base version from META-INF/MANIFEST.MF to ${pluginVersion} -->
<loadfile srcFile="${basedir}/META-INF/MANIFEST.MF" property="bco.version">
<loadfile srcFile="${basedir}/META-INF/MANIFEST.MF" property="plugin.version">
<filterchain>
<tokenfilter><containsregex pattern="Bundle-Version: (.*)" replace="\1"/></tokenfilter>
<tokenfilter>
<containsregex pattern="Bundle-Version: (.*)" replace="\1"/>
</tokenfilter>
<tokenfilter>
<replacestring from="qualifier" to="${plugin.qualifier}"/>
</tokenfilter>
<deletecharacters chars=" \n\r"/>
</filterchain>
</loadfile>
......@@ -39,21 +56,105 @@
<deletecharacters chars=" \n\r"/>
</filterchain>
</loadfile>
<property name="plugin.jar" value="${plugin.id}_${bco.version}.jar"/>
<property name="feature.jar" value="${plugin.id}.feature_${bco.version}.jar"/>
<property name="plugin.jar" value="${plugin.id}_${plugin.version}.jar"/>
<property name="feature.jar" value="${plugin.id}.feature_${plugin.version}.jar"/>
<condition property="asm.recompile" >
<not><available file="${asm.jar}" /></not>
</condition>
</target>
<scriptdef name="getAndCheckLibrary" language="javascript">
<attribute name="url"/>
<attribute name="path"/>
<attribute name="checksum"/>
<![CDATA[
var URL = Java.type("java.net.URL");
var File = Java.type("java.io.File");
var path = attributes.get("path");
var url = attributes.get("url");
var checksum = attributes.get("checksum");
print(path + " / " + url + " : " + checksum);
var file = new File(path);
check = project.createTask("checksum");
check.setFile(file);
check.setProperty(checksum);
check.setVerifyproperty("check.result");
result = false;
if(file.exists()){
print("File exists, verifying checksum...")
result = check.eval();
if(!result){
check = project.createTask("checksum");
check.setFile(file);
check.setProperty("fileChecksum");
check.execute();
print("expected: " + checksum + ", actual: " + project.getProperty("fileChecksum"))
print("Checksum check failed, deleting!")
file.delete();
} else {
print("Checksum check succeeded!")
}
}
if(result == false){
print("Downloading file...")
get = project.createTask("get");
get.setSrc(new URL(url));
get.setDest(file)
get.perform();
result = check.eval();
if(!result ){
fail = project.createTask("fail");
fail.setMessage("Download and checksum check failed for: " + path);
fail.perform();
}
}
]]>
</scriptdef>
<target name="getasm" >
<property name="asmRoot" value="https://repository.ow2.org/nexus/service/local/repositories/releases/content/org/ow2/asm" />
<property name="asmVersion" value="6.0" />
<mkdir dir="${lib}"/>
<getAndCheckLibrary
url="${asmRoot}/asm/${asmVersion}/asm-${asmVersion}.jar"
path="${lib}/asm-${asmVersion}.jar"
checksum="305b31315dbca9c3cddac687b4a0e04c"
/>
<getAndCheckLibrary
url="${asmRoot}/asm-analysis/${asmVersion}/asm-analysis-${asmVersion}.jar"
path="${lib}/asm-analysis-${asmVersion}.jar"
checksum="78d854d5bf870b360e2dc8414a6a8799"
/>
<getAndCheckLibrary
url="${asmRoot}/asm-commons/${asmVersion}/asm-commons-${asmVersion}.jar"
path="${lib}/asm-commons-${asmVersion}.jar"
checksum="cbe9c8e4ed2a7e27de503b43f6dc4d61"
/>
<getAndCheckLibrary
url="${asmRoot}/asm-tree/${asmVersion}/asm-tree-${asmVersion}.jar"
path="${lib}/asm-tree-${asmVersion}.jar"
checksum="076f7668703c07ff671837ad17f59ea1"
/>
<getAndCheckLibrary
url="${asmRoot}/asm-util/${asmVersion}/asm-util-${asmVersion}.jar"
path="${lib}/asm-util-${asmVersion}.jar"
checksum="ddd94acc28c09f938523c9f440cd97cc"
/>
</target>
<!-- Trigger (re-)compilation of asm-debug-all.jar, if it is is not available -->
<target name="asmcompile" if="asm.recompile" >
<echo message="Building ASM core libraries"/>
<echo message="TODO Building ASM core libraries"/>
<!--
<ant dir="${asm.project.dir}" inheritall="false" target="jar" >
<property name="product.noshrink" value="true"/>
</ant>
<copy tofile="${asm.jar}" preservelastmodified="true" file="${asm-debug-all.jar}" />
-->
</target>
<!-- use it to force recompilation of asm core libraries -->
......@@ -76,17 +177,27 @@
</target>
<target name="jars" depends="compile">
<copy todir="${out.build}">
<copy todir="${out.build}" overwrite="true">
<fileset dir="${src}">
<include name="**/*.properties"/>
</fileset>
</copy>
<filterset id="version.filter">
<filter token="PLUGIN_VERSION" value="${bco.version}" />
<filter token="FEATURE_VERSION" value="${bco.version}" />
<!-- set the values for plugin.version -->
<filterset id="version.filter">
<filter token="PLUGIN_VERSION" value="${plugin.version}" />
<filter token="FEATURE_VERSION" value="${plugin.version}" />
</filterset>
<echo>plugin qualifier ${plugin.qualifier}</echo>
<echo>plugin version ${plugin.version}</echo>
<!-- Copy META-INF/MANIFEST.MF to ${out.dir}, "qualifier" to current version -->
<copy file="META-INF/MANIFEST.MF" toFile="${out.build}/META-INF/MANIFEST.MF" overwrite="true">
<filterset begintoken="q" endtoken="r"><filter token="ualifie" value="${plugin.qualifier}"/></filterset>
</copy>
<mkdir dir="${out}/site"/>
<copy todir="${out}/site">
<copy todir="${out}/site" overwrite="true">
<fileset dir="${basedir}/site">
<include name="**/*.xml"/>
</fileset>
......@@ -119,7 +230,6 @@
<zip zipfile="${out}/${plugin.jar}">
<zipfileset dir="${out}" includes="BytecodeOutlinesrc.zip"/>
<fileset dir=".">
<include name="META-INF/MANIFEST.MF"/>
<include name="icons/**/*"/>
<include name="plugin.xml"/>
<include name="about.html"/>
......@@ -129,9 +239,9 @@
<include name="*.txt"/>
<include name="lib/*.jar"/>
</fileset>
<fileset dir="${out.build}">
<include name="**/*"/>
</fileset>
<fileset dir="${out.build}">
<include name="**/*"/>
</fileset>
<zipfileset dir="${out}/doc" includes="toc.xml,opcodes.html,ref-*.html" prefix="doc"/>
</zip>
</target>
......@@ -142,8 +252,8 @@
</jar>
</target>
<target name="site" depends="feature">
<zip zipfile="${out}/${plugin.id}.update_${bco.version}.zip">
<target name="site" depends="cleanOutput,feature">
<zip zipfile="${out}/${plugin.id}.update_${plugin.version}.zip">
<zipfileset dir="${out}/site" includes="site.xml"/>
<zipfileset dir="${out}" includes="${feature.jar}" prefix="features"/>
<zipfileset dir="${out}" includes="${plugin.jar}" prefix="plugins"/>
......@@ -156,6 +266,12 @@
<fileset dir="${lib}" includes="**/*"/>
</delete>
</target>
<target name="cleanOutput">
<delete failonerror="false" includeEmptyDirs="true">
<fileset dir="${out}" includes="**/*"/>
</delete>
</target>
<target name="xslt" depends="init">
<mkdir dir="${out}/doc"/>
......
......@@ -39,4 +39,9 @@
<archive path="plugins/de.loskutov.BytecodeOutline_2.4.3.jar" url="http://download.forge.objectweb.org/asm/de.loskutov.BytecodeOutline_2.4.3.jar"/>
<category-def name="Bytecode Outline for Eclipse 3.6-4.4" label="Bytecode Outline for Eclipse 3.6-4.4"/>
<feature url="features/de.loskutov.BytecodeOutline.feature_@FEATURE_VERSION@.jar" id="de.loskutov.BytecodeOutline.feature" version="@FEATURE_VERSION@">
<category name="Bytecode Outline for Eclipse 4.7-4.8"/>
</feature>
<category-def name="Bytecode Outline for Eclipse 4.7-4.8" label="Bytecode Outline for Eclipse 4.7-4.8"/>
</site>
......@@ -35,7 +35,7 @@ public class CommentedASMifierClassVisitor extends ASMifier implements ICommente
protected final boolean showLocals;
protected final boolean showStackMap;
private final DecompilerOptions options;
private String javaVersion;
private JavaVersion javaVersion;
private int accessFlags;
private LabelNode currentLabel;
private int currentInsn;
......@@ -45,7 +45,7 @@ public class CommentedASMifierClassVisitor extends ASMifier implements ICommente
private final ClassNode classNode;
private CommentedASMifierClassVisitor(ClassNode classNode, final DecompilerOptions options, String name, int id) {
super(Opcodes.ASM5, name, id);
super(Opcodes.ASM6, name, id);
this.classNode = classNode;
this.options = options;
showLines = options.modes.get(BCOConstants.F_SHOW_LINE_INFO);
......@@ -85,13 +85,7 @@ public class CommentedASMifierClassVisitor extends ASMifier implements ICommente
super.visit(version, access, name1, signature, superName, interfaces);
}
this.className = name;
int major = version & 0xFFFF;
//int minor = version >>> 16;
// 1.1 is 45, 1.2 is 46 etc.
int javaV = major % 44;
if (javaV > 0 && javaV < 10) {
javaVersion = "1." + javaV;
}
javaVersion = new JavaVersion(version);
this.accessFlags = access;
}
......@@ -326,7 +320,7 @@ public class CommentedASMifierClassVisitor extends ASMifier implements ICommente
private ASMifier getDummyVisitor(){
if (dummyAnnVisitor == null) {
dummyAnnVisitor = new ASMifier(Opcodes.ASM5, "", -1) {
dummyAnnVisitor = new ASMifier(Opcodes.ASM6, "", -1) {
@Override
public void visitAnnotationEnd() {
text.clear();
......
......@@ -34,7 +34,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
private DecompiledMethod currMethod;
private String className;
private String javaVersion;
private JavaVersion javaVersion;
private int accessFlags;
private Textifier dummyAnnVisitor;
private final ClassNode classNode;
......@@ -44,7 +44,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
private int currentInsn;
public CommentedClassVisitor(ClassNode classNode, final DecompilerOptions options) {
super(Opcodes.ASM5);
super(Opcodes.ASM6);
this.classNode = classNode;
this.options = options;
raw = !options.modes.get(BCOConstants.F_SHOW_RAW_BYTECODE);
......@@ -52,7 +52,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
showLocals = options.modes.get(BCOConstants.F_SHOW_VARIABLES);
showStackMap = options.modes.get(BCOConstants.F_SHOW_STACKMAP);
showHex = options.modes.get(BCOConstants.F_SHOW_HEX_VALUES);
javaVersion = "?";
javaVersion = new JavaVersion(0);
}
private boolean decompilingEntireClass() {
......@@ -66,15 +66,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
super.visit(version, access, name, signature, superName, interfaces);
}
this.className = name;
int major = version & 0xFFFF;
//int minor = version >>> 16;
// 1.1 is 45, 1.2 is 46 etc.
int javaV = major % 44;
if (javaV > 0) {
javaVersion = "1." + javaV;
} else {
javaVersion = "? " + major;
}
javaVersion = new JavaVersion(version);
this.accessFlags = access;
}
......@@ -581,7 +573,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
private Textifier getDummyVisitor(){
if (dummyAnnVisitor == null) {
dummyAnnVisitor = new Textifier(Opcodes.ASM5) {
dummyAnnVisitor = new Textifier(Opcodes.ASM6) {
@Override
public void visitAnnotationEnd() {
text.clear();
......
......@@ -426,6 +426,6 @@ public class DecompiledClass {
}
public String getJavaVersion() {
return classInfo.javaVersion;
return classInfo.javaVersion.humanReadable();
}
}
......@@ -9,16 +9,13 @@ package de.loskutov.bco.asm;
public class DecompiledClassInfo {
/**
* Major.minor or ?
*/
public final String javaVersion;
public final JavaVersion javaVersion;
public final int accessFlags;
public final int major;
public DecompiledClassInfo(String javaVersion, int accessFlags) {
public DecompiledClassInfo(JavaVersion javaVersion, int accessFlags) {
this.javaVersion = javaVersion;
this.accessFlags = accessFlags;
major = javaVersion.startsWith("1.")? Integer.parseInt(javaVersion.substring(2)) : 0;
major = javaVersion.major;
}
}
......@@ -31,7 +31,7 @@ public class DecompilerHelper {
DecompilerOptions options)
throws IOException, UnsupportedClassVersionError {
ClassReader cr = new ClassReader(is);
ClassNode cn = new ClassNode(Opcodes.ASM5);
ClassNode cn = new ClassNode(Opcodes.ASM6);
int crFlags = 0;
if(options.modes.get(BCOConstants.F_EXPAND_STACKMAP)) {
crFlags |= ClassReader.EXPAND_FRAMES;
......
package de.loskutov.bco.asm;
public class JavaVersion {
private final int version;
public final int major;
public final int minor;
public JavaVersion(int version) {
this.version = version;
major = version & 0xFFFF;
minor = version >>> 16;
}
public String humanReadable() {
// 1.1 is 45, 1.2 is 46 etc.
int javaV = major % 44;
String javaVersion;
if (javaV > 0) {
if(javaV > 8) {
javaVersion = javaV + "." + minor;
} else {
javaVersion = "1." + javaV;
}
} else {
javaVersion = "? " + major;
}
return javaVersion;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment