Skip to content

Commit

Permalink
Add intellij plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tiginamaria committed Dec 1, 2023
1 parent 2db0f16 commit e8eb3d4
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 213 deletions.
37 changes: 36 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ plugins {
id("org.jetbrains.intellij") version "1.16.1"
}


intellij {
version.set("2023.1.2")
type.set("IC")
plugins.set(listOf("com.intellij.java", "org.jetbrains.kotlin"))
downloadSources.set(true)
updateSinceUntilBuild.set(true)
}

val detektReportMerge by tasks.registering(io.gitlab.arturbosch.detekt.report.ReportMergeTask::class) {
output.set(rootProject.buildDir.resolve("reports/detekt/merge.sarif"))
Expand Down Expand Up @@ -117,6 +123,35 @@ configure(subprojects) {

// We have to store tests inside test folder directly
configure(subprojects.filter { it.name != "common" }) {
apply {
plugin("org.jetbrains.intellij")
}

intellij {
version.set("2023.1.2")
type.set("IC")
plugins.set(listOf("com.intellij.java", "org.jetbrains.kotlin"))
downloadSources.set(true)
updateSinceUntilBuild.set(true)
}

val jvmVersion = gradleProperties("jvmVersion").get()
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = jvmVersion
}
}

withType<JavaCompile> {
sourceCompatibility = jvmVersion
targetCompatibility = jvmVersion
}

withType<org.jetbrains.intellij.tasks.BuildSearchableOptionsTask>()
.forEach { it.enabled = false }
}

sourceSets {
getByName("main").java.srcDirs("src")
getByName("test").java.srcDirs("test")
Expand Down
6 changes: 0 additions & 6 deletions courseSection/courseFrameworkLesson/lesson-info.yaml

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions courseSection/courseFrameworkLesson/programmingTask/task-info.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions courseSection/courseFrameworkLesson/programmingTask/task.md

This file was deleted.

This file was deleted.

This file was deleted.

58 changes: 0 additions & 58 deletions courseSection/courseFrameworkLesson/programmingTask/test/Tests.kt

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions courseSection/courseFrameworkLesson/theoryTask/task-info.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions courseSection/courseFrameworkLesson/theoryTask/task.md

This file was deleted.

12 changes: 0 additions & 12 deletions courseSection/courseLesson/Find Number of Classes/src/Task.kt

This file was deleted.

21 changes: 0 additions & 21 deletions courseSection/courseLesson/Find Number of Classes/test/Tests.kt

This file was deleted.

3 changes: 0 additions & 3 deletions courseSection/courseLesson/PsiTreeUtil/src/Main.kt

This file was deleted.

16 changes: 0 additions & 16 deletions courseSection/courseLesson/PsiTreeUtil/task-info.yaml

This file was deleted.

1 change: 0 additions & 1 deletion courseSection/courseLesson/PsiTreeUtil/task.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiFile
import com.intellij.psi.util.PsiTreeUtil

fun countPsiClasses(psiFile: PsiFile): Int {
return PsiTreeUtil.findChildrenOfType(psiFile, PsiClass::class.java).toList().size
}
16 changes: 16 additions & 0 deletions courseSection/courseLesson/findNumberOfClassesTask/test/Tests.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import com.intellij.testFramework.fixtures.BasePlatformTestCase

class Test : BasePlatformTestCase() {
fun testSolution() {
val file = myFixture.configureByText("MyClass.kt", """
class MyFirstClass {
}
class MySecondClass {
}
""".trimIndent())

val psiClassesCount = countPsiClasses(file)
assertEquals(2, psiClassesCount)
}
}
5 changes: 2 additions & 3 deletions courseSection/courseLesson/lesson-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ content:
- theoryTask
- quizTask
- programmingTask
- Intro to Psi
- PsiTreeUtil
- Find Number of Classes
- introductionToPsiTask
- findNumberOfClassesTask
1 change: 0 additions & 1 deletion courseSection/section-info.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
custom_name: Course section
content:
- courseLesson
- courseFrameworkLesson
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = "JetBrains Academy Kotlin course template"
rootProject.name = "JetBrains Academy IntelliJ IDEA Plugin Development Course"

pluginManagement {
repositories {
Expand All @@ -7,7 +7,7 @@ pluginManagement {
mavenCentral()

// To be able to use the Kotlin test framework for the tests - https://github.com/jetbrains-academy/kotlin-test-framework
maven(url = "https://packages.jetbrains.team/maven/p/kotlin-test-framework/kotlin-test-framework")
// maven(url = "https://packages.jetbrains.team/maven/p/kotlin-test-framework/kotlin-test-framework")
}
}

Expand Down

0 comments on commit e8eb3d4

Please sign in to comment.