Skip to content

Commit

Permalink
Enhancement: Upgrade intelij gradle plugin version and add documentat…
Browse files Browse the repository at this point in the history
…ion (#69)
  • Loading branch information
MDK5 committed Apr 24, 2022
1 parent 97d480a commit ac1667a
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 44 deletions.
21 changes: 17 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@
### Steps for Testing
<!-- Please describe in detail how the reviewer can test your changes. -->

1. Install the release as described in [the readme](https://github.com/ls1intum/Orion/blob/master/README.md#testing-of-pull-requests)
2. Check if all features still work (start and clone exercise, submit changes, receive test results, clone exercise as instructor)
3. ...
1. Install the release as described in [the readme](https://github.com/ls1intum/Orion/blob/master/README.md#testing-of-pull-requests)
2. Open an exercise in Orion
3. ...

### Review Progress
<!-- Each Pull Request should be reviewed by at least two other developers. The code as well as the functionality (= manual test) needs to be reviewed. -->
<!-- The reviewer or author check the following boxes depending on what was reviewed or tested. All boxes should be checked before merge. -->
<!-- You can add additional checkboxes if it makes sense to only review parts of the code or functionality. -->
<!-- When changes are pushed, uncheck the affected boxes. (Not all changes require full re-reviews.) -->

#### Code Review
- [ ] Review 1
- [ ] Review 2
#### Manual Tests
- [ ] Test 1
- [ ] Test 2

### Screenshots
<!-- Add screenshots to demonstrate the changes in the UI. -->
<!-- Add screenshots to demonstrate the changes in the UI. -->
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ jobs:
java-version: 11

# Inject the plugin owner's credentials for the JetBrains repository into the build.gradle.kts
- name: Inject Mail
run: sed -i -e 's/<your_mail>/alexander.ungar@tum.de/g' build.gradle.kts
- name: Inject Token
run: sed -i -e 's/<your_token>/${{ secrets.PLUGIN_REPOSITORY_TOKEN }}/g' build.gradle.kts

Expand Down
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,58 @@
# Orion IntelliJ plugin
# Orion IntelliJ Plugin

Open Artemis IDE plugin for the programming exercise integration.
This plugin integrates the [Artemis](https://github.com/ls1intum/Artemis) interactive learning platform into the IntelliJ IDE.
It allows you to directly import programming exercises from Artemis and submit your changes to the build servers.

Detailed documentation is integrated into [Artemis' documentation](https://artemis-platform.readthedocs.io/en/latest/user/orion/).

**Current Version:**
![GitHub release (latest by date)](https://img.shields.io/github/v/release/ls1intum/Orion)

## Example Usage
![](.github/media/orion_workflow.gif)

## Manual Installation

Download the release from [here](https://github.com/ls1intum/Orion/releases) and install it as described [further down in this document](https://github.com/ls1intum/Orion#install-release-zip).

## Planned Features
We want to integrate the following features into the plugin:

- Support for manual assessment
- Integration of the [JetBrains Edu Tools](https://plugins.jetbrains.com/plugin/10081-edutools)
- Support for team exercises
- Automatic conflict resolution

## Run/debug the plugin
## Development

### Run/Debug the Plugin

### Development
- Import as gradle project
- Select the JBR `>11.0.3` as the project SDK with language level 11
- Run Gradle task: `runIde`. This will open a new IntelliJ window with the plugin installed.

- Import as gradle project
- Select the JBR `>11.0.3` as the project SDK with language level 11
- Run Gradle task: `runIde`. This will open a new IntelliJ window with the plugin installed.
### Perform Version Upgrade

### Testing of pull requests
Upon release of a new mayor IntelliJ version, the plugin needs to be upgraded to support the new version. This upgrade can oftentimes also be performed without much knowledge of the codebase. In the following, the necessary steps are outlined:
1. If you do not have write access to the GitHub repository, fork the repository and clone it
2. Make sure you are able to run the plugin locally as described above
3. Adapt the versions in the build configuration file [build.gradle.kts](https://github.com/ls1intum/Orion/blob/master/build.gradle.kts)
1. At `intellij`, change the version property to the latest version. This is the IntelliJ version used for "runIde". Also adapt the version numbers of all versioned plugins at `intellij``plugins`. You can look up each plugin in the IntelliJ marketplace and find the latest compatible version there.
2. At `tasks``patchPluginXml`, change the `sinceBuild` and `untilBuild` property accordingly, the format is explained in a comment there.
3. Optionally upgrade the versions of the dependencies at `plugins` and `dependencies`, however this is usually not necessary.
4. Run the project locally with runIde or buildPlugin. If compilation errors happen, try to resolve them; on version changes, IntelliJ sometimes deprecates APIs or moves packages. Fixing these errors requires looking into and changing the code. A very helpful resource is the [documentation of the IntelliJ Platform SDK](https://plugins.jetbrains.com/docs/intellij/welcome.html).
5. When the plugin runs locally, create a pull request with your changes. Also consider notifying a maintainer of Orion or Artemis to make sure your pull request gets noticed.

### Testing of Pull Requests

1. #### Download release (.zip)
1. #### Download Release (.zip)

Download the release file from the pull request's _Checks_ &rarr; _Artifacts_ &rarr; _orion_

The artifact is unavailable during building. The full history of artifacts can be retrieved though the _Actions_ tab
![](.github/media/download_release.png)

2. #### Install release (.zip)
2. #### Install Release (.zip)

Install the release file in IntelliJ at _Settings_ &rarr; _Plugins_ &rarr; _Settings_ &rarr; _Install Plugin from Disk..._ &rarr; Select the file
![](.github/media/install_release.png)
Expand Down
34 changes: 15 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("java")
kotlin("jvm") version "1.6.10"
id("org.jetbrains.intellij") version "0.7.3"
kotlin("jvm") version "1.6.21"
id("org.jetbrains.intellij") version "1.5.3"
}

java {
Expand All @@ -23,43 +23,39 @@ repositories {

dependencies {
// JSON parsing
implementation("com.google.code.gson:gson:2.8.6")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.+")
implementation("com.google.code.gson:gson:2.8.9")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1")
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version = "2021.2"
setPlugins("git4idea", "maven", "PythonCore:212.4746.13")
version.set("2022.1")
plugins.set(listOf("git4idea", "maven", "PythonCore:221.5080.216"))
}

tasks {
patchPluginXml {
// Last 2 digits of the year and the major version digit, 211-211.* equals (20)21.1.*
// See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
sinceBuild("212")
untilBuild("212.*")
sinceBuild.set("221")
// Orion Plugin version. Needs to be incremented for every new release!
version("1.2.1")
changeNotes(
version.set("1.2.1")
changeNotes.set(
"""<p>
<h1>Version Upgrade</h1>
<h2>Improvements</h2>
<ul>
<li>Upgrade to IntelliJ 2021.2</li>
<li>Add support for assessment in Orion</li>
<li>Add button to return to exercise</li>
<li>Add button to open the documentation</li>
<li>Add dialog to choose commit message</li>
<li>Add limited support for auxiliary repositories</li>
<li>Fix a bug that causes the plugin to crash for some programming languages</li>
<li>Add support for assessment of exams, complaints and more feedback requests</li>
<li>Add support structured grading criteria</li>
<li>Fix an issue with artemis urls with trailing slashes</li>
<li>Fix an issue with quotes in feedback comments</li>
<li>Update dependencies</li>
</ul>
</p>"""
)
}

publishPlugin {
setUsername("<your_mail>")
setToken("<your_token>")
token.set("<your_token>")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OrionStartupProjectRefreshActivity : StartupActivity, DumbAware {
* Runs all pending jobs on opening a programming exercise project. For now, this includes:
* - Registering the opened exercise in the registry
* - Pull all changes from the remote
* - Tell the ArTEMiS webapp that a new exercise was opened
* - Tell the Artemis webapp that a new exercise was opened
*/
override fun runActivity(project: Project) {
// We need to subscribe to all internal state listeners before any message could potentially be sent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class BrokenRegistryLinkException(message: String?) : Exception(message)
interface OrionExerciseRegistry {

/**
* Is the currently opened project an ArTEMiS exercise?
* Is the currently opened project an Artemis exercise?
*
* @return True, if the currently opened project refers to an ArTEMiS programming exercise, otherwise false
* @return True, if the currently opened project refers to an Artemis programming exercise, otherwise false
*/
val isArtemisExercise: Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class CommitMessageChooser(val project: Project) :

init {
title = translate("orion.dialog.commitmessagechooser.title")
setDoNotAskOption(object : DoNotAskOption.Adapter() {
// full identifier needed to fix deprecation warning, can be removed after removal complete
setDoNotAskOption(object : com.intellij.openapi.ui.DoNotAskOption.Adapter() {
override fun rememberChoice(isSelected: Boolean, exitCode: Int) {
if (exitCode == OK_EXIT_CODE && isSelected) {
settings.saveSetting(OrionSettingsProvider.KEYS.COMMIT_MESSAGE, commitMessageField.text)
Expand Down Expand Up @@ -71,4 +72,4 @@ class CommitMessageChooser(val project: Project) :
}

private fun translate(key: String) = OrionBundle.message(key)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ConfirmPasswordSaveDialog(project: Project?) : DialogWrapper(project) {
confirmationPanel = panel {
row {
label(
"Do you want to save your ArTEMiS credentials in IntelliJ?\n" +
"Do you want to save your Artemis credentials in IntelliJ?\n" +
"This makes importing and submitting exercises a lot easier!"
)
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/de/tum/www1/orion/vcs/OrionGitAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private fun Module.repository(): GitRepository {
*/
object OrionGitAdapter {
fun clone(currentProject: Project, repository: String, baseDir: String, clonePath: String, andThen: (() -> Unit)?) {
object : Task.Backgroundable(currentProject, "Importing from ArTEMiS...", true) {
object : Task.Backgroundable(currentProject, "Importing from Artemis...", true) {
private val cloneResult = AtomicBoolean()
private val listener = ProjectLevelVcsManager.getInstance(currentProject).compositeCheckoutListener

Expand Down Expand Up @@ -344,6 +344,8 @@ object OrionGitAdapter {
resetAndPull(project)
ExerciseView.TUTOR ->
return
else ->
return
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ interface OrionGitCredentialsService {
* Stores the specified credentials in the password safe under the Git credentials key, so that when executing
* any authenticated Git actions, the user doesn't have to input the password again
*
* @param username The username used to login into ArTEMiS
* @param username The username used to login into Artemis
* @param password The password used to login
*/
fun storeGitCredentials(username: String, password: String)

/**
* Removes the stored credentials saved under the specified username
*
* @param username The username used to login into ArTEMiS
* @param username The username used to login into Artemis
*/
fun removeGitCredentials(username: String)
}

0 comments on commit ac1667a

Please sign in to comment.