Skip to content

Commit

Permalink
Use IntelliJ Gradle Plugin 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
filiphr committed Sep 21, 2024
1 parent c5ea637 commit 2c54816
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ 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:
IDEA_VERSION: ${{ matrix.version.idea }}
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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
.idea/
out/

.intellijPlatform/

# Gradle
.gradle/
build/
Expand Down
39 changes: 26 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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'
Expand All @@ -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<? extends String>
}
}
}

// Simple function to load change-notes.html and description.html into valid text for plugin.xml
Expand Down Expand Up @@ -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')
Expand All @@ -98,13 +109,15 @@ 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) {
from configurations.runtimeClasspath
into layout.buildDirectory.dir("libs")
preserve {
include 'mapstruct-intellij-*.jar'
include 'MapStruct-Intellij-*.jar'
}
rename 'mapstruct-1.5.3.Final.jar', 'mapstruct.jar'
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<vendor url="https://www.mapstruct.org">MapStruct</vendor>

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

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

0 comments on commit 2c54816

Please sign in to comment.