From 7eb46ca0fcc4a239563ba78c2016d5129284d763 Mon Sep 17 00:00:00 2001 From: DeKaN Date: Sun, 29 Sep 2024 16:58:55 +0400 Subject: [PATCH 1/6] Migrate to new IntelliJ Gradle Plugin --- .gitignore | 1 + build.gradle.kts | 50 +++++++++++++++++------- gradle.properties | 6 ++- gradle/libs.versions.toml | 6 +-- gradle/wrapper/gradle-wrapper.properties | 4 +- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index ebd39ef..63f5961 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ fabric.properties /gitmoji-plugin.jar .idea/ *.iml +.intellijPlatform/ /build/ /.gradle/ diff --git a/build.gradle.kts b/build.gradle.kts index 645bcef..f3941a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,7 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType +import org.jetbrains.intellij.platform.gradle.models.ProductRelease fun properties(key: String) = providers.gradleProperty(key) fun environment(key: String) = providers.environmentVariable(key) @@ -18,8 +20,11 @@ version = properties("pluginVersion").get() // Configure project's dependencies repositories { - maven("https://www.jetbrains.com/intellij-repository/snapshots/") mavenCentral() + intellijPlatform { + defaultRepositories() + jetbrainsRuntime() + } } // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog @@ -28,6 +33,16 @@ dependencies { implementation("com.google.code.gson:gson:2.11.0") implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation("org.yaml:snakeyaml:2.2") + intellijPlatform { + create(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false) + jetbrainsRuntime() + plugins( + properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } + ) + bundledPlugins( + properties("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } + ) + } } // Set the JVM language level used to build the project. @@ -36,13 +51,10 @@ kotlin { } // 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 `platformPlugins` property from the gradle.properties file. - plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } +intellijPlatform { + pluginConfiguration { + name = properties("pluginName") + } } // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin @@ -102,11 +114,21 @@ 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") + val runIdeForUiTests by intellijPlatformTesting.runIde.registering { + 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() + } } signPlugin { @@ -123,4 +145,4 @@ tasks { // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 9180681..394cbcd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,10 @@ platformType = IC platformVersion = 2024.1 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html -# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 +# Note: Bundled plugins are now defined separately from plugins of other sources (like JetBrains Marketplace). +# Example: platformBundledPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = +platformBundledPlugins = # Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3 javaVersion = 17 @@ -36,4 +38,4 @@ org.gradle.configuration-cache = true org.gradle.caching = true # Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment -systemProp.org.gradle.unsafe.kotlin.assignment = true \ No newline at end of file +systemProp.org.gradle.unsafe.kotlin.assignment = true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ed42a18..edd9b58 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ # plugins kotlin = "2.0.0" changelog = "2.2.1" -gradleIntelliJPlugin = "1.17.4" +gradleIntelliJPlugin = "2.1.0" qodana = "2024.1.5" kover = "0.8.3" @@ -12,7 +12,7 @@ kover = "0.8.3" [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } -gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } +gradleIntelliJPlugin = { id = "org.jetbrains.intellij.platform", version.ref = "gradleIntelliJPlugin" } 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" } \ No newline at end of file +qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 92c1ac1..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists From 2598ad367bfbf082a670b6145ce450308ce06257 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Mon, 30 Sep 2024 02:16:58 +0400 Subject: [PATCH 2/6] Trying to fix workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ffc2b89..9e51ee2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,7 +73,7 @@ jobs: echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + ./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier # Build plugin - name: Build plugin From 672bf980f055b7d964f44b73ee11935798d73291 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Mon, 30 Sep 2024 09:09:41 +0400 Subject: [PATCH 3/6] Add missed dependencies --- build.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index f3941a5..95b52f5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType import org.jetbrains.intellij.platform.gradle.models.ProductRelease +import org.jetbrains.intellij.platform.gradle.TestFrameworkType fun properties(key: String) = providers.gradleProperty(key) fun environment(key: String) = providers.environmentVariable(key) @@ -42,6 +43,11 @@ dependencies { bundledPlugins( properties("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } ) + pluginVerifier() + zipSigner() + instrumentationTools() + + testFramework(TestFrameworkType.Platform) } } From bd63e12f6581ed2e262e11aad0b5a8f03e022502 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Mon, 30 Sep 2024 22:43:25 +0400 Subject: [PATCH 4/6] Fix verifyPlugin task --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9e51ee2..42a35e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ # - Run 'test' and 'verifyPlugin' tasks. # - Run Qodana inspections. # - Run the 'buildPlugin' task and prepare artifact for further tests. -# - Run the 'runPluginVerifier' task. +# - Run the 'verifyPlugin' task. # - Create a draft release. # # The workflow is triggered on push and pull_request events. @@ -214,7 +214,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 From 6992885efaaf295ab91942fd703a6be23ea4f0f9 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Tue, 1 Oct 2024 02:31:49 +0400 Subject: [PATCH 5/6] Fix verifyPlugin task --- build.gradle.kts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 95b52f5..fc26e59 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ import org.jetbrains.intellij.platform.gradle.TestFrameworkType fun properties(key: String) = providers.gradleProperty(key) fun environment(key: String) = providers.environmentVariable(key) +fun Provider.toList() = map { it.split(',').mapNotNull { s -> s.trim().takeIf(String::isNotEmpty) } } plugins { id("java") // Java support @@ -38,10 +39,10 @@ dependencies { create(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false) jetbrainsRuntime() plugins( - properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } + properties("platformPlugins").toList() ) bundledPlugins( - properties("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } + properties("platformBundledPlugins").toList() ) pluginVerifier() zipSigner() @@ -61,6 +62,12 @@ intellijPlatform { pluginConfiguration { name = properties("pluginName") } + pluginVerification { + freeArgs = listOf("-mute", "TemplateWordInPluginName") + ides { + ide(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false) + } + } } // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin @@ -87,7 +94,7 @@ tasks { } patchPluginXml { - version = properties("pluginVersion") + version = properties("pluginVersion").get() sinceBuild = properties("pluginSinceBuild") untilBuild = properties("pluginUntilBuild") From 523a82dcd271df2b0f8d1b99acfdcc3be1b1ec86 Mon Sep 17 00:00:00 2001 From: Patrice de Saint Steban Date: Wed, 2 Oct 2024 22:57:53 +0200 Subject: [PATCH 6/6] :construction_worker: Update build system --- .github/workflows/build.yml | 39 +++---- .github/workflows/release.yml | 8 +- .github/workflows/run-ui-tests.yml | 14 +-- build.gradle.kts | 178 ++++++++++++++--------------- gradle.properties | 4 +- gradle/libs.versions.toml | 10 +- settings.gradle.kts | 4 + 7 files changed, 127 insertions(+), 130 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42a35e6..68ee096 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ # - Run 'test' and 'verifyPlugin' tasks. # - Run Qodana inspections. # - Run the 'buildPlugin' task and prepare artifact for further tests. -# - Run the 'verifyPlugin' task. +# - Run the 'runPluginVerifier' task. # - Create a draft release. # # The workflow is triggered on push and pull_request events. @@ -16,12 +16,12 @@ name: Build on: # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests) push: - branches: [ master ] + branches: [ main ] # Trigger the workflow on any pull request pull_request: concurrency: - group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}" + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: @@ -36,13 +36,13 @@ jobs: pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} steps: - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 # Validate wrapper - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v3 + uses: gradle/actions/wrapper-validation@v3 # Set up Java environment for the next steps - name: Setup Java @@ -53,9 +53,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true + uses: gradle/actions/setup-gradle@v4 # Set environment variables - name: Export Properties @@ -73,8 +71,6 @@ jobs: echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - ./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier - # Build plugin - name: Build plugin run: ./gradlew buildPlugin @@ -104,7 +100,7 @@ jobs: runs-on: ubuntu-latest steps: - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 @@ -117,9 +113,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true + uses: gradle/actions/setup-gradle@v4 # Run tests - name: Run Tests @@ -157,9 +151,12 @@ jobs: tool-cache: false large-packages: false - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit + fetch-depth: 0 # a full history is required for pull request analysis # Set up Java environment for the next steps - name: Setup Java @@ -170,7 +167,7 @@ jobs: # Run Qodana inspections - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2024.1.8 + uses: JetBrains/qodana-action@v2024.2 with: cache-default-branch-only: true @@ -188,7 +185,7 @@ jobs: tool-cache: false large-packages: false - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 @@ -201,9 +198,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true + uses: gradle/actions/setup-gradle@v4 # Cache Plugin Verifier IDEs - name: Setup Plugin Verifier IDEs Cache @@ -235,7 +230,7 @@ jobs: contents: write steps: - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 @@ -259,4 +254,4 @@ jobs: --notes "$(cat << 'EOM' ${{ needs.build.outputs.changelog }} EOM - )" + )" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4898779..c5176d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write steps: - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 with: @@ -33,9 +33,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true + uses: gradle/actions/setup-gradle@v4 # Set environment variables - name: Export Properties @@ -51,7 +49,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/.github/workflows/run-ui-tests.yml b/.github/workflows/run-ui-tests.yml index 61cba95..c15022d 100644 --- a/.github/workflows/run-ui-tests.yml +++ b/.github/workflows/run-ui-tests.yml @@ -1,9 +1,9 @@ # GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps: -# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI -# - wait for IDE to start -# - run UI tests with separate Gradle task +# - Prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with the UI. +# - Wait for IDE to start. +# - Run UI tests with a separate Gradle task. # -# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform +# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform. # # Workflow is triggered manually. @@ -31,11 +31,11 @@ jobs: steps: - # Check out current repository + # Check out the current repository - name: Fetch Sources uses: actions/checkout@v4 - # Setup Java environment for the next steps + # Set up Java environment for the next steps - name: Setup Java uses: actions/setup-java@v4 with: @@ -44,7 +44,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v4 # Run IDEA prepared for UI testing - name: Run IDE diff --git a/build.gradle.kts b/build.gradle.kts index fc26e59..e0c9cb9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,31 +1,31 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType -import org.jetbrains.intellij.platform.gradle.models.ProductRelease import org.jetbrains.intellij.platform.gradle.TestFrameworkType -fun properties(key: String) = providers.gradleProperty(key) -fun environment(key: String) = providers.environmentVariable(key) -fun Provider.toList() = map { it.split(',').mapNotNull { s -> s.trim().takeIf(String::isNotEmpty) } } - 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() - jetbrainsRuntime() } } @@ -35,75 +35,34 @@ dependencies { implementation("com.google.code.gson:gson:2.11.0") implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation("org.yaml:snakeyaml:2.2") + testImplementation(libs.junit) intellijPlatform { - create(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false) - jetbrainsRuntime() - plugins( - properties("platformPlugins").toList() - ) - bundledPlugins( - properties("platformBundledPlugins").toList() - ) + create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion")) + + // 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 for plugin from JetBrains Marketplace. + plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) + + instrumentationTools() pluginVerifier() zipSigner() - instrumentationTools() - testFramework(TestFrameworkType.Platform) } } -// Set the JVM language level used to build the project. -kotlin { - jvmToolchain(Integer.parseInt(properties("javaVersion").get())) -} - -// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html +// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html intellijPlatform { pluginConfiguration { - name = properties("pluginName") - } - pluginVerification { - freeArgs = listOf("-mute", "TemplateWordInPluginName") - ides { - ide(type = properties("platformType"), version = properties("platformVersion"), useInstaller = false) - } - } -} - -// 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 - } - } - } -} - -tasks { - wrapper { - gradleVersion = properties("gradleVersion").get() - } - - patchPluginXml { - version = properties("pluginVersion").get() - sinceBuild = properties("pluginSinceBuild") - untilBuild = properties("pluginUntilBuild") + 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 = "" - with (it.lines()) { + with(it.lines()) { if (!containsAll(listOf(start, end))) { throw GradleException("Plugin description section not found in README.md:\n$start ... $end") } @@ -113,7 +72,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()) @@ -123,39 +82,78 @@ tasks { ) } } + + ideaVersion { + sinceBuild = providers.gradleProperty("pluginSinceBuild") + untilBuild = providers.gradleProperty("pluginUntilBuild") + } } - // Configure UI tests plugin - // Read more: https://github.com/JetBrains/intellij-ui-test-robot - val runIdeForUiTests by intellijPlatformTesting.runIde.registering { - task { - jvmArgumentProviders += CommandLineArgumentProvider { - listOf( - "-Drobot-server.port=8082", - "-Dide.mac.message.dialogs.as.sheets=false", - "-Djb.privacy.policy.text=", - "-Djb.consents.confirmation.enabled=false", - ) - } + signing { + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") + privateKey = providers.environmentVariable("PRIVATE_KEY") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") + } + + 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 = 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") +} - plugins { - robotServerPlugin() +// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration +kover { + reports { + total { + xml { + onCheck = true + } } } +} - signPlugin { - certificateChain = environment("CERTIFICATE_CHAIN") - privateKey = environment("PRIVATE_KEY") - password = environment("PRIVATE_KEY_PASSWORD") +tasks { + wrapper { + gradleVersion = providers.gradleProperty("gradleVersion").get() } publishPlugin { - dependsOn("patchChangelog") - token = environment("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" }) } + 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() + } + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 394cbcd..4ef719e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ pluginVersion = 2.1.0 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. pluginSinceBuild = 233 -pluginUntilBuild = 242.* +pluginUntilBuild = 243.* # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties platformType = IC @@ -26,7 +26,7 @@ platformBundledPlugins = javaVersion = 17 # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 8.6 +gradleVersion = 8.10.2 # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency = false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index edd9b58..4c2f43f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,18 +1,20 @@ [versions] # libraries +junit = "4.13.2" # plugins -kotlin = "2.0.0" changelog = "2.2.1" -gradleIntelliJPlugin = "2.1.0" -qodana = "2024.1.5" +intelliJPlatform = "2.1.0" +kotlin = "1.9.25" kover = "0.8.3" +qodana = "2024.2.3" [libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } -gradleIntelliJPlugin = { id = "org.jetbrains.intellij.platform", 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 e12fec0..9c1aaf0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,5 @@ rootProject.name = "gitmoji-intellij-plugin" + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} \ No newline at end of file