Skip to content

Commit

Permalink
Migrate IntelliJ Platform Gradle Plugin to 2.x (#76)
Browse files Browse the repository at this point in the history
* Migrate IntelliJ Platform Gradle Plugin to 2.x

* Update version to denote breaking changes

* Update sourceCompability

* Explicitly set Java and Kotlin target version

* Update CI Java version to 21

* Add test dependency and fix JUnit 5/4 issue
  • Loading branch information
MituuZ authored Aug 25, 2024
1 parent 5559ce6 commit 3a00263
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Grant execute permission for gradlew
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.intellijPlatform
.idea
.idea/modules.xml
.idea/jarRepositories.xml
Expand Down
74 changes: 52 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,52 +1,82 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.jetbrains.kotlin.jvm") version "2.0.0"
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.kotlin.jvm") version "2.0.20"
id("org.jetbrains.intellij.platform") version "2.0.1"
}

group = "com.mituuz"
version = "0.26.2"
// Use same version and group for the jar and the plugin
val currentVersion = "1.0.0"
val myGroup = "com.mituuz"
version = currentVersion
group = myGroup

repositories {
mavenCentral()

intellijPlatform {
defaultRepositories()
}
}

dependencies {
intellijPlatform {
intellijIdeaCommunity("2024.2.0.1")

pluginVerifier()
zipSigner()
instrumentationTools()

testFramework(TestFrameworkType.Platform)
}

testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testImplementation("org.mockito:mockito-core:5.12.0")

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")

// Required to fix issue where JUnit5 Test Framework refers to JUnit4
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#junit5-test-framework-refers-to-junit4
testRuntimeOnly("junit:junit:4.13.2")
}

tasks.test {
useJUnitPlatform()
}

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2024.1")
plugins.set(listOf(/* Plugin Dependencies */))
tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
}

patchPluginXml {
sinceBuild.set("241")
untilBuild.set("242.*")
intellijPlatform {
pluginConfiguration {
version = currentVersion
group = myGroup

changeNotes = """
<h2>Version $currentVersion</h2>
- Re-implement project file handling as a backup if no modules are present<br>
- Migrate IntelliJ Platform Gradle Plugin to 2.x
""".trimIndent()

ideaVersion {
sinceBuild = "242"
}
}

signPlugin {

publishing {
token.set(System.getenv("PUBLISH_TOKEN"))
}

signing {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}
6 changes: 0 additions & 6 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
isLogByDefault="true"/>
</extensions>

<change-notes><![CDATA[
<h2>Version 0.26.2</h2>
- Re-implement project file handling as a backup if no modules are present
]]>
</change-notes>

<actions>
<action
id="com.mituuz.fuzzier.Fuzzier"
Expand Down

0 comments on commit 3a00263

Please sign in to comment.