Skip to content

Commit

Permalink
Prepare for IntelliJ 2024.2 cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
unshare committed Jun 2, 2024
1 parent 4b48a62 commit 881e0dd
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 62 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
# Java-friendly readable chunk headers

*.java diff=java

/gradlew.bat eol=crlf
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ jobs:
fail-fast: false
matrix:
version:
- { jdk: 11, idea: 2022.1 }
- { 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: LATEST-EAP-SNAPSHOT }
- { jdk: 17, idea: 2022.2, eap: false }
- { jdk: 17, idea: 2022.3, eap: false }
- { jdk: 17, idea: 2023.1, eap: false }
- { jdk: 17, idea: 2023.2, eap: false }
- { jdk: 17, idea: 2023.3, eap: false }
- { jdk: 17, idea: 2024.1, eap: false }
- { jdk: 21, idea: LATEST-EAP-SNAPSHOT, eap: true }
name: 'IDEA ${{ matrix.version.idea }}'
env:
IDEA_VERSION: ${{ matrix.version.idea }}
IDEA_EAP: ${{ matrix.version.eap }}
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To learn more about MapStruct have a look at the [mapstruct](https://github.com/

## Requirements

The MapStruct plugin requires Java 11 or later
The MapStruct plugin requires Java 17 or later

## Building from Source

Expand Down
50 changes: 24 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat

plugins {
id "org.jetbrains.intellij" version "1.16.1"
id "org.jetbrains.intellij" version "1.17.3"
id "com.github.hierynomus.license" version "0.16.1"
id "de.undercouch.download" version "5.4.0"
}
Expand All @@ -18,8 +18,10 @@ apply plugin: 'license'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'

sourceCompatibility = 11
targetCompatibility = 11
java {
sourceCompatibility = 17
targetCompatibility = 17
}

repositories {
mavenLocal()
Expand All @@ -30,7 +32,7 @@ intellij {
version = System.getenv().getOrDefault('IDEA_VERSION', ideaVersion)
type = ideaType
downloadSources = Boolean.valueOf(sources)
sameSinceUntilBuild = Boolean.valueOf(isEAP)
sameSinceUntilBuild = Boolean.valueOf(System.getenv().getOrDefault('IDEA_EAP', isEAP))
instrumentCode = false
updateSinceUntilBuild = false
pluginName = 'MapStruct-Intellij-Plugin'
Expand All @@ -47,20 +49,18 @@ patchPluginXml {
pluginDescription = htmlFixer('description.html')
}

task licenseTestData(type: LicenseCheck) {
tasks.register "licenseTestData", LicenseCheck, {
source = fileTree(dir: "testData").include("**/*")
}

task licenseFormatForKotlin(type: LicenseFormat) {
tasks.register "licenseFormatForKotlin", LicenseFormat, {
source = fileTree(dir: "src/main").include("**/*.kt").include("**/*.xml")
}

license {
header rootProject.file('etc/license.txt')
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE' // IntelliJ reports the JAVADOC_STYLE as a dangling comment
}
mapping('java', 'SLASHSTAR_STYLE') // IntelliJ reports the JAVADOC_STYLE as a dangling comment
excludes([
'**/META-INF/plugin.xml', // For some reason the plugin thinks that the license is not valid
'**/*.properties',
Expand All @@ -72,18 +72,13 @@ licenseFormat.dependsOn licenseFormatForKotlin
licenseTest.dependsOn licenseTestData

checkstyle {
toolVersion '8.36.1'
config resources.text.fromUri("https://raw.githubusercontent.com/mapstruct/mapstruct/master/build-config/src/main/resources/build-config/checkstyle.xml")
configProperties = [
'checkstyle.cache.file': rootProject.buildDir.toPath().resolve('checkstyle-cachefile').toString(),
'checkstyle.cache.file': rootProject.layout.buildDirectory.get().asFile.toPath().resolve('checkstyle-cachefile').toString(),
'basedir': 'https://raw.githubusercontent.com/mapstruct/mapstruct/master/build-config',
]
}

jacoco {
toolVersion "0.8.11"
}

jacocoTestReport {
reports {
xml.required = true
Expand All @@ -92,27 +87,29 @@ jacocoTestReport {
}

dependencies {
implementation('org.mapstruct:mapstruct:1.5.3.Final')
testImplementation(platform('org.junit:junit-bom:5.8.2'))
implementation("org.mapstruct:mapstruct:${mapstructVersion}")
testImplementation(platform('org.junit:junit-bom:5.10.2'))
testImplementation('org.junit.platform:junit-platform-launcher')
testImplementation('org.junit.jupiter:junit-jupiter-api')
testImplementation('org.junit.jupiter:junit-jupiter-engine')
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('org.assertj:assertj-core:3.26.0')
testImplementation('org.apache.commons:commons-text:1.12.0')
}

task libs(type: Sync) {
tasks.register "libs", Sync, {
from configurations.runtimeClasspath
into "$buildDir/libs"
into "${layout.buildDirectory.get().asFile}/libs"
preserve {
include 'mapstruct-intellij-*.jar'
}
rename 'mapstruct-1.5.3.Final.jar', 'mapstruct.jar'
rename "mapstruct-${mapstructVersion}.jar", 'mapstruct.jar'
}

def mockJdkLocation = "https://github.com/JetBrains/intellij-community/raw/212.5712/java/mock"
def mockJdkDest = "$buildDir/mock"
def mockJdkDest = "${layout.buildDirectory.get().asFile}/mock"

@SuppressWarnings('GrMethodMayBeStatic')
def downloadMockJdk(mockJdkLocation, mockJdkDest, mockJdkVersion) {
def location = mockJdkLocation + mockJdkVersion
def destination = mockJdkDest + mockJdkVersion
Expand All @@ -127,7 +124,7 @@ def downloadMockJdk(mockJdkLocation, mockJdkDest, mockJdkVersion) {
}
}

task downloadMockJdk7() {
tasks.register "downloadMockJdk7", {
def jdkVersion = "JDK-1.7"
def mockJdk7Location = mockJdkLocation + jdkVersion
def mockJdk7Dest = mockJdkDest + jdkVersion
Expand All @@ -142,17 +139,18 @@ task downloadMockJdk7() {
}
}

task downloadMockJdk8() {
tasks.register "downloadMockJdk8", {
downloadMockJdk(mockJdkLocation, mockJdkDest, "JDK-1.8")
}

task downloadMockJdk11() {
tasks.register "downloadMockJdk11", {
downloadMockJdk(mockJdkLocation, mockJdkDest, "JDK-11")
}

test.dependsOn( libs, downloadMockJdk7, downloadMockJdk8, downloadMockJdk11 )
prepareTestingSandbox.dependsOn( libs )
prepareSandbox.dependsOn( libs )
classpathIndexCleanup.mustRunAfter compileTestJava // a workaround for a someone else's bug

test {
// Idea SDK needs special configuration
Expand Down
4 changes: 3 additions & 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.1
ideaVersion = 2022.2
ideaType = IC
sources = true
isEAP = false
Expand All @@ -12,6 +12,8 @@ pluginGroup = org.mapstruct
pluginName = mapstruct-intellij
pluginVersion = 1.7.1-SNAPSHOT

mapstructVersion = 1.5.5.Final

publishPluginId =
publishUsername =
publishPassword =
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 4 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 22 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
21 changes: 11 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -42,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ public static LookupElement asLookupWithRepresentableText(PsiMethod method, Stri
return builder;
}

@SuppressWarnings("unchecked")
public static <T extends PsiElement> LookupElement asLookup(String propertyName, @NotNull T psiElement,
Function<T, PsiType> typeMapper, Icon icon) {
//noinspection unchecked
return asLookup( propertyName, Pair.pair( psiElement, EmptySubstitutor.getInstance() ),
(Function<PsiElement, PsiType>) typeMapper, icon
);
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="221"/>
<idea-version since-build="222"/>

<!-- 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 881e0dd

Please sign in to comment.