Skip to content

Commit 1b5cc39

Browse files
committed
Use IntelliJ Gradle Plugin 2.x
1 parent c5ea637 commit 1b5cc39

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@ jobs:
88
fail-fast: false
99
matrix:
1010
version:
11-
- { jdk: 17, idea: 2022.2 }
1211
- { jdk: 17, idea: 2022.3 }
1312
- { jdk: 17, idea: 2023.1 }
1413
- { jdk: 17, idea: 2023.2 }
1514
- { jdk: 17, idea: 2023.3 }
1615
- { jdk: 17, idea: 2024.1 }
16+
- { jdk: 17, idea: 2024.2 }
1717
- { jdk: 17, idea: LATEST-EAP-SNAPSHOT }
1818
name: 'IDEA ${{ matrix.version.idea }}'
1919
env:
2020
IDEA_VERSION: ${{ matrix.version.idea }}
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: 'Checkout'
24-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2525
- name: 'Set up JDK'
26-
uses: actions/setup-java@v1
26+
uses: actions/setup-java@v4
2727
with:
28+
distribution: 'zulu'
2829
java-version: ${{ matrix.version.jdk }}
2930
- name: 'Test'
3031
run: ./gradlew --warning-mode=all build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
.idea/
1616
out/
1717

18+
.intellijPlatform/
19+
1820
# Gradle
1921
.gradle/
2022
build/

build.gradle

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import com.hierynomus.gradle.license.tasks.LicenseCheck
22
import com.hierynomus.gradle.license.tasks.LicenseFormat
3+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
34

45
plugins {
5-
id "org.jetbrains.intellij" version "1.17.4"
6+
id "org.jetbrains.intellij.platform" version "2.0.1"
67
id "com.github.hierynomus.license" version "0.16.1"
78
id "de.undercouch.download" version "5.6.0"
89
}
@@ -13,7 +14,7 @@ version pluginVersion
1314

1415
apply plugin: 'idea'
1516
apply plugin: 'java'
16-
apply plugin: 'org.jetbrains.intellij'
17+
apply plugin: 'org.jetbrains.intellij.platform'
1718
apply plugin: 'license'
1819
apply plugin: 'checkstyle'
1920
apply plugin: 'jacoco'
@@ -26,19 +27,20 @@ java {
2627
repositories {
2728
mavenLocal()
2829
mavenCentral()
30+
intellijPlatform {
31+
defaultRepositories()
32+
}
2933
}
3034

31-
intellij {
32-
version = System.getenv().getOrDefault('IDEA_VERSION', ideaVersion)
33-
type = ideaType
34-
downloadSources = Boolean.valueOf(sources)
35-
sameSinceUntilBuild = Boolean.valueOf(isEAP)
35+
intellijPlatform {
3636
instrumentCode = false
37-
updateSinceUntilBuild = false
38-
pluginName = 'MapStruct-Intellij-Plugin'
39-
// The properties plugin is needed because Kotlin uses it
40-
// and for some reason plugins does not transitively pull itx
41-
plugins = ['java', 'Kotlin', 'properties']
37+
projectName = 'MapStruct-Intellij-Plugin'
38+
pluginConfiguration {
39+
ideaVersion {
40+
sinceBuild = "223"
41+
untilBuild = provider { null } as Provider<? extends String>
42+
}
43+
}
4244
}
4345

4446
// Simple function to load change-notes.html and description.html into valid text for plugin.xml
@@ -89,22 +91,37 @@ jacocoTestReport {
8991
}
9092
}
9193

94+
def versionToUse = System.getenv().getOrDefault( 'IDEA_VERSION', ideaVersion )
95+
def useInstaller = !versionToUse.containsIgnoreCase( "EAP" )
9296
dependencies {
97+
intellijPlatform {
98+
ideaType == 'IC' ? intellijIdeaCommunity(versionToUse, useInstaller) : intellijIdeaUltimate(versionToUse, useInstaller)
99+
100+
jetbrainsRuntime()
101+
102+
bundledPlugin( 'com.intellij.java' )
103+
bundledPlugin( 'org.jetbrains.kotlin' )
104+
105+
testFramework( TestFrameworkType.Platform.INSTANCE )
106+
testFramework( TestFrameworkType.Bundled.INSTANCE )
107+
}
93108
implementation('org.mapstruct:mapstruct:1.5.3.Final')
94-
testImplementation(platform('org.junit:junit-bom:5.8.2'))
109+
testImplementation(platform('org.junit:junit-bom:5.11.0'))
95110
testImplementation('org.junit.platform:junit-platform-launcher')
96111
testImplementation('org.junit.jupiter:junit-jupiter-api')
97112
testImplementation('org.junit.jupiter:junit-jupiter-engine')
98113
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')
99-
testImplementation('org.assertj:assertj-core:3.11.1')
100-
testImplementation('org.apache.commons:commons-text:1.10.0')
114+
testImplementation('org.assertj:assertj-core:3.26.3')
115+
testImplementation('org.apache.commons:commons-text:1.12.0')
116+
testImplementation( 'junit:junit:4.13.2' )
101117
}
102118

103119
task libs(type: Sync) {
104120
from configurations.runtimeClasspath
105121
into layout.buildDirectory.dir("libs")
106122
preserve {
107123
include 'mapstruct-intellij-*.jar'
124+
include 'MapStruct-Intellij-*.jar'
108125
}
109126
rename 'mapstruct-1.5.3.Final.jar', 'mapstruct.jar'
110127
}
@@ -149,8 +166,8 @@ task downloadMockJdk11() {
149166
}
150167

151168
test.dependsOn( libs, downloadMockJdk7, downloadMockJdk8, downloadMockJdk11 )
152-
prepareTestingSandbox.dependsOn( libs )
153169
prepareSandbox.dependsOn( libs )
170+
composedJar.dependsOn( libs )
154171

155172
test {
156173
// Idea SDK needs special configuration

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
# https://www.jetbrains.com/intellij-repository/releases
33
# https://www.jetbrains.com/intellij-repository/snapshots
44

5-
ideaVersion = 2022.2
5+
ideaVersion = 2022.3
66
ideaType = IC
77
sources = true
8-
isEAP = false
98
runGenerators = true
109

1110
pluginGroup = org.mapstruct

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<vendor url="https://www.mapstruct.org">MapStruct</vendor>
2525

2626
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
27-
<idea-version since-build="222"/>
27+
<idea-version since-build="223"/>
2828

2929
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
3030
on how to target different products -->

0 commit comments

Comments
 (0)