Skip to content

Commit

Permalink
version to 0.6.0, suit idea 2024.1
Browse files Browse the repository at this point in the history
  • Loading branch information
XenoAmess committed Sep 27, 2024
1 parent 2b32a61 commit 250b4b4
Show file tree
Hide file tree
Showing 16 changed files with 268 additions and 19 deletions.
3 changes: 2 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cd ./shade_asm
call mvnw install
call mvnw clean install
cd ..
set JAVA_HOME=C:\jdk-17\
call gradlew clean buildPlugin
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
plugins {
id 'java'
id "org.jetbrains.intellij" version "1.13.3"
id "org.jetbrains.intellij" version "1.17.4"
}

apply plugin: 'idea'

allprojects {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
compileJava.options.encoding = 'UTF-8'
// kotlin {
// jvmToolchain(17)
// }
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# See https://www.jetbrains.org/intellij/sdk/docs/reference_guide/intellij_artifacts.html
# See https://www.jetbrains.com/intellij-repository/releases/
# See https://www.jetbrains.com/intellij-repository/snapshots/
idea_version=231.8109.175
idea_version=2024.1
#idea_version=211-EAP-SNAPSHOT
#idea_version=181.5540.23
#idea_version=145.258.11
plugin_name=Bytecode Editor(XenoAmess TPM)
systemProp.file.encoding=UTF-8
plugin_version=0.5.0
plugin_version=0.6.0
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sat Sep 21 06:16:57 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion shade_asm
Submodule shade_asm updated 1 files
+2 −2 pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.github.pshirshov.vfs.DisassembledVirtualFile;
import com.intellij.icons.AllIcons;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
Expand Down Expand Up @@ -158,10 +159,10 @@ public void onSuccess() {

FileEditorManager manager = FileEditorManager.getInstance(project);

final String filename = '/' + psiClass.getQualifiedName().replace('.', '/') + ".bc";
final String filename = '/' + psiClass.getQualifiedName().replace('.', '/') + "." + getDisassembleStrategy().getFileNameSuffix();
DisassembledVirtualFile disassembledVirtualFile = new DisassembledVirtualFile(
filename,
JavaClassFileType.INSTANCE,
getDisassembleStrategy().getFileType(),
myByteCode.getBytes(),
psiElement,
virtualFile,
Expand Down Expand Up @@ -215,4 +216,10 @@ private static boolean isMarkedForCompilation(Project project, VirtualFile virtu
return !compilerManager.isUpToDate(compilerManager.createFilesCompileScope(new VirtualFile[]{virtualFile}));
}

@Override
@NotNull
public ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.github.pshirshov.util.IdeaUtils;
import com.github.pshirshov.vfs.DisassembledVirtualFile;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
Expand Down Expand Up @@ -124,4 +125,10 @@ protected OutputStream getExportClassFileDestinationOutputStream(
);
}

@Override
@NotNull
public ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.github.pshirshov.ByteCodeFileEditor;
import com.github.pshirshov.vfs.DisassembledVirtualFile;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -63,4 +64,10 @@ protected OutputStream getExportClassFileDestinationOutputStream(
return this.getVirtualFile().getOriginalClassVirtualFile().getOutputStream(this);
}

@Override
@NotNull
public ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private String tryGetByteCodeNew(@NotNull PsiFile containingFile) {
String res = null;
try {
res = processClassFile(virtualFile.contentsToByteArray());
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
log.error("processClassFile failed", e);
}
return res;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public String getByteCode(@NotNull PsiElement psiElement) {
return processClassFile(classFile.contentsToByteArray());
}
}
} catch (IOException e) {
} catch (Exception e) {
log.error("getByteCode failed", e);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
package com.github.pshirshov.conversion;

import com.intellij.openapi.fileTypes.FileType;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

public interface DisassembleStrategy {

@NotNull
String getName();

@NotNull
Assembler getAssembler();

@NotNull
Disassembler getDisassembler();

@NotNull
String getFileNameSuffix();

@NotNull
FileType getFileType();

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package com.github.pshirshov.conversion;

import com.github.pshirshov.conversion.impl.asm.AsmDisassembler;
import com.github.pshirshov.conversion.impl.asm.AsmFileType;
import com.github.pshirshov.conversion.impl.asm_xml.AsmXmlAssembler;
import com.github.pshirshov.conversion.impl.asm_xml.AsmXmlDisassembler;
import com.github.pshirshov.conversion.impl.asm_xml.AsmXmlFileType;
import com.github.pshirshov.conversion.impl.jasmin.JasminDisassembler;
import com.github.pshirshov.conversion.impl.jasmin.JasminFileType;
import com.github.pshirshov.conversion.impl.krakatau.KrakatauAssembler;
import com.github.pshirshov.conversion.impl.krakatau.KrakatauDisassembler;
import com.github.pshirshov.conversion.impl.krakatau.KrakatauFileType;
import com.intellij.openapi.fileTypes.FileType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
Expand All @@ -20,7 +25,8 @@ public enum DisassembleStrategyEnum implements DisassembleStrategy {
JASMIN(
DisassembleStrategyConstant.STRING_JASMIN,
null,
JasminDisassembler.INSTANCE
JasminDisassembler.INSTANCE,
JasminFileType.INSTANCE
),

/**
Expand All @@ -29,7 +35,8 @@ public enum DisassembleStrategyEnum implements DisassembleStrategy {
ASM(
DisassembleStrategyConstant.STRING_ASM,
null,
AsmDisassembler.INSTANCE
AsmDisassembler.INSTANCE,
AsmFileType.INSTANCE
),

/**
Expand All @@ -38,7 +45,8 @@ public enum DisassembleStrategyEnum implements DisassembleStrategy {
ASM_XML(
DisassembleStrategyConstant.STRING_ASM_XML,
AsmXmlAssembler.INSTANCE,
AsmXmlDisassembler.INSTANCE
AsmXmlDisassembler.INSTANCE,
AsmXmlFileType.INSTANCE
),

/**
Expand All @@ -47,7 +55,8 @@ public enum DisassembleStrategyEnum implements DisassembleStrategy {
KRAKATAU(
DisassembleStrategyConstant.STRING_KRAKATAU,
KrakatauAssembler.INSTANCE,
KrakatauDisassembler.INSTANCE
KrakatauDisassembler.INSTANCE,
KrakatauFileType.INSTANCE
);

@Getter
Expand All @@ -62,4 +71,14 @@ public enum DisassembleStrategyEnum implements DisassembleStrategy {
@NotNull
private final Disassembler disassembler;

@Getter
@NotNull
private final FileType fileType;

@NotNull
@Override
public String getFileNameSuffix(){
return this.getName();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.github.pshirshov.conversion.impl.asm;

import com.github.pshirshov.conversion.DisassembleStrategyEnum;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.openapi.fileTypes.FileType;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

import javax.swing.Icon;


public final class AsmFileType implements FileType {
public static final AsmFileType INSTANCE = new AsmFileType();

private AsmFileType() {
}

@Override
public @NotNull String getName() {
return DisassembleStrategyEnum.ASM.getName();
}

@Override
public @NotNull String getDescription() {
return DisassembleStrategyEnum.ASM.getName();
}

@Override
public @Nls @NotNull String getDisplayName() {
return DisassembleStrategyEnum.ASM.getName();
}

@Override
public @NotNull String getDefaultExtension() {
return DisassembleStrategyEnum.ASM.getFileNameSuffix();
}

@Override
public Icon getIcon() {
return JavaClassFileType.INSTANCE.getIcon();
}

@Override
public boolean isBinary() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.github.pshirshov.conversion.impl.asm_xml;

import com.github.pshirshov.conversion.DisassembleStrategyEnum;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.openapi.fileTypes.FileType;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

import javax.swing.Icon;


public final class AsmXmlFileType implements FileType {
public static final AsmXmlFileType INSTANCE = new AsmXmlFileType();

private AsmXmlFileType() {
}

@Override
public @NotNull String getName() {
return DisassembleStrategyEnum.ASM_XML.getName();
}

@Override
public @NotNull String getDescription() {
return DisassembleStrategyEnum.ASM_XML.getName();
}

@Override
public @Nls @NotNull String getDisplayName() {
return DisassembleStrategyEnum.ASM_XML.getName();
}

@Override
public @NotNull String getDefaultExtension() {
return DisassembleStrategyEnum.ASM_XML.getFileNameSuffix();
}

@Override
public Icon getIcon() {
return JavaClassFileType.INSTANCE.getIcon();
}

@Override
public boolean isBinary() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.github.pshirshov.conversion.impl.jasmin;

import com.github.pshirshov.conversion.DisassembleStrategyEnum;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.openapi.fileTypes.FileType;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

import javax.swing.Icon;


public final class JasminFileType implements FileType {
public static final JasminFileType INSTANCE = new JasminFileType();

private JasminFileType() {
}

@Override
public @NotNull String getName() {
return DisassembleStrategyEnum.JASMIN.getName();
}

@Override
public @NotNull String getDescription() {
return DisassembleStrategyEnum.JASMIN.getName();
}

@Override
public @Nls @NotNull String getDisplayName() {
return DisassembleStrategyEnum.JASMIN.getName();
}

@Override
public @NotNull String getDefaultExtension() {
return DisassembleStrategyEnum.JASMIN.getFileNameSuffix();
}

@Override
public Icon getIcon() {
return JavaClassFileType.INSTANCE.getIcon();
}

@Override
public boolean isBinary() {
return true;
}
}
Loading

0 comments on commit 250b4b4

Please sign in to comment.