forked from cpupk/ecd
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#7: Removed JD-Core native binaries and updated to jd-core 0.7.1
- Loading branch information
Showing
21 changed files
with
1,527 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
766 changes: 677 additions & 89 deletions
766
org.sf.feeling.decompiler.jd.feature/feature.properties
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ output.. = bin/ | |
bin.includes = META-INF/,\ | ||
.,\ | ||
plugin.xml,\ | ||
icons/ | ||
icons/,\ | ||
lib/ | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
58 changes: 0 additions & 58 deletions
58
org.sf.feeling.decompiler.jd/src/jd/ide/eclipse/JavaDecompilerPlugin.java
This file was deleted.
Oops, something went wrong.
210 changes: 122 additions & 88 deletions
210
org.sf.feeling.decompiler.jd/src/jd/ide/eclipse/editors/JDSourceMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,122 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Chen Chao and other ECD project contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*******************************************************************************/ | ||
|
||
package jd.ide.eclipse.editors; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import org.eclipse.core.runtime.FileLocator; | ||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.core.runtime.Platform; | ||
import org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper; | ||
import org.sf.feeling.decompiler.util.UIUtil; | ||
|
||
public abstract class JDSourceMapper extends BaseDecompilerSourceMapper | ||
{ | ||
|
||
protected final static String JAR_SUFFIX = ".jar"; //$NON-NLS-1$ | ||
protected final static String ZIP_SUFFIX = ".zip"; //$NON-NLS-1$ | ||
protected final static String JAVA_CLASS_SUFFIX = ".class"; //$NON-NLS-1$ | ||
protected final static String JAVA_SOURCE_SUFFIX = ".java"; //$NON-NLS-1$ | ||
protected final static int JAVA_SOURCE_SUFFIX_LENGTH = 5; | ||
protected static boolean loaded = false; | ||
|
||
public JDSourceMapper( IPath sourcePath, String rootPath ) | ||
{ | ||
super( sourcePath, rootPath ); | ||
} | ||
|
||
public native String decompile( String baseName, String qualifiedName ); | ||
|
||
protected void loadLibrary( ) throws IOException | ||
{ | ||
if ( loaded == false ) | ||
{ | ||
System.load( getLibraryPath( ) ); | ||
loaded = true; | ||
} | ||
} | ||
|
||
protected String getLibraryPath( ) throws IOException | ||
{ | ||
URL pluginUrl = null; | ||
if ( Platform.OS_WIN32.equalsIgnoreCase( Platform.getOS( ) ) ) | ||
{ | ||
if ( Platform.ARCH_X86_64.equalsIgnoreCase( Platform.getOSArch( ) ) ) | ||
{ | ||
pluginUrl = this.getClass( ).getResource( "/native/jd-core/win32/x86_64/jd-eclipse.dll" ); //$NON-NLS-1$ | ||
} | ||
else | ||
{ | ||
pluginUrl = this.getClass( ).getResource( "/native/jd-core/win32/x86/jd-eclipse.dll" ); //$NON-NLS-1$ | ||
} | ||
} | ||
else if ( Platform.OS_LINUX.equalsIgnoreCase( Platform.getOS( ) ) ) | ||
{ | ||
if ( Platform.ARCH_X86_64.equalsIgnoreCase( Platform.getOSArch( ) ) ) | ||
{ | ||
pluginUrl = this.getClass( ).getResource( "/native/jd-core/linux/x86_64/libjd-eclipse.so" ); //$NON-NLS-1$ | ||
} | ||
else | ||
{ | ||
pluginUrl = this.getClass( ).getResource( "/native/jd-core/linux/x86/libjd-eclipse.so" ); //$NON-NLS-1$ | ||
} | ||
} | ||
else if ( Platform.OS_MACOSX.equalsIgnoreCase( Platform.getOS( ) ) ) | ||
{ | ||
if ( Platform.ARCH_X86_64.equalsIgnoreCase( Platform.getOSArch( ) ) ) | ||
{ | ||
pluginUrl = this.getClass( ).getResource( "/native/jd-core/macosx/x86_64/libjd-eclipse.jnilib" ); //$NON-NLS-1$ | ||
} | ||
else | ||
{ | ||
pluginUrl = this.getClass( ).getResource( "/native/jd-core/macosx/x86/libjd-eclipse.jnilib" ); //$NON-NLS-1$ | ||
} | ||
} | ||
String path = FileLocator.toFileURL( pluginUrl ).getFile( ); | ||
if ( UIUtil.isWin32( ) && path != null && ( path.length( ) > 0 ) && ( path.charAt( 0 ) == '/' ) ) | ||
path = path.substring( 1 ); | ||
|
||
return path; | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2008-2015 Emmanuel Dupuy | ||
* This program is made available under the terms of the GPLv3 License. | ||
*/ | ||
|
||
package jd.ide.eclipse.editors; | ||
|
||
import java.io.File; | ||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.core.runtime.Status; | ||
import org.eclipse.jface.preference.IPreferenceStore; | ||
import org.sf.feeling.decompiler.JavaDecompilerPlugin; | ||
import org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper; | ||
|
||
import jd.commonide.IdeDecompiler; | ||
import jd.commonide.preferences.IdePreferences; | ||
|
||
|
||
/** | ||
* JDSourceMapper | ||
* | ||
* @project Java Decompiler Eclipse Plugin | ||
* @version 0.1.4 | ||
* @see org.eclipse.jdt.internal.core.SourceMapper | ||
*/ | ||
@SuppressWarnings("restriction") | ||
public abstract class JDSourceMapper extends BaseDecompilerSourceMapper | ||
{ | ||
private final static String JAVA_CLASS_SUFFIX = ".class"; | ||
private final static String JAVA_SOURCE_SUFFIX = ".java"; | ||
private final static int JAVA_SOURCE_SUFFIX_LENGTH = 5; | ||
|
||
private File basePath; | ||
|
||
@SuppressWarnings("rawtypes") | ||
public JDSourceMapper( | ||
File basePath, IPath sourcePath, String sourceRootPath, Map options) | ||
{ | ||
super(sourcePath, sourceRootPath, options); | ||
this.basePath = basePath; | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
public char[] findSource(String javaSourcePath) | ||
{ | ||
char[] source = null; | ||
|
||
// Search source file | ||
if (this.rootPaths == null) | ||
{ | ||
source = super.findSource(javaSourcePath); | ||
} | ||
else | ||
{ | ||
Iterator iterator = this.rootPaths.iterator(); | ||
while (iterator.hasNext() && (source == null)) | ||
{ | ||
String sourcesRootPath = (String)iterator.next(); | ||
source = super.findSource( | ||
sourcesRootPath + IPath.SEPARATOR + javaSourcePath); | ||
} | ||
} | ||
|
||
if ((source == null) && javaSourcePath.endsWith(JAVA_SOURCE_SUFFIX)) | ||
{ | ||
String classPath = javaSourcePath.substring( | ||
0, javaSourcePath.length()-JAVA_SOURCE_SUFFIX_LENGTH) + JAVA_CLASS_SUFFIX; | ||
|
||
// Decompile class file | ||
try | ||
{ | ||
String result = decompile(this.basePath.getAbsolutePath(), classPath); | ||
if (result != null) | ||
source = result.toCharArray(); | ||
} | ||
catch (Exception e) | ||
{ | ||
JavaDecompilerPlugin.getDefault().getLog().log(new Status( | ||
Status.ERROR, JavaDecompilerPlugin.PLUGIN_ID, | ||
0, e.getMessage(), e)); | ||
} | ||
} | ||
|
||
return source; | ||
} | ||
|
||
/** | ||
* @param basePath Path to the root of the classpath, either a | ||
* path to a directory or a path to a jar file. | ||
* @param internalClassName internal name of the class. | ||
* @return Decompiled class text. | ||
*/ | ||
public String decompile(String basePath, String classPath) { | ||
// Load preferences | ||
IPreferenceStore store = JavaDecompilerPlugin.getDefault().getPreferenceStore(); | ||
|
||
boolean showDefaultConstructor = false; //currently unused : store.getBoolean(JavaDecompilerPlugin.PREF_SHOW_DEFAULT_CONSTRUCTOR); | ||
boolean realignmentLineNumber = store.getBoolean(JavaDecompilerPlugin.ALIGN); | ||
boolean showPrefixThis = false; //currently unused : store.getBoolean(JavaDecompilerPlugin.PREF_OMIT_PREFIX_THIS); | ||
boolean mergeEmptyLines = false; | ||
boolean unicodeEscape = false; //currently unused : store.getBoolean(JavaDecompilerPlugin.PREF_ESCAPE_UNICODE_CHARACTERS); | ||
boolean showLineNumbers = store.getBoolean(JavaDecompilerPlugin.PREF_DISPLAY_LINE_NUMBERS); | ||
boolean showMetadata = store.getBoolean(JavaDecompilerPlugin.PREF_DISPLAY_METADATA); | ||
|
||
// Create preferences | ||
IdePreferences preferences = new IdePreferences( | ||
showDefaultConstructor, realignmentLineNumber, showPrefixThis, | ||
mergeEmptyLines, unicodeEscape, showLineNumbers, showMetadata); | ||
|
||
// Decompile | ||
return IdeDecompiler.decompile(preferences, basePath, classPath); | ||
} | ||
|
||
/** | ||
* @return version of JD-Core | ||
* @since JD-Core 0.7.0 | ||
*/ | ||
public static String getVersion() { return "0.7.1"; } | ||
} |
Binary file removed
BIN
-1.35 MB
org.sf.feeling.decompiler.jd/src/native/jd-core/linux/x86/libjd-eclipse.so
Binary file not shown.
Binary file removed
BIN
-1.46 MB
org.sf.feeling.decompiler.jd/src/native/jd-core/linux/x86_64/libjd-eclipse.so
Binary file not shown.
Binary file removed
BIN
-1.01 MB
org.sf.feeling.decompiler.jd/src/native/jd-core/macosx/x86/libjd-eclipse.jnilib
Binary file not shown.
Binary file removed
BIN
-1.07 MB
org.sf.feeling.decompiler.jd/src/native/jd-core/macosx/x86_64/libjd-eclipse.jnilib
Binary file not shown.
Binary file removed
BIN
-393 KB
org.sf.feeling.decompiler.jd/src/native/jd-core/win32/x86/jd-eclipse.dll
Binary file not shown.
Binary file removed
BIN
-1.36 MB
org.sf.feeling.decompiler.jd/src/native/jd-core/win32/x86_64/jd-eclipse.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.