Skip to content

Commit

Permalink
Merge branch 'main' into igor/publish-to-mp
Browse files Browse the repository at this point in the history
  • Loading branch information
Geravant authored Dec 9, 2024
2 parents e847d99 + 81e0a06 commit 19101c3
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 24 deletions.
72 changes: 49 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesExtension
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformExtension
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformRepositoriesExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun gradleProperties(key: String) = providers.gradleProperty(key)

group = gradleProperties("courseGroup").get()
version = gradleProperties("courseVersion").get()

val ideaVersion: String by project

plugins {
java
`java-test-fixtures`
val kotlinVersion = "1.9.21"
id("org.jetbrains.kotlin.jvm") version kotlinVersion apply false
id("io.gitlab.arturbosch.detekt") version "1.23.1"
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)
id("org.jetbrains.intellij.platform") version "2.1.0" apply false
}

val detektReportMerge by tasks.registering(io.gitlab.arturbosch.detekt.report.ReportMergeTask::class) {
Expand Down Expand Up @@ -49,15 +48,7 @@ configure(subprojects) {
apply {
plugin("java")
plugin("kotlin")
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)
plugin("java-test-fixtures")
}

// Configure detekt
Expand Down Expand Up @@ -124,6 +115,26 @@ configure(subprojects) {

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

repositories {
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}

intellijPlatform {
projectName = "IDEDevelopmentCourseDemo"
pluginConfiguration {
id = "jetbrains.academy.plugin.course.dev.ui.demo"
name = "IDE Development Course Demo"
}
instrumentCode = false
buildSearchableOptions = false
}

val jvmVersion = gradleProperties("jvmVersion").get()
tasks {
Expand All @@ -137,9 +148,6 @@ configure(subprojects.filter { it.name != "common" }) {
sourceCompatibility = jvmVersion
targetCompatibility = jvmVersion
}

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

sourceSets {
Expand All @@ -148,7 +156,15 @@ configure(subprojects.filter { it.name != "common" }) {
}

dependencies {
intellijPlatform {
intellijIdeaCommunity(ideaVersion, useInstaller = false)
jetbrainsRuntime()
bundledPlugins("com.intellij.java", "org.jetbrains.kotlin")
testFramework(TestFrameworkType.Bundled)
}

implementation(project(":common"))
testImplementation(testFixtures(project(":common")))
}

tasks.register<Copy>("restoreOriginalFiles") {
Expand All @@ -157,9 +173,19 @@ configure(subprojects.filter { it.name != "common" }) {
}

tasks {
runIde {
"runIde" {
dependsOn("restoreOriginalFiles")
}
}

}

// Gradle doesn't generate type-safe accessors since `org.jetbrains.intellij.platform` plugin is not applied in the root project.
// Let's create them manually
fun Project.intellijPlatform(configure: Action<IntelliJPlatformExtension>) =
(this as ExtensionAware).extensions.configure("intellijPlatform", configure)

fun RepositoryHandler.intellijPlatform(configure: Action<IntelliJPlatformRepositoriesExtension>) =
(this as ExtensionAware).extensions.configure("intellijPlatform", configure)

fun DependencyHandler.intellijPlatform(configure: Action<IntelliJPlatformDependenciesExtension>) =
(this as ExtensionAware).extensions.configure("intellijPlatform", configure)
30 changes: 30 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

group = rootProject.group
version = rootProject.version

val ideaVersion: String by project

plugins {
id("org.jetbrains.intellij.platform.module")
}

intellijPlatform {
instrumentCode = false
}

repositories {
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}

dependencies {
intellijPlatform {
intellijIdeaCommunity(ideaVersion, useInstaller = false)
jetbrainsRuntime()
bundledPlugins("com.intellij.java", "org.jetbrains.kotlin")
testFramework(TestFrameworkType.Bundled)
}

testFixturesApi("junit:junit:4.13.2")
}
2 changes: 1 addition & 1 deletion course-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ content:
- introductionSection
- psiSection
environment_settings:
jvm_language_level: JDK_19
jvm_language_level: JDK_17
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ courseVersion=1.1.0

gradleVersion=8.3
jvmVersion=17
ideaVersion=2023.1.2

kotlin.code.style=official
org.gradle.jvmargs=-Xmx2048m

0 comments on commit 19101c3

Please sign in to comment.