diff --git a/build.gradle b/build.gradle index 64bfa1a9..dd012c58 100644 --- a/build.gradle +++ b/build.gradle @@ -68,28 +68,23 @@ compileJava.dependsOn generateBuildConfig prepareKotlinBuildScriptModel.dependsOn generateBuildConfig static def getVerifiableVersions() { - // FIXME: Re-enable PyCharm checks. - def versions = ["IC-222.4554.10", /*"PC-203.6682.168" */] + def versions = ["IC-241.14494.240"] // Get the list of all versions. def versionUrl = new URL("https://data.services.jetbrains.com/products?code=IIC%2CPCC&fields=code%2Creleases.build%2Creleases.type") def parsedJson = new JsonSlurper().parse(versionUrl) - // Find the latest EAP IntelliJ version. - versions.add(String.format("IC-%s", parsedJson.find { it -> it.code == "IIC" }.releases.find { it -> it.type == "eap" }.build)) - - // Find the latest EAP PyCharm version. - // FIXME: Re-enable PyCharm checks. -// versions.add(String.format("PC-%s", parsedJson.find { it -> it.code == "PCC" }.releases.find { it -> it.type == "eap" }.build)) + // Find the latest release IntelliJ version. + versions.add(String.format("IC-%s", parsedJson.find { it -> it.code == "IIC" }.releases.find { it -> it.type == "release" }.build)) return versions } intellij { downloadSources.set(false) pluginName.set('dodona') - plugins.set(['java', 'PythonCore:222.4459.24']) + plugins.set(['java', 'PythonCore:241.14494.17']) updateSinceUntilBuild.set(false) - version.set('222.4554.10') + version.set('241.14494.240') } jacocoTestReport { @@ -103,11 +98,14 @@ jacocoTestReport { patchPluginXml { changeNotes = """ + """ pluginDescription = 'Companion plugin for the Ghent University Dodona platform, which allows you to submit exercises right from your favourite JetBrains IDE. More information can be found at https://docs.dodona.be/en/guides/pycharm-plugin/' - sinceBuild = '222.4554.10' + sinceBuild = '241.14494.240' } publishPlugin { @@ -121,5 +119,5 @@ runPluginVerifier { } wrapper { - gradleVersion = '8.7.0' + gradleVersion = '8.5.0' } diff --git a/src/main/java/io/github/thepieterdc/dodona/plugin/actions/NewExerciseAction.java b/src/main/java/io/github/thepieterdc/dodona/plugin/actions/NewExerciseAction.java index f802baff..4aed0ca8 100644 --- a/src/main/java/io/github/thepieterdc/dodona/plugin/actions/NewExerciseAction.java +++ b/src/main/java/io/github/thepieterdc/dodona/plugin/actions/NewExerciseAction.java @@ -10,6 +10,7 @@ package io.github.thepieterdc.dodona.plugin.actions; import com.intellij.ide.IdeView; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; @@ -43,42 +44,47 @@ public class NewExerciseAction extends AnAction implements DumbAware { Icons.DODONA ); } - + @Override public void actionPerformed(@NotNull final AnActionEvent e) { final Project project = Objects.requireNonNull(e.getProject()); final IdeView view = Objects.requireNonNull(e.getData(LangDataKeys.IDE_VIEW)); - + try { // Prompt the user to identify the exercise. final FullIdentification identification = IdentifyTask .create(Objects.requireNonNull(e.getProject())) .execute() .orElseThrow(CancelledException::new); - + // Get the current directory. final PsiDirectory directory = Optional .ofNullable(view.getOrChooseDirectory()) .orElseThrow(CancelledException::new); - + // Create the file. final VirtualFile created = ExerciseCreationService .getInstance(project) .create(directory, identification); - + // Open the created file. FileEditorManager.getInstance(project).openFile(created, true); } catch (final CancelledException ex) { // Ignore. } } - + + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.EDT; + } + @Override public void update(@NotNull final AnActionEvent e) { final Project project = e.getProject(); final IdeView view = e.getData(LangDataKeys.IDE_VIEW); - + final PsiDirectory[] directory = view != null ? view.getDirectories() : null; e.getPresentation().setVisible(project != null && directory != null && directory.length > 0); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/thepieterdc/dodona/plugin/actions/SubmitAction.java b/src/main/java/io/github/thepieterdc/dodona/plugin/actions/SubmitAction.java index 1553f118..9be98694 100644 --- a/src/main/java/io/github/thepieterdc/dodona/plugin/actions/SubmitAction.java +++ b/src/main/java/io/github/thepieterdc/dodona/plugin/actions/SubmitAction.java @@ -9,6 +9,7 @@ package io.github.thepieterdc.dodona.plugin.actions; import com.intellij.codeInsight.CodeSmellInfo; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.editor.Document; @@ -48,7 +49,7 @@ public class SubmitAction extends AnAction { Icons.ACTION_SUBMIT ); } - + @Override public void actionPerformed(@NotNull final AnActionEvent e) { final Project project = Objects.requireNonNull(e.getProject()); @@ -59,7 +60,7 @@ public void actionPerformed(@NotNull final AnActionEvent e) { e.getPresentation().setEnabled(true); } } - + /** * Finds a syntax error in the code if it exists. * @@ -77,7 +78,12 @@ private static Optional findSyntaxError(final Project project, .map(codeAnalysisSrv::errors) .flatMap(smells -> smells.stream().findFirst()); } - + + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + /** * Gets the currently opened document, if available. * @@ -91,7 +97,7 @@ private static Optional getDocument(@Nullable final Project project) { .map(FileEditorManager::getSelectedTextEditor) .map(Editor::getDocument); } - + /** * Gets the PsiFile of the given document. * @@ -106,7 +112,7 @@ private static Optional getPsiFile(@Nullable final Project project, .map(PsiDocumentManager::getInstance) .map(mgr -> mgr.getPsiFile(document)); } - + /** * Submits the current file to Dodona. * @@ -117,14 +123,14 @@ private static void submit(final Project project, final boolean checkSyntax) { // Get the document. final Document document = getDocument(project).orElseThrow(RuntimeException::new); - + // Get the file. final PsiFile file = getPsiFile(project, document).orElseThrow(RuntimeException::new); - + try { // Get the code. final String code = document.getText(); - + // Validate the syntax. if (checkSyntax) { final Optional syntaxError = findSyntaxError(project, file); @@ -140,14 +146,14 @@ private static void submit(final Project project, } }); } - + // Create a new SubmitTask and execute it. SubmitSolutionTask.create(project, code).execute(); } catch (final CancelledException ignored) { } catch (final UnidentifiedCodeException ignored) { // Create a bus to broadcast the event when the exercise is identified. final MessageBus bus = project.getMessageBus(); - + // Identify the exercise. CodeIdentificationService.getInstance(project).identify(document).whenComplete((id, ex) -> { if (id != null) { @@ -158,9 +164,9 @@ private static void submit(final Project project, }); } } - + @Override public void update(@NotNull final AnActionEvent e) { e.getPresentation().setEnabled(getDocument(e.getProject()).isPresent()); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/thepieterdc/dodona/plugin/project/builders/DodonaPythonBuilder.java b/src/main/java/io/github/thepieterdc/dodona/plugin/project/builders/DodonaPythonBuilder.java index efc48ed2..cde207f0 100644 --- a/src/main/java/io/github/thepieterdc/dodona/plugin/project/builders/DodonaPythonBuilder.java +++ b/src/main/java/io/github/thepieterdc/dodona/plugin/project/builders/DodonaPythonBuilder.java @@ -12,7 +12,7 @@ import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.openapi.Disposable; import com.intellij.openapi.module.Module; -import com.jetbrains.python.module.PythonModuleBuilder; +import com.intellij.python.community.plugin.java.facet.PythonModuleBuilder; import io.github.thepieterdc.dodona.plugin.DodonaBundle; import io.github.thepieterdc.dodona.plugin.project.DodonaModuleBuilder; import io.github.thepieterdc.dodona.plugin.project.types.DodonaPythonType; @@ -30,9 +30,9 @@ public final class DodonaPythonBuilder extends PythonModuleBuilder implements DodonaModuleBuilder { @NonNls private static final String BUILDER_ID = "dodona-python"; - + private Course course; - + /** * DodonaJavaBuilder constructor. */ @@ -40,54 +40,54 @@ public DodonaPythonBuilder() { super(); this.addListener(this); } - + @Nonnull @Override public String getBuilderId() { return BUILDER_ID; } - + @Nonnull @Override public ModuleWizardStep getCustomOptionsStep(final WizardContext context, final Disposable parentDisposable) { return BuilderUtils.createCourseSelectionStep(this); } - + @Override public String getDescription() { return DodonaPythonType.MODULE_TYPE_DESCRIPTION; } - + @Override public String getGroupName() { return DodonaBundle.NAME; } - + @Override public Icon getNodeIcon() { return Icons.DODONA; } - + @Override public String getParentGroup() { return DodonaBundle.NAME; } - + @Override public String getPresentableName() { return DodonaPythonType.MODULE_TYPE_NAME; } - + @Override public int getWeight() { return DodonaModuleBuilder.WEIGHT; } - + @Override public void moduleCreated(@NotNull final Module module) { BuilderUtils.finish(module, this.course); } - + @Override public void setCourse(final Course course) { this.course = course;