Updated dependencies. Tests work again. Cosmetics, fixed warnings.

This commit is contained in:
Chris Hodges 2022-08-16 10:54:57 +02:00
parent 5e2099f019
commit 87cca67049
10 changed files with 53 additions and 49 deletions

View File

@ -1,4 +1,4 @@
# MC68000 Assembly Language Plugin [![Build Status](https://travis-ci.com/chrisly42/mc68000-asm-plugin.svg?branch=main)](https://travis-ci.com/chrisly42/mc68000-asm-plugin) [![Coverage Status](https://coveralls.io/repos/github/chrisly42/mc68000-asm-plugin/badge.svg?branch=main&kill_cache=1)](https://coveralls.io/github/chrisly42/mc68000-asm-plugin?branch=main)
# MC68000 Assembly Language Plugin [![Build Status](https://app.travis-ci.com/chrisly42/mc68000-asm-plugin.svg?branch=master)](https://app.travis-ci.com/chrisly42/mc68000-asm-plugin)
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
@ -164,11 +164,12 @@ are appreciated. It really is keeping me motivated to continue development.
## Changelog
### V0.9 (unreleased)
### V0.9 (16-Aug-22)
- Maintenance. Updated all dependencies to the latest versions.
- Bugfix: Fixed condition code for `asr/lsr/lsl`, which is has a different behaviour for V flag than `asl`.
- Bugfix: Fixed 'Unknown op size' exception when uppercase sizes were used.
- Bugfix: Refactoring was broken for newer IDE versions, at least for me, this now works again by unknown magic.
### V0.8 (15-Oct-21)

View File

@ -1,7 +1,7 @@
plugins {
id 'java'
id 'org.jetbrains.intellij' version '1.4.0'
id 'org.jetbrains.kotlin.jvm' version '1.6.20'
id 'org.jetbrains.intellij' version '1.8.0'
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.12.0'
}
@ -22,11 +22,12 @@ repositories {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation "org.assertj:assertj-core:3.22.0"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.assertj:assertj-core:3.23.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
testImplementation 'org.junit.platform:junit-platform-launcher:1.9.0'
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
}
@ -42,27 +43,30 @@ compileTestKotlin {
}
intellij {
setVersion("2021.3.3") // LATEST-EAP-SNAPSHOT
setVersion("2022.2") // LATEST-EAP-SNAPSHOT
setUpdateSinceUntilBuild(false)
// setPlugins(["com.intellij.java"])
}
runPluginVerifier {
ideVersions = ["IC-203.6682.168", "IC-213.7172.25", // 2020.3 - 2021.3.3
ideVersions = ["IC-203.6682.168", "IC-222.3345.118", // 2020.3 - 2022.2
"CL-203.8084.11", // 2020.3
"CL-211.7628.27", // 2021.1
"CL-212.5712.21", // 2021.2
"CL-213.7172.20"] // 2021.3.4
"CL-213.7172.20", // 2021.3.4
"CL-221.5080.224", // 2022.1
"CL-222.3345.126"] // 2022.2
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier"
}
patchPluginXml {
setChangeNotes("""
<h4>V0.9 (07-Apr-22)</h4>
<h4>V0.9 (16-Aug-22)</h4>
<ul>
<li>Maintenance. Updated all dependencies to the latest versions.
<li>Bugfix: Fixed condition code for asr/lsr/lsl, which is has a different behaviour for V flag than asl.
<li>Bugfix: Fixed 'Unknown op size' exception when uppercase sizes were used.
<li>Bugfix: Refactoring was broken for newer IDE versions, at least for me, this now works again by unknown magic.
</ul>
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
""")
@ -75,10 +79,17 @@ test {
testLogging {
events "passed", "skipped", "failed"
}
runIde {
jvmArgs '--add-exports', 'java.base/jdk.internal.vm=ALL-UNNAMED'
}
}
tasks.coveralls {
dependsOn jacocoTestReport
}
jacoco {
toolVersion = '0.8.7'
toolVersion = '0.8.8'
}
jacocoTestReport {

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1074,12 +1074,14 @@ object M68kIsa {
),
IsaData("reset", "Reset External Devices", machine = ALL_MACHINES, isPrivileged = true, hasOps = false, modes = NO_OPS_UNSIZED),
IsaData(
"rte", "Return from Exception",
machine = ALL_MACHINES, isPrivileged = true, hasOps = false,
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
changesControlFlow = true
),
IsaData(
"stop", "Stop",
machine = ALL_MACHINES, isPrivileged = true,
@ -1095,6 +1097,7 @@ object M68kIsa {
),
IsaData("illegal", "Take Illegal Instruction Trap", machine = ALL_MACHINES, hasOps = false, modes = NO_OPS_UNSIZED, changesControlFlow = true),
IsaData(
"trap",
"Trap",
@ -1203,8 +1206,7 @@ object M68kIsa {
null
}
private
val mnemonicLookupMap = isaData.asSequence()
private val mnemonicLookupMap = isaData.asSequence()
.flatMap {
(if (it.conditionCodes.isEmpty()) it.altMnemonics.plus(it.mnemonic) else it.altMnemonics.plus(it.conditionCodes
.map { cc ->

View File

@ -29,7 +29,7 @@ class M68kUnresolvedReferenceInspection : AbstractBaseM68kLocalInspectionTool()
}
override fun visitSymbolReference(symbolReference: M68kSymbolReference) {
val references = symbolReference.references ?: return
val references = symbolReference.references
if (references.isEmpty()) return
val resolve = references.mapNotNull { it as? PsiPolyVariantReference }
.firstNotNullOfOrNull { it.multiResolve(false).ifEmpty { null } }

View File

@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.extension.*;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.junit.runner.Description;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@ -34,8 +35,11 @@ public class LightCodeInsightExtension implements ParameterResolver, AfterTestEx
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
LightCodeInsightFixtureTestCaseWrapper testCase = getWrapper(extensionContext);
Parameter parameter = parameterContext.getParameter();
if (parameter.isAnnotationPresent(MyFixture.class)) return testCase.getMyFixture();
else if (parameter.isAnnotationPresent(MyTestCase.class)) return testCase;
if (parameter.isAnnotationPresent(MyFixture.class)) {
return testCase.getMyFixture();
} else if (parameter.isAnnotationPresent(MyTestCase.class)) {
return testCase;
}
return null;
}
@ -68,14 +72,15 @@ public class LightCodeInsightExtension implements ParameterResolver, AfterTestEx
@Override
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
Throwable[] throwables = new Throwable[1];
Description testDescription = Description.createTestDescription(extensionContext.getRequiredTestClass(), getWrapper(extensionContext).getName());
Runnable runnable = () -> {
try {
TestLoggerFactory.onTestStarted();
invocation.proceed();
TestLoggerFactory.onTestFinished(true);
TestLoggerFactory.onTestFinished(true, testDescription);
} catch (Throwable e) {
TestLoggerFactory.onTestFinished(false);
TestLoggerFactory.onTestFinished(false, testDescription);
throwables[0] = e;
}
};

View File

@ -6,14 +6,13 @@ import com.intellij.mock.MockProjectEx;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.EdtTestUtilKt;
import com.intellij.testFramework.ParsingTestCase;
import com.intellij.testFramework.TestLoggerFactory;
import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.extension.*;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.junit.runner.Description;
import java.io.IOException;
import java.lang.annotation.Annotation;
@ -81,37 +80,22 @@ public class ParsingTestExtension implements ParameterResolver, AfterTestExecuti
@Override
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
Throwable[] throwables = new Throwable[1];
Description testDescription = Description.createTestDescription(extensionContext.getRequiredTestClass(), getWrapper(extensionContext).getName());
Runnable runnable = () -> {
try {
TestLoggerFactory.onTestStarted();
invocation.proceed();
TestLoggerFactory.onTestFinished(true);
} catch (Throwable e) {
TestLoggerFactory.onTestFinished(false);
throwables[0] = e;
}
};
invokeTestRunnable(runnable);
try {
TestLoggerFactory.onTestStarted();
invocation.proceed();
TestLoggerFactory.onTestFinished(true, testDescription);
} catch (Throwable e) {
TestLoggerFactory.onTestFinished(false, testDescription);
throwables[0] = e;
}
if (throwables[0] != null) {
throw throwables[0];
}
}
private static void invokeTestRunnable(@NotNull Runnable runnable) {
IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current();
if (policy != null && !policy.runInDispatchThread()) {
runnable.run();
} else {
EdtTestUtilKt.runInEdtAndWait(() -> {
runnable.run();
return null;
});
}
}
public interface IParsingTestCase {
MockProjectEx getProject();

View File

@ -12,6 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith
abstract class AbstractDocumentationProviderTest : AbstractM68kTest() {
fun generateDocumentation(myFixture: CodeInsightTestFixture): String? {
// FIXME migrate to DocumentationTarget
val docElement = DocumentationManager.getInstance(myFixture.project).findTargetElement(myFixture.editor, myFixture.file)
val provider = DocumentationManager.getProviderFromElement(docElement)

View File

@ -63,7 +63,7 @@ internal class M68kInspectionSuppressorTest : AbstractInspectionTest() {
val quickFixPair = highlightInfos[0].quickFixActionRanges[0]
val intentionActionDescriptor = quickFixPair.first
val element = myFixture.file.findElementAt(quickFixPair.second.startOffset)!!
val suppressQuickFix = intentionActionDescriptor.getOptions(element, myFixture.editor)!!
val suppressQuickFix = intentionActionDescriptor.getOptions(element, myFixture.editor)
.first { it.text == suppressAction }
myFixture.launchAction(suppressQuickFix)
}

View File

@ -103,7 +103,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
assertThat(otherfile.text).isEqualTo("; oh no!")
myFixture.renameElementAtCaret("foobar.asm")
val files = FilenameIndex.getFilesByName(myFixture.project, "foobar.asm", GlobalSearchScope.allScope(myFixture.project))
val files = FilenameIndex.getVirtualFilesByName("foobar.asm", GlobalSearchScope.allScope(myFixture.project))
assertThat(files).hasSize(1)
assertThat(file.text).isEqualToIgnoringWhitespace("include \"foobar.asm\"")
@ -123,7 +123,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
assertThat(otherfile.text).isEqualTo("; oh no!")
myFixture.renameElementAtCaret("foobar.asm")
val files = FilenameIndex.getFilesByName(myFixture.project, "foobar.asm", GlobalSearchScope.allScope(myFixture.project))
val files = FilenameIndex.getVirtualFilesByName("foobar.asm", GlobalSearchScope.allScope(myFixture.project))
assertThat(files).hasSize(1)
assertThat(file.text).isEqualToIgnoringWhitespace("include \"foobar/foobar.asm\"")