diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80a6f47..8c53809 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,9 +212,9 @@ jobs: # Run Verify Plugin task and IntelliJ Plugin Verifier tool - name: Run Plugin Verification tasks - run: exit 0 + # run: exit 0 # Disabled until it works again for a lot of IDEs (https://github.com/JetBrains/intellij-platform-plugin-template/issues/462) - # 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 3ff2458..ffa9317 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 1e63c8f..74b8fb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .gradle/ +.kotlin/ .idea/* !.idea/icon.svg +.intelliJPlatform/ .qodana build/ .DS_Store diff --git a/.run/Run IDE for UI Tests.run.xml b/.run/Run IDE for UI Tests.run.xml deleted file mode 100644 index ee99b7e..0000000 --- a/.run/Run IDE for UI Tests.run.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - true - true - false - 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 041d5e6..0000000 --- a/.run/Run Qodana.run.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - true - true - false - false - - - diff --git a/.run/Run Verifications.run.xml b/.run/Run Verifications.run.xml index 3a8d688..4ce7700 100644 --- a/.run/Run Verifications.run.xml +++ b/.run/Run Verifications.run.xml @@ -1,26 +1,25 @@ - - - - - - - true - true - false - - - - \ No newline at end of file + + + + + + + true + true + false + false + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e22a1..a2dc777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ ### Added - Add a notification when component dependencies fail to install or uninstall +- Add a dependency to the Webpack extension due to the newer Vue extension (#55) + +### Removed + +- Drop support for 2021.3, 2022.1 and 2022.2 IDEs (#55) ## [0.8.5] - 2024-06-22 diff --git a/build.gradle.kts b/build.gradle.kts index 49e0d39..6c19d3e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,77 +1,66 @@ 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.Constants.Constraints +import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { id("java") // Java support alias(libs.plugins.kotlin) // Kotlin support kotlin(libs.plugins.serialization.get().pluginId) version libs.versions.kotlin // Kotlin Serialization 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() gradlePluginPortal() + + // 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.serialization) -} + implementation(libs.serialization) + testImplementation(libs.junit) -// Set the JVM language level used to build the project. -kotlin { - jvmToolchain(11) -} - -// 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") + // 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")) - // 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 `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins. + bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') }) -// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin -changelog { - groups.empty() - repositoryUrl = properties("pluginRepositoryUrl") -} + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace. + plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) -// 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 = "" @@ -85,44 +74,85 @@ 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()) .withHeader(false) .withEmptySections(false), - Changelog.OutputType.HTML, + Changelog.OutputType.HTML ) } } - } - // 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").map { it.ifEmpty { null } } + } } - 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 { + 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) + } +} + +val runIdeForUiTests by intellijPlatformTesting.runIde.registering { + task { + jvmArgumentProviders += CommandLineArgumentProvider { listOf( - it.substringAfter('-', "") - .substringBefore('.').ifEmpty { "default" } + "-Drobot-server.port=8082", + "-Dide.mac.message.dialogs.as.sheets=false", + "-Djb.privacy.policy.text=", + "-Djb.consents.confirmation.enabled=false" ) } } + + plugins { + robotServerPlugin(Constraints.LATEST_VERSION) + } } diff --git a/gradle.properties b/gradle.properties index 366dfd7..c2f7a72 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,19 +4,21 @@ pluginGroup = com.github.warningimhack3r.intellijshadcnplugin pluginName = intellij-shadcn-plugin pluginRepositoryUrl = https://github.com/WarningImHack3r/intellij-shadcn-plugin # SemVer format -> https://semver.org -pluginVersion = 0.8.5 +pluginVersion = 0.9.0 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -pluginSinceBuild = 213 +pluginSinceBuild = 223 pluginUntilBuild = # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IU -platformVersion = 2021.3 +platformVersion = 2022.3 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html -# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 -platformPlugins = JavaScript, dev.blachut.svelte.lang:0.21.1, org.jetbrains.plugins.vue:213.5744.223 +# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP +platformPlugins = dev.blachut.svelte.lang:223.7571.203, org.jetbrains.plugins.vue:223.7571.233 +# Example: platformBundledPlugins = com.intellij.java +platformBundledPlugins = JavaScript, intellij.webpack # Gradle Releases -> https://github.com/gradle/gradle/releases gradleVersion = 8.9 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7d72550..331a5cd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,17 +1,22 @@ [versions] -kotlin = "1.9.24" -serialization = "1.6.3" +# libraries +junit = "4.13.2" + +# plugins changelog = "2.2.1" -gradleIntelliJPlugin = "1.17.4" +intellijPlatform = "2.0.0" +kotlin = "2.0.0" +serialization = "1.7.1" +kover = "0.8.3" qodana = "2024.1.5" -kover = "0.8.2" [libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" } [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" } serialization = { id = "plugin.serialization", version.ref = "kotlin" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } diff --git a/qodana.yml b/qodana.yml index 200f48c..cbf640f 100644 --- a/qodana.yml +++ b/qodana.yml @@ -3,7 +3,7 @@ version: 1.0 linter: jetbrains/qodana-jvm-community:latest -projectJDK: "11" +projectJDK: "17" profile: name: qodana.recommended exclude: diff --git a/settings.gradle.kts b/settings.gradle.kts index f783c57..631ea13 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 = "intellij-shadcn-plugin" diff --git a/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/helpers/DependencyManager.kt b/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/helpers/DependencyManager.kt index 61d4608..4ad48bf 100644 --- a/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/helpers/DependencyManager.kt +++ b/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/helpers/DependencyManager.kt @@ -42,7 +42,7 @@ class DependencyManager(private val project: Project) { private fun getPackageManager(): PackageManager? { val fileManager = FileManager.getInstance(project) - return enumValues().firstOrNull { packageManager -> + return PackageManager.entries.firstOrNull { packageManager -> packageManager.getLockFilesNames().any { lockFile -> fileManager.getVirtualFilesByName(lockFile).isNotEmpty() } diff --git a/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/errorsubmitter/ErrorThrowingAction.kt b/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/errorsubmitter/ErrorThrowingAction.kt index 73d06ea..a0cfaef 100644 --- a/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/errorsubmitter/ErrorThrowingAction.kt +++ b/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/errorsubmitter/ErrorThrowingAction.kt @@ -1,7 +1,7 @@ package com.github.warningimhack3r.intellijshadcnplugin.errorsubmitter +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.UpdateInBackground import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.project.DumbAwareAction @@ -14,11 +14,15 @@ import com.intellij.openapi.project.DumbAwareAction * #com.github.warningimhack3r.intellijshadcnplugin.errorreport.ErrorThrowingAction * ``` */ -class ErrorThrowingAction : DumbAwareAction(), UpdateInBackground { +class ErrorThrowingAction : DumbAwareAction() { companion object { private val LOG = logger() } + override fun getActionUpdateThread(): ActionUpdateThread { + return ActionUpdateThread.BGT + } + override fun update(e: AnActionEvent) { e.presentation.isEnabledAndVisible = LOG.isDebugEnabled }