From 15e926b78423fc146fbc4a982c23424451952b42 Mon Sep 17 00:00:00 2001 From: Matthias Maeller Date: Wed, 14 Aug 2024 07:58:47 +0200 Subject: [PATCH 1/2] Migrate to IntelliJ Platform Gradle Plugin 2.0 --- idea_plugin/.gitignore | 3 +- idea_plugin/build.gradle.kts | 53 +++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/idea_plugin/.gitignore b/idea_plugin/.gitignore index 16bc65a53..a5e690ca2 100644 --- a/idea_plugin/.gitignore +++ b/idea_plugin/.gitignore @@ -2,4 +2,5 @@ build .gradle gradle gradlew -gradlew.bat \ No newline at end of file +gradlew.bat +.intellijPlatform \ No newline at end of file diff --git a/idea_plugin/build.gradle.kts b/idea_plugin/build.gradle.kts index 0ba5032dc..4e4df15de 100644 --- a/idea_plugin/build.gradle.kts +++ b/idea_plugin/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.intellij.platform.gradle.TestFrameworkType /* * Copyright 2017 Google Inc. All Rights Reserved. * @@ -15,40 +16,42 @@ */ // https://github.com/JetBrains/intellij-platform-gradle-plugin/releases -plugins { id("org.jetbrains.intellij") version "1.17.3" } - -apply(plugin = "org.jetbrains.intellij") +plugins { + id("org.jetbrains.intellij.platform") version "2.0.1" +} -apply(plugin = "java") +repositories { + mavenCentral() -repositories { mavenCentral() } + intellijPlatform { + defaultRepositories() + } +} // https://github.com/google/google-java-format/releases -val googleJavaFormatVersion = "1.22.0" +val googleJavaFormatVersion = "1.23.0" java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 -} - -intellij { - pluginName.set("google-java-format") - plugins.set(listOf("java")) - version.set("2021.3") + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -tasks { - patchPluginXml { - version.set("${googleJavaFormatVersion}.0") - sinceBuild.set("213") - untilBuild.set("") +intellijPlatform { + pluginConfiguration { + name = "google-java-format" + version = "${googleJavaFormatVersion}.0" + ideaVersion { + sinceBuild = "223" + untilBuild = "" + } } - publishPlugin { - val jetbrainsPluginRepoToken: String by project - token.set(jetbrainsPluginRepoToken) + publishing { + token = System.getenv("ORG_GRADLE_PROJECT_intellijPlatform.publishing.token") } +} +tasks { withType().configureEach { jvmArgs( "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", @@ -62,6 +65,12 @@ tasks { } dependencies { + intellijPlatform { + intellijIdeaCommunity("2022.3") + bundledPlugin("com.intellij.java") + instrumentationTools() + testFramework(TestFrameworkType.Plugin.Java) + } implementation("com.google.googlejavaformat:google-java-format:${googleJavaFormatVersion}") // https://mvnrepository.com/artifact/junit/junit testImplementation("junit:junit:4.13.2") From abed210e6c6da515e4d147b28a4058d7f1ef2c3d Mon Sep 17 00:00:00 2001 From: Matthias Maeller Date: Fri, 16 Aug 2024 09:44:10 +0200 Subject: [PATCH 2/2] Revert googleJavaFormatVersion --- idea_plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idea_plugin/build.gradle.kts b/idea_plugin/build.gradle.kts index 4e4df15de..3ece2f3fa 100644 --- a/idea_plugin/build.gradle.kts +++ b/idea_plugin/build.gradle.kts @@ -29,7 +29,7 @@ repositories { } // https://github.com/google/google-java-format/releases -val googleJavaFormatVersion = "1.23.0" +val googleJavaFormatVersion = "1.22.0" java { sourceCompatibility = JavaVersion.VERSION_17