From 2c54816270b67b9a57222e44f5f61273545a4a01 Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Sat, 21 Sep 2024 20:57:17 +0200 Subject: [PATCH] Use IntelliJ Gradle Plugin 2.x --- .github/workflows/main.yml | 7 +++-- .gitignore | 2 ++ build.gradle | 39 +++++++++++++++++--------- gradle.properties | 2 +- src/main/resources/META-INF/plugin.xml | 2 +- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d3f916c..815d9e59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,12 +8,12 @@ jobs: fail-fast: false matrix: version: - - { jdk: 17, idea: 2022.2 } - { jdk: 17, idea: 2022.3 } - { jdk: 17, idea: 2023.1 } - { jdk: 17, idea: 2023.2 } - { jdk: 17, idea: 2023.3 } - { jdk: 17, idea: 2024.1 } + - { jdk: 17, idea: 2024.2 } - { jdk: 17, idea: LATEST-EAP-SNAPSHOT } name: 'IDEA ${{ matrix.version.idea }}' env: @@ -21,10 +21,11 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: 'Set up JDK' - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: ${{ matrix.version.jdk }} - name: 'Test' run: ./gradlew --warning-mode=all build diff --git a/.gitignore b/.gitignore index 04754ea7..dc7605cf 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ .idea/ out/ +.intellijPlatform/ + # Gradle .gradle/ build/ diff --git a/build.gradle b/build.gradle index 7e9969bd..5da7eb0c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,9 @@ import com.hierynomus.gradle.license.tasks.LicenseCheck import com.hierynomus.gradle.license.tasks.LicenseFormat +import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { - id "org.jetbrains.intellij" version "1.17.4" + id "org.jetbrains.intellij.platform" version "2.0.1" id "com.github.hierynomus.license" version "0.16.1" id "de.undercouch.download" version "5.6.0" } @@ -13,7 +14,7 @@ version pluginVersion apply plugin: 'idea' apply plugin: 'java' -apply plugin: 'org.jetbrains.intellij' +apply plugin: 'org.jetbrains.intellij.platform' apply plugin: 'license' apply plugin: 'checkstyle' apply plugin: 'jacoco' @@ -26,19 +27,20 @@ java { repositories { mavenLocal() mavenCentral() + intellijPlatform { + defaultRepositories() + } } -intellij { - version = System.getenv().getOrDefault('IDEA_VERSION', ideaVersion) - type = ideaType - downloadSources = Boolean.valueOf(sources) - sameSinceUntilBuild = Boolean.valueOf(isEAP) +intellijPlatform { instrumentCode = false - updateSinceUntilBuild = false - pluginName = 'MapStruct-Intellij-Plugin' - // The properties plugin is needed because Kotlin uses it - // and for some reason plugins does not transitively pull itx - plugins = ['java', 'Kotlin', 'properties'] + projectName = 'MapStruct-Intellij-Plugin' + pluginConfiguration { + ideaVersion { + sinceBuild = "223" + untilBuild = provider { null } as Provider + } + } } // Simple function to load change-notes.html and description.html into valid text for plugin.xml @@ -90,6 +92,15 @@ jacocoTestReport { } dependencies { + intellijPlatform { + create( ideaType, System.getenv().getOrDefault( 'IDEA_VERSION', ideaVersion ) ) + + bundledPlugin( 'com.intellij.java' ) + bundledPlugin( 'org.jetbrains.kotlin' ) + + testFramework( TestFrameworkType.Platform.INSTANCE ) + testFramework( TestFrameworkType.Bundled.INSTANCE ) + } implementation('org.mapstruct:mapstruct:1.5.3.Final') testImplementation(platform('org.junit:junit-bom:5.8.2')) testImplementation('org.junit.platform:junit-platform-launcher') @@ -98,6 +109,7 @@ dependencies { testRuntimeOnly('org.junit.vintage:junit-vintage-engine') testImplementation('org.assertj:assertj-core:3.11.1') testImplementation('org.apache.commons:commons-text:1.10.0') + testImplementation( 'junit:junit:4.13.2' ) } task libs(type: Sync) { @@ -105,6 +117,7 @@ task libs(type: Sync) { into layout.buildDirectory.dir("libs") preserve { include 'mapstruct-intellij-*.jar' + include 'MapStruct-Intellij-*.jar' } rename 'mapstruct-1.5.3.Final.jar', 'mapstruct.jar' } @@ -149,8 +162,8 @@ task downloadMockJdk11() { } test.dependsOn( libs, downloadMockJdk7, downloadMockJdk8, downloadMockJdk11 ) -prepareTestingSandbox.dependsOn( libs ) prepareSandbox.dependsOn( libs ) +composedJar.dependsOn( libs ) test { // Idea SDK needs special configuration diff --git a/gradle.properties b/gradle.properties index b3b2480c..b522f1e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ # https://www.jetbrains.com/intellij-repository/releases # https://www.jetbrains.com/intellij-repository/snapshots -ideaVersion = 2022.2 +ideaVersion = 2022.3 ideaType = IC sources = true isEAP = false diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 5a1d97e7..0550e6e6 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -24,7 +24,7 @@ MapStruct - +