Skip to content

Commit a052145

Browse files
authored
Improve build/test infrastructure to support IDEA 2022.2/2022.3 and Java 17 (#113)
* Use Java 11 for <2022.2 and Java 17 for >=2022.2 * Upgrade Gradle to 7.5.1 for Java 17 and fixup build script accordingly * Upgrade `intellij-gradle-plugin` for IDEA >=2022.2 * Remove Kotlin (not actually used, but messes with classpath) * Rearrange stuff around JUnit * Fixup several build warnings * Do not add tail text for lookups (it was never needed and something changed in 2022.3 that is causing addition of `()`) * Adapt tests to use message from IntelliJ instead of manually crafted
1 parent 127fdad commit a052145

File tree

10 files changed

+267
-200
lines changed

10 files changed

+267
-200
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
ideaVersion: [2021.2, 2021.3, LATEST-EAP-SNAPSHOT]
11-
name: 'IDEA ${{ matrix.ideaVersion }}'
10+
version:
11+
- { jdk: 11, idea: 2021.2 }
12+
- { jdk: 11, idea: 2021.3 }
13+
- { jdk: 11, idea: 2022.1 }
14+
- { jdk: 17, idea: 2022.2 }
15+
- { jdk: 17, idea: LATEST-EAP-SNAPSHOT }
16+
name: 'IDEA ${{ matrix.version.idea }}'
1217
env:
13-
IDEA_VERSION: ${{ matrix.ideaVersion }}
18+
IDEA_VERSION: ${{ matrix.version.idea }}
1419
runs-on: ubuntu-latest
1520
steps:
1621
- name: 'Checkout'
1722
uses: actions/checkout@v2
1823
- name: 'Set up JDK'
1924
uses: actions/setup-java@v1
2025
with:
21-
java-version: 11
26+
java-version: ${{ matrix.version.jdk }}
2227
- name: 'Test'
2328
run: ./gradlew --warning-mode=all build
2429
- name: 'Generate coverage report'

build.gradle

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import com.hierynomus.gradle.license.tasks.LicenseCheck
22
import com.hierynomus.gradle.license.tasks.LicenseFormat
33

44
plugins {
5-
id "org.jetbrains.intellij" version "1.5.2"
6-
id "com.github.hierynomus.license" version "0.14.0"
5+
id "org.jetbrains.intellij" version "1.9.0"
6+
id "com.github.hierynomus.license" version "0.16.1"
77
id "de.undercouch.download" version "4.1.2"
8-
id 'org.jetbrains.kotlin.jvm' version '1.4.31'
98
}
109

1110

@@ -18,10 +17,9 @@ apply plugin: 'org.jetbrains.intellij'
1817
apply plugin: 'license'
1918
apply plugin: 'checkstyle'
2019
apply plugin: 'jacoco'
21-
apply plugin: 'kotlin'
2220

23-
sourceCompatibility = 1.8
24-
targetCompatibility = 1.8
21+
sourceCompatibility = 11
22+
targetCompatibility = 11
2523

2624
repositories {
2725
mavenLocal()
@@ -40,18 +38,6 @@ intellij {
4038
plugins = ['java', 'Kotlin', 'properties']
4139
}
4240

43-
compileKotlin {
44-
kotlinOptions {
45-
jvmTarget = "1.8"
46-
}
47-
}
48-
49-
compileTestKotlin {
50-
kotlinOptions {
51-
jvmTarget = "1.8"
52-
}
53-
}
54-
5541
// Simple function to load change-notes.html and description.html into valid text for plugin.xml
5642
def htmlFixer = {f -> file(f).text.replace('<html>', '').replace('</html>', '')}
5743

@@ -94,35 +80,34 @@ checkstyle {
9480
}
9581

9682
jacoco {
97-
toolVersion "0.8.2"
83+
toolVersion "0.8.8"
9884
}
9985

10086
jacocoTestReport {
10187
reports {
102-
xml.enabled = true
103-
html.enabled = true
88+
xml.required = true
89+
html.required = true
10490
}
10591
}
10692

10793
dependencies {
108-
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
109-
compile group: 'org.mapstruct', name: 'mapstruct', version: '1.5.2.Final'
110-
testCompile group: 'junit', name: 'junit', version: '4.12'
111-
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.11.1'
112-
testCompile group: 'org.apache.commons', name: 'commons-text', version: '1.9'
94+
implementation('org.mapstruct:mapstruct:1.5.3.Final')
11395
testImplementation(platform('org.junit:junit-bom:5.8.2'))
114-
testImplementation('org.junit.jupiter:junit-jupiter')
115-
testImplementation('org.junit.jupiter:junit-jupiter')
116-
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
96+
testImplementation('org.junit.platform:junit-platform-launcher')
97+
testImplementation('org.junit.jupiter:junit-jupiter-api')
98+
testImplementation('org.junit.jupiter:junit-jupiter-engine')
99+
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')
100+
testImplementation('org.assertj:assertj-core:3.11.1')
101+
testImplementation('org.apache.commons:commons-text:1.9')
117102
}
118103

119104
task libs(type: Sync) {
120-
from configurations.compile
105+
from configurations.runtimeClasspath
121106
into "$buildDir/libs"
122107
preserve {
123108
include 'mapstruct-intellij-*.jar'
124109
}
125-
rename 'mapstruct-1.5.2.Final.jar', 'mapstruct.jar'
110+
rename 'mapstruct-1.5.3.Final.jar', 'mapstruct.jar'
126111
}
127112

128113
def mockJdkLocation = "https://github.com/JetBrains/intellij-community/raw/master/java/mock"
@@ -161,6 +146,8 @@ task downloadMockJdk8() {
161146
}
162147

163148
test.dependsOn( libs, downloadMockJdk7, downloadMockJdk8 )
149+
prepareTestingSandbox.dependsOn( libs )
150+
prepareSandbox.dependsOn( libs )
164151

165152
test {
166153
useJUnitPlatform()

gradle/wrapper/gradle-wrapper.jar

4.9 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)