Skip to content

Commit ee33f21

Browse files
authored
Update build system to Gradle 9.2.1 and Java 21 (#118)
- Updated dependencies - Updated github workflows based on latest intellij template - Upgraded to Gradle 9.2.1 and IntelliJ Platform Gradle Plugin 2.10.5 - Updated Java toolchain from 17 to 21 for IntelliJ 2025.1+ compatibility - Fixed test configuration for Kotest with JUnit 5 compatibility - Added testRuntimeOnly JUnit 4 dependency to support Gradle test infrastructure - Updated documentation (CHANGELOG, CLAUDE.md, README) to reflect new requirements
1 parent 1821c65 commit ee33f21

50 files changed

Lines changed: 1077 additions & 1086 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2-
# - Validate Gradle Wrapper.
32
# - Run 'test' and 'verifyPlugin' tasks.
43
# - Run the 'buildPlugin' task and prepare artifact for further tests.
54
# - Run the 'runPluginVerifier' task.
@@ -33,48 +32,29 @@ jobs:
3332
build:
3433
name: Build
3534
runs-on: ubuntu-latest
36-
outputs:
37-
version: ${{ steps.properties.outputs.version }}
38-
changelog: ${{ steps.properties.outputs.changelog }}
39-
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
4035
steps:
4136

37+
# Free GitHub Actions Environment Disk Space
38+
- name: Maximize Build Space
39+
uses: jlumbroso/free-disk-space@v1.3.1
40+
with:
41+
tool-cache: false
42+
large-packages: false
43+
4244
# Check out the current repository
4345
- name: Fetch Sources
44-
uses: actions/checkout@v4
45-
46-
# Validate wrapper
47-
- name: Gradle Wrapper Validation
48-
uses: gradle/actions/wrapper-validation@v4
46+
uses: actions/checkout@v5
4947

5048
# Set up Java environment for the next steps
5149
- name: Setup Java
52-
uses: actions/setup-java@v4
50+
uses: actions/setup-java@v5
5351
with:
5452
distribution: zulu
5553
java-version: 21
5654

5755
# Setup Gradle
5856
- name: Setup Gradle
59-
uses: gradle/actions/setup-gradle@v4
60-
with:
61-
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
62-
gradle-home-cache-cleanup: true
63-
64-
# Set environment variables
65-
- name: Export Properties
66-
id: properties
67-
shell: bash
68-
run: |
69-
PROPERTIES="$(./gradlew properties --console=plain -q)"
70-
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
71-
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
72-
73-
echo "version=$VERSION" >> $GITHUB_OUTPUT
74-
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
75-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
76-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
77-
echo "EOF" >> $GITHUB_OUTPUT
57+
uses: gradle/actions/setup-gradle@v5
7858

7959
# Build plugin
8060
- name: Build plugin
@@ -93,7 +73,7 @@ jobs:
9373
9474
# Store already-built plugin as an artifact for downloading
9575
- name: Upload artifact
96-
uses: actions/upload-artifact@v4
76+
uses: actions/upload-artifact@v5
9777
with:
9878
name: ${{ steps.artifact.outputs.filename }}
9979
path: ./build/distributions/content/*/*
@@ -105,20 +85,29 @@ jobs:
10585
runs-on: ubuntu-latest
10686
steps:
10787

88+
# Free GitHub Actions Environment Disk Space
89+
- name: Maximize Build Space
90+
uses: jlumbroso/free-disk-space@v1.3.1
91+
with:
92+
tool-cache: false
93+
large-packages: false
94+
10895
# Check out the current repository
10996
- name: Fetch Sources
110-
uses: actions/checkout@v4
97+
uses: actions/checkout@v5
11198

11299
# Set up Java environment for the next steps
113100
- name: Setup Java
114-
uses: actions/setup-java@v4
101+
uses: actions/setup-java@v5
115102
with:
116103
distribution: zulu
117104
java-version: 21
118105

119106
# Setup Gradle
120107
- name: Setup Gradle
121-
uses: gradle/actions/setup-gradle@v4
108+
uses: gradle/actions/setup-gradle@v5
109+
with:
110+
cache-read-only: true
122111

123112
# Run tests
124113
- name: Run Tests
@@ -127,7 +116,7 @@ jobs:
127116
# Collect Tests Result of failed tests
128117
- name: Collect Tests Result
129118
if: ${{ failure() }}
130-
uses: actions/upload-artifact@v4
119+
uses: actions/upload-artifact@v5
131120
with:
132121
name: tests-result
133122
path: ${{ github.workspace }}/build/reports/tests
@@ -141,29 +130,27 @@ jobs:
141130

142131
# Free GitHub Actions Environment Disk Space
143132
- name: Maximize Build Space
144-
uses: jlumbroso/free-disk-space@main
133+
uses: jlumbroso/free-disk-space@v1.3.1
145134
with:
146135
tool-cache: false
147136
large-packages: false
148137

149-
- name: Clean Gradle IDEA Cache
150-
run: |
151-
rm -rf ~/.gradle/caches/modules-2/files-2.1/idea/ideaIU
152-
153138
# Check out the current repository
154139
- name: Fetch Sources
155-
uses: actions/checkout@v4
140+
uses: actions/checkout@v5
156141

157142
# Set up Java environment for the next steps
158143
- name: Setup Java
159-
uses: actions/setup-java@v4
144+
uses: actions/setup-java@v5
160145
with:
161146
distribution: zulu
162147
java-version: 21
163148

164149
# Setup Gradle
165150
- name: Setup Gradle
166-
uses: gradle/actions/setup-gradle@v4
151+
uses: gradle/actions/setup-gradle@v5
152+
with:
153+
cache-read-only: true
167154

168155
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
169156
- name: Run Plugin Verification tasks
@@ -172,7 +159,7 @@ jobs:
172159
# Collect Plugin Verifier Result
173160
- name: Collect Plugin Verifier Result
174161
if: ${{ always() }}
175-
uses: actions/upload-artifact@v4
162+
uses: actions/upload-artifact@v5
176163
with:
177164
name: pluginVerifier-result
178165
path: ${{ github.workspace }}/build/reports/pluginVerifier
@@ -190,7 +177,13 @@ jobs:
190177

191178
# Check out the current repository
192179
- name: Fetch Sources
193-
uses: actions/checkout@v4
180+
uses: actions/checkout@v5
181+
182+
# Setup Gradle
183+
- name: Setup Gradle
184+
uses: gradle/actions/setup-gradle@v5
185+
with:
186+
cache-read-only: true
194187

195188
# Remove old release drafts by using the curl request for the available releases with a draft flag
196189
- name: Remove Old Release Drafts
@@ -206,10 +199,11 @@ jobs:
206199
env:
207200
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208201
run: |
209-
gh release create "v${{ needs.build.outputs.version }}" \
202+
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
203+
RELEASE_NOTE="./build/tmp/release_note.txt"
204+
mkdir -p "$(dirname "$RELEASE_NOTE")"
205+
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
206+
gh release create "v$VERSION" \
210207
--draft \
211-
--title "v${{ needs.build.outputs.version }}" \
212-
--notes "$(cat << 'EOM'
213-
${{ needs.build.outputs.changelog }}
214-
EOM
215-
)"
208+
--title "v$VERSION" \
209+
--notes-file $RELEASE_NOTE

.github/workflows/release.yml

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,56 +17,51 @@ jobs:
1717
contents: write
1818
pull-requests: write
1919
steps:
20-
- name: Free up disk space
21-
run: |
22-
echo "Freeing disk space before Gradle setup..."
23-
sudo rm -rf /usr/share/dotnet /opt/ghc /opt/hostedtoolcache /usr/local/lib/android
24-
df -h
20+
21+
# Free GitHub Actions Environment Disk Space
22+
- name: Maximize Build Space
23+
uses: jlumbroso/free-disk-space@v1.3.1
24+
with:
25+
tool-cache: false
26+
large-packages: false
2527

2628
# Check out the current repository
2729
- name: Fetch Sources
28-
uses: actions/checkout@v4
30+
uses: actions/checkout@v5
2931
with:
3032
ref: ${{ github.event.release.tag_name }}
3133

3234
# Set up Java environment for the next steps
3335
- name: Setup Java
34-
uses: actions/setup-java@v4
36+
uses: actions/setup-java@v5
3537
with:
3638
distribution: zulu
3739
java-version: 21
3840

3941
# Setup Gradle
4042
- name: Setup Gradle
41-
uses: gradle/actions/setup-gradle@v4
43+
uses: gradle/actions/setup-gradle@v5
4244
with:
43-
cache-disabled: true
44-
45-
# Set environment variables
46-
- name: Export Properties
47-
id: properties
48-
shell: bash
49-
run: |
50-
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
51-
${{ github.event.release.body }}
52-
EOM
53-
)"
54-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
55-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
56-
echo "EOF" >> $GITHUB_OUTPUT
45+
cache-read-only: true
5746

5847
# Update the Unreleased section with the current release note
5948
- name: Patch Changelog
60-
if: ${{ steps.properties.outputs.changelog != '' }}
49+
if: ${{ github.event.release.body != '' }}
6150
env:
62-
CHANGELOG: ${{ steps.properties.outputs.changelog }}
51+
CHANGELOG: ${{ github.event.release.body }}
6352
run: |
64-
./gradlew patchChangelog --release-note="$CHANGELOG"
53+
RELEASE_NOTE="./build/tmp/release_note.txt"
54+
mkdir -p "$(dirname "$RELEASE_NOTE")"
55+
echo "$CHANGELOG" > $RELEASE_NOTE
56+
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
6557
6658
# Publish the plugin to JetBrains Marketplace
6759
- name: Publish Plugin
6860
env:
6961
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
62+
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
63+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
64+
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
7065
run: ./gradlew publishPlugin
7166

7267
# Upload artifact as a release asset
@@ -77,7 +72,7 @@ jobs:
7772

7873
# Create a pull request
7974
- name: Create Pull Request
80-
if: ${{ steps.properties.outputs.changelog != '' }}
75+
if: ${{ github.event.release.body != '' }}
8176
env:
8277
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8378
run: |
@@ -100,4 +95,4 @@ jobs:
10095
--title "Changelog update - \`$VERSION\`" \
10196
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
10297
--label "$LABEL" \
103-
--head $BRANCH
98+
--head $BRANCH

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
## [Unreleased]
66

77
- Rearchitected to use coroutines for asynchronous operations, hopefully improving CPU utilisation. Please report any issues to the github, as there should be no changes to the experience.
8+
- Updated build system to Gradle 9.2.1 and IntelliJ Platform Gradle Plugin 2.10.5
9+
- Fixed test configuration to properly support Kotest with JUnit 5 while maintaining compatibility with Gradle test infrastructure
810

911
## 0.8.4 - 2025-06-25
1012

CLAUDE.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ IntelliJ IDEs. The plugin allows users to format their code using dprint directl
6464

6565
## Development Notes
6666

67-
1. The plugin is developed using Kotlin and targets IntelliJ 2024.3+
68-
2. JDK 17 is required for development
67+
1. The plugin is developed using Kotlin and targets IntelliJ 2025.1+
68+
2. JDK 21 is required for development
6969
3. To test the plugin locally:
7070
- Install dprint CLI (`brew install dprint` on macOS)
7171
- Run `dprint init` to create a default config
@@ -110,9 +110,12 @@ IntelliJ IDEs. The plugin allows users to format their code using dprint directl
110110
- **Progress integration** - Better integration with IntelliJ's progress system for background operations
111111

112112
### Technical Updates
113+
- **Build system modernization** - Updated to Gradle 9.2.1 and IntelliJ Platform Gradle Plugin 2.10.5
114+
- **Java toolchain update** - Upgraded from Java 17 to Java 21 for better performance and modern language features
113115
- **Dependency updates** - Updated all dependencies for 2025, including Gradle foojay-resolver-convention plugin (0.7.0 → 1.0.0)
114-
- **IntelliJ platform updates** - Updated to target IntelliJ 2024.3+ with latest platform APIs
116+
- **IntelliJ platform updates** - Updated to target IntelliJ 2025.1+ with latest platform APIs
115117
- **Deprecated code removal** - Cleaned up deprecated class usage and modernized codebase
118+
- **Test configuration improvements** - Fixed Kotest integration with JUnit 5 to work seamlessly with Gradle test infrastructure
116119
- **Test improvements** - Added comprehensive test suite for new architecture including `DprintServiceUnitTest`, `EditorServiceCacheTest`, and improved V5 service tests
117120

118121
### Configuration & UI Improvements

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Please report any issues with this Intellij plugin to the
4747

4848
## Development
4949

50-
This project is currently built using JDK 21 and targets IntelliJ 2024.3+. To install on a mac with homebrew run `brew install openjdk@21` and set that
50+
This project is currently built using JDK 21 and targets IntelliJ 2025.1+. To install on a mac with homebrew run `brew install openjdk@21` and set that
5151
as your project SDK.
5252

5353
### Dprint setup

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ dependencies {
3030
testImplementation(libs.kotestAssertions)
3131
testImplementation(libs.kotestRunner)
3232
testImplementation(libs.mockk)
33+
// Needed because the IJ platform uses version 4 for tests but kotest uses 5
34+
testRuntimeOnly("junit:junit:4.13.2")
3335

3436
intellijPlatform {
3537
val version = providers.gradleProperty("platformVersion")

gradle.properties

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,22 @@ pluginName=dprint
55
pluginVersion=0.9.0.beta
66
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
77
# for insight into build numbers and IntelliJ Platform versions.
8-
pluginSinceBuild=243
8+
pluginSinceBuild=251
99
platformType=IU
10-
platformVersion=2024.3
10+
platformVersion=2025.1
1111
platformDownloadSources=true
1212
# Opt-out flag for bundling Kotlin standard library.
1313
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
1414
kotlin.stdlib.default.dependency=false
1515
org.gradle.jvmargs=-XX\:MaxHeapSize\=4096m -Xmx4096m
1616
# Gradle Releases -> https://github.com/gradle/gradle/releases
17-
gradleVersion=8.5
17+
gradleVersion=9.2.1
1818
# https://github.com/gradle/gradle/issues/20416
1919
systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=tru
20-
2120
# Parallel execution
2221
org.gradle.parallel=true
2322
org.gradle.workers.max=4
24-
2523
# Build cache
2624
org.gradle.caching=true
27-
2825
# Configuration cache (if compatible)
2926
org.gradle.configuration-cache=true

gradle/libs.versions.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[versions]
2-
changelog = "2.2.1"
2+
changelog = "2.5.0"
33
commonsCollection4 = "4.5.0"
4-
gradleIntelliJPlugin = "2.6.0"
5-
kotestAssertions = "5.9.1"
6-
kotestRunner = "5.9.1"
7-
kotlin = "2.1.21"
8-
ktlint = "12.3.0"
9-
mockk = "1.14.2"
10-
versionCatalogUpdate = "1.0.0"
11-
versions = "0.52.0"
4+
gradleIntelliJPlugin = "2.10.5"
5+
kotestAssertions = "6.0.7"
6+
kotestRunner = "6.0.7"
7+
kotlin = "2.3.0"
8+
ktlint = "14.0.1"
9+
mockk = "1.14.7"
10+
versionCatalogUpdate = "1.0.1"
11+
versions = "0.53.0"
1212

1313
[libraries]
1414
commonsCollection4 = { module = "org.apache.commons:commons-collections4", version.ref = "commonsCollection4" }

gradle/wrapper/gradle-wrapper.jar

302 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)