From 87cca670496c8933d59b93a0e9ee29a89fc2103a Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Tue, 16 Aug 2022 10:54:57 +0200 Subject: [PATCH] Updated dependencies. Tests work again. Cosmetics, fixed warnings. --- README.md | 5 +-- build.gradle | 31 ++++++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- .../intellij/plugins/m68k/asm/M68kIsa.kt | 6 ++-- .../M68kUnresolvedReferenceInspection.kt | 2 +- .../jupiter/LightCodeInsightExtension.java | 13 ++++--- .../jupiter/ParsingTestExtension.java | 36 ++++++------------- .../AbstractDocumentationProviderTest.kt | 1 + .../M68kInspectionSuppressorTest.kt | 2 +- .../m68k/refs/M68kReferenceContributorTest.kt | 4 +-- 10 files changed, 53 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 7a20a9a..2a59157 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/build.gradle b/build.gradle index 8e6957a..4cf276e 100644 --- a/build.gradle +++ b/build.gradle @@ -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(""" -

V0.9 (07-Apr-22)

+

V0.9 (16-Aug-22)

Full changelog available at Github project site.

""") @@ -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 { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 05679dc..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt b/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt index d2196c2..9e8d271 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt @@ -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 -> diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/inspections/M68kUnresolvedReferenceInspection.kt b/src/main/java/de/platon42/intellij/plugins/m68k/inspections/M68kUnresolvedReferenceInspection.kt index 63e3c3f..e21f80b 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/inspections/M68kUnresolvedReferenceInspection.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/inspections/M68kUnresolvedReferenceInspection.kt @@ -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 } } diff --git a/src/test/java/de/platon42/intellij/jupiter/LightCodeInsightExtension.java b/src/test/java/de/platon42/intellij/jupiter/LightCodeInsightExtension.java index 2196270..b82323a 100644 --- a/src/test/java/de/platon42/intellij/jupiter/LightCodeInsightExtension.java +++ b/src/test/java/de/platon42/intellij/jupiter/LightCodeInsightExtension.java @@ -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 invocation, ReflectiveInvocationContext 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; } }; diff --git a/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java b/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java index 24545d9..0f0c166 100644 --- a/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java +++ b/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java @@ -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 invocation, ReflectiveInvocationContext 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(); diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/documentation/AbstractDocumentationProviderTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/documentation/AbstractDocumentationProviderTest.kt index ce402d8..7e9cab5 100644 --- a/src/test/java/de/platon42/intellij/plugins/m68k/documentation/AbstractDocumentationProviderTest.kt +++ b/src/test/java/de/platon42/intellij/plugins/m68k/documentation/AbstractDocumentationProviderTest.kt @@ -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) diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/inspections/M68kInspectionSuppressorTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/inspections/M68kInspectionSuppressorTest.kt index f2ca9be..d4c5cc0 100644 --- a/src/test/java/de/platon42/intellij/plugins/m68k/inspections/M68kInspectionSuppressorTest.kt +++ b/src/test/java/de/platon42/intellij/plugins/m68k/inspections/M68kInspectionSuppressorTest.kt @@ -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) } diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributorTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributorTest.kt index 943f3d6..6de6a97 100644 --- a/src/test/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributorTest.kt +++ b/src/test/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributorTest.kt @@ -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\"")