Skip to content

Commit ef84a05

Browse files
authored
Support IntelliJ Platform Gradle Plugin 2 (palantir#1767)
1 parent f4709f7 commit ef84a05

3 files changed

Lines changed: 36 additions & 12 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ fileeditor
4646
*.ipr
4747
*.iws
4848
.idea/
49+
.intellijPlatform/
4950
out/
5051

5152
# Eclipse/IntelliJ APT

‎build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
classpath 'com.palantir.baseline-error-prone:gradle-baseline-error-prone:0.7.0'
1111
classpath 'com.palantir.baseline:gradle-baseline-java:6.80.0'
1212
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:3.19.0'
13-
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.37.0'
13+
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:2.0.0'
1414
classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.21.0'
1515
classpath 'com.palantir.gradle.gitversion:gradle-git-version:5.1.0'
1616
classpath 'com.palantir.gradle.guide:gradle-guide:1.27.0'

‎idea-plugin/build.gradle‎

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,34 @@
1414
* limitations under the License.
1515
*/
1616

17+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
18+
1719
apply plugin: 'java'
1820
apply plugin: 'com.palantir.external-publish-intellij'
1921

2022
def name = "palantir-java-format"
21-
intellij {
22-
pluginName = name
23-
updateSinceUntilBuild = true
24-
version = "2024.1"
25-
plugins = ['java']
23+
repositories {
24+
intellijPlatform {
25+
defaultRepositories()
26+
}
2627
}
2728

28-
patchPluginXml {
29-
pluginDescription = "Formats source code using the palantir-java-format tool."
30-
sinceBuild = '241' // TODO: keep the intellij version & sinceBuild in sync
31-
untilBuild = ''
29+
intellijPlatform {
30+
projectName = name
31+
pluginConfiguration {
32+
description = 'Formats source code using the palantir-java-format tool.'
33+
ideaVersion {
34+
// sinceBuild derives from the intellijIdeaCommunity() version
35+
untilBuild = provider { null }
36+
}
37+
}
38+
pluginVerification {
39+
ides {
40+
create('IC', '2024.1')
41+
create('IU', '2025.3.6.1')
42+
create('IU', '2026.2.2')
43+
}
44+
}
3245
}
3346

3447
configurations {
@@ -42,8 +55,8 @@ configurations {
4255

4356
// This task will resolve runtimeClasspath without telling Gradle that it depends on it, therefore dependent jars won't
4457
// be created beforehand. Therefore, ensure that it knows about it.
45-
// see https://github.com/JetBrains/gradle-intellij-plugin/blob/master/src/main/groovy/org/jetbrains/intellij/tasks/PrepareSandboxTask.groovy
46-
tasks.withType(org.jetbrains.intellij.tasks.PrepareSandboxTask).configureEach {
58+
// see https://github.com/JetBrains/intellij-platform-gradle-plugin/blob/main/src/main/kotlin/org/jetbrains/intellij/platform/gradle/tasks/PrepareSandboxTask.kt
59+
tasks.withType(org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask).configureEach {
4760
dependsOn configurations.runtimeClasspath
4861

4962
// Also pack the formatter in its own directory
@@ -55,6 +68,15 @@ tasks.withType(org.jetbrains.intellij.tasks.PrepareSandboxTask).configureEach {
5568
}
5669

5770
dependencies {
71+
intellijPlatform {
72+
intellijIdeaCommunity('2024.1') {
73+
useInstaller = false
74+
}
75+
bundledPlugins('com.intellij.java')
76+
testFramework(TestFrameworkType.Platform.INSTANCE)
77+
testFramework(TestFrameworkType.Plugin.Java.INSTANCE)
78+
}
79+
5880
implementation project(':palantir-java-format-jdk-bootstrap')
5981
implementation 'com.github.ben-manes.caffeine:caffeine'
6082
implementation('com.palantir.sls.versions:sls-versions') {
@@ -66,6 +88,7 @@ dependencies {
6688
formatter project(':palantir-java-format')
6789

6890
testImplementation 'org.assertj:assertj-core'
91+
testImplementation 'junit:junit'
6992
testImplementation 'org.junit.jupiter:junit-jupiter'
7093
testImplementation 'org.junit.platform:junit-platform-launcher'
7194
implementation 'com.google.code.findbugs:jsr305'

0 commit comments

Comments
 (0)