From 7b4bc5bcc72cb97f781d6521544f556c2a94c3c7 Mon Sep 17 00:00:00 2001 From: Oleg Smelov <79197369+oleg-vinted@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:48:10 +0300 Subject: [PATCH] Sync with template v2.0.1 --- .github/workflows/build.yml | 4 +- .github/workflows/release.yml | 2 +- .gitignore | 1 + .run/Run Plugin Verification.run.xml | 26 --- .run/Run Qodana.run.xml | 23 --- ...ests.run.xml => Run Verifications.run.xml} | 6 +- build.gradle.kts | 158 +++++++++++------- gradle.properties | 8 +- gradle/libs.versions.toml | 19 ++- settings.gradle.kts | 4 - 10 files changed, 121 insertions(+), 130 deletions(-) delete mode 100644 .run/Run Plugin Verification.run.xml delete mode 100644 .run/Run Qodana.run.xml rename .run/{Run IDE for UI Tests.run.xml => Run Verifications.run.xml} (81%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7103e62..030c804 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,8 +73,6 @@ jobs: echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - # Build plugin - name: Build plugin run: ./gradlew buildPlugin @@ -214,7 +212,7 @@ jobs: # Run Verify Plugin task and IntelliJ Plugin Verifier tool - name: Run Plugin Verification tasks - run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} + run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} # Collect Plugin Verifier Result - name: Collect Plugin Verifier Result diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0be11e1..aa06cb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - # Update Unreleased section with the current release note + # Update the Unreleased section with the current release note - name: Patch Changelog if: ${{ steps.properties.outputs.changelog != '' }} env: diff --git a/.gitignore b/.gitignore index e2e5d94..ffabde6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .gradle .idea +.intellijPlatform .qodana build diff --git a/.run/Run Plugin Verification.run.xml b/.run/Run Plugin Verification.run.xml deleted file mode 100644 index 3a8d688..0000000 --- a/.run/Run Plugin Verification.run.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - true - true - false - - - - \ No newline at end of file diff --git a/.run/Run Qodana.run.xml b/.run/Run Qodana.run.xml deleted file mode 100644 index 7e0648e..0000000 --- a/.run/Run Qodana.run.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/.run/Run IDE for UI Tests.run.xml b/.run/Run Verifications.run.xml similarity index 81% rename from .run/Run IDE for UI Tests.run.xml rename to .run/Run Verifications.run.xml index aae857a..b51e78c 100644 --- a/.run/Run IDE for UI Tests.run.xml +++ b/.run/Run Verifications.run.xml @@ -1,5 +1,5 @@ - + - true true diff --git a/build.gradle.kts b/build.gradle.kts index 962daa4..06816ad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,75 +1,62 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML - -fun properties(key: String) = providers.gradleProperty(key) -fun environment(key: String) = providers.environmentVariable(key) +import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { id("java") // Java support alias(libs.plugins.kotlin) // Kotlin support - alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin + alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin alias(libs.plugins.changelog) // Gradle Changelog Plugin alias(libs.plugins.qodana) // Gradle Qodana Plugin alias(libs.plugins.kover) // Gradle Kover Plugin } -group = properties("pluginGroup").get() -version = properties("pluginVersion").get() +group = providers.gradleProperty("pluginGroup").get() +version = providers.gradleProperty("pluginVersion").get() + +// Set the JVM language level used to build the project. +kotlin { + jvmToolchain(17) +} // Configure project's dependencies repositories { mavenCentral() + + // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html + intellijPlatform { + defaultRepositories() + } } // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog dependencies { -// implementation(libs.exampleLibrary) -} + testImplementation(libs.junit) -// Set the JVM language level used to build the project. -kotlin { - jvmToolchain(17) -} + // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html + intellijPlatform { + create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion")) -// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html -intellij { - pluginName = properties("pluginName") - version = properties("platformVersion") - type = properties("platformType") + // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins. + bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') }) - // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } -} + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace. + plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) -// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin -changelog { - groups.empty() - repositoryUrl = properties("pluginRepositoryUrl") -} - -// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration -kover { - reports { - total { - xml { - onCheck = true - } - } + instrumentationTools() + pluginVerifier() + zipSigner() + testFramework(TestFrameworkType.Platform) } } -tasks { - wrapper { - gradleVersion = properties("gradleVersion").get() - } - - patchPluginXml { - version = properties("pluginVersion") - sinceBuild = properties("pluginSinceBuild") - untilBuild = properties("pluginUntilBuild") +// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html +intellijPlatform { + pluginConfiguration { + version = providers.gradleProperty("pluginVersion") // Extract the section from README.md and provide for the plugin's manifest - pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { val start = "" val end = "" @@ -83,7 +70,7 @@ tasks { val changelog = project.changelog // local variable for configuration cache compatibility // Get the latest available change notes from the changelog file - changeNotes = properties("pluginVersion").map { pluginVersion -> + changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion -> with(changelog) { renderItem( (getOrNull(pluginVersion) ?: getUnreleased()) @@ -93,29 +80,78 @@ tasks { ) } } - } - // Configure UI tests plugin - // Read more: https://github.com/JetBrains/intellij-ui-test-robot - runIdeForUiTests { - systemProperty("robot-server.port", "8082") - systemProperty("ide.mac.message.dialogs.as.sheets", "false") - systemProperty("jb.privacy.policy.text", "") - systemProperty("jb.consents.confirmation.enabled", "false") + ideaVersion { + sinceBuild = providers.gradleProperty("pluginSinceBuild") + untilBuild = providers.gradleProperty("pluginUntilBuild") + } } - signPlugin { - certificateChain = environment("CERTIFICATE_CHAIN") - privateKey = environment("PRIVATE_KEY") - password = environment("PRIVATE_KEY_PASSWORD") + signing { + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") + privateKey = providers.environmentVariable("PRIVATE_KEY") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") } - publishPlugin { - dependsOn("patchChangelog") - token = environment("PUBLISH_TOKEN") + publishing { + token = providers.environmentVariable("PUBLISH_TOKEN") // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } + channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } + } + + pluginVerification { + ides { + recommended() + } + } +} + +// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin +changelog { + groups.empty() + repositoryUrl = providers.gradleProperty("pluginRepositoryUrl") +} + +// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration +kover { + reports { + total { + xml { + onCheck = true + } + } + } +} + +tasks { + wrapper { + gradleVersion = providers.gradleProperty("gradleVersion").get() + } + + publishPlugin { + dependsOn(patchChangelog) + } +} + +intellijPlatformTesting { + runIde { + register("runIdeForUiTests") { + task { + jvmArgumentProviders += CommandLineArgumentProvider { + listOf( + "-Drobot-server.port=8082", + "-Dide.mac.message.dialogs.as.sheets=false", + "-Djb.privacy.policy.text=", + "-Djb.consents.confirmation.enabled=false", + ) + } + } + + plugins { + robotServerPlugin() + } + } } } diff --git a/gradle.properties b/gradle.properties index fe3328d..98f92f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,16 +7,18 @@ pluginRepositoryUrl = https://github.com/vinted/packwerk-intellij pluginVersion = 0.0.9 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -pluginSinceBuild = 232 +pluginSinceBuild = 233 pluginUntilBuild = 242.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IU -platformVersion = 2023.2.7 +platformVersion = 2023.3.7 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html -# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 +# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP platformPlugins = org.jetbrains.plugins.ruby:232.10300.40 +# Example: platformBundledPlugins = com.intellij.java +platformBundledPlugins = # Gradle Releases -> https://github.com/gradle/gradle/releases gradleVersion = 8.9 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0af76e4..dfed70a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,20 @@ [versions] -kotlin = "1.9.24" -changelog = "2.2.0" -gradleIntelliJPlugin = "1.17.4" -qodana = "2024.1.5" -kover = "0.8.1" +# libraries +junit = "4.13.2" + +# plugins +changelog = "2.2.1" +intelliJPlatform = "2.0.1" +kotlin = "1.9.25" +kover = "0.8.3" +qodana = "2024.1.9" + +[libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } -gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } +intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 938207f..8ad9b67 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1 @@ -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" -} - rootProject.name = "packwerk-intellij"