diff --git a/.gitignore b/.gitignore index e2e5d94e..ffabde68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .gradle .idea +.intellijPlatform .qodana build diff --git a/CHANGELOG.md b/CHANGELOG.md index d33499e5..e604e8f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ ## [Unreleased] +## [2.0.0] - 2024-08-03 + +### Changed + +- Migrate to intellij-platform-gradle-plugin v2.0.0 +- Support JetBrains 2024.2+ IDEs + +### Removed + +- Drop not perfectly working feature for the PyCharm Community & Professional + +## [1.3.0] - 2024-08-03 + +### Added + +- Add environment variables (run configuration) support for the PyCharm Community & Professional + ## [1.2.1] - 2024-07-24 - Remove screenshots from plugin.xml. (JetBrains Marketplace guidelines) @@ -30,7 +47,9 @@ - Support JDK integration from mise tools. -[Unreleased]: https://github.com/134130/intellij-mise/compare/v1.2.1...HEAD +[Unreleased]: https://github.com/134130/intellij-mise/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/134130/intellij-mise/compare/v1.3.0...v2.0.0 +[1.3.0]: https://github.com/134130/intellij-mise/compare/v1.2.1...v1.3.0 [1.2.1]: https://github.com/134130/intellij-mise/compare/v1.2.0...v1.2.1 [1.2.0]: https://github.com/134130/intellij-mise/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/134130/intellij-mise/compare/v1.0.1...v1.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..61a53a95 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +# Contributing to the IntelliJ Mise Plugin + +## Running other IDEs for testing +As this plugin targets multiple IDEs, when developing you'll want to test against a specific IDE. + +You can get a list of available tasks for running the plugin in different IDEs by running the following command: +```shell +./gradlew tasks --group='intellij platform' | grep -E '^run' +``` + +> [!TIP] +> If you want to test other version of IDEs, you can change the version field in the [build.gradle.kts](./build.gradle.kts) file. diff --git a/build.gradle.kts b/build.gradle.kts index e369b99a..60ce29ca 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,111 +1,54 @@ 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.IntelliJPlatformType plugins { id("java") // Java support + id("org.jetbrains.intellij.platform") // IntelliJ Platform Gradle Plugin + + alias(libs.plugins.gradleIdeaExt) // IntelliJ Gradle IDEA Extension Plugin alias(libs.plugins.kotlin) // Kotlin support - alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ 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() - -// Configure project's dependencies -allprojects { - group = group - version = version - - apply(plugin = "java") - - repositories { - mavenCentral() - } -} - -// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog -dependencies { - implementation(project(":mise-products-idea")) - implementation(project(":mise-products-gradle")) - implementation(project(":mise-products-goland")) - implementation(project(":mise-products-nodejs")) -} +group = providers.gradleProperty("pluginGroup").get() +version = providers.gradleProperty("pluginVersion").get() // Set the JVM language level used to build the project. kotlin { jvmToolchain(17) } -// 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) } - plugins.set("".split(',').map(String::trim).filter(String::isNotEmpty)) -} +// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog +dependencies { + testImplementation(libs.junit) -// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin -changelog { - groups.empty() - repositoryUrl = properties("pluginRepositoryUrl") -} + intellijPlatform { + create(IntelliJPlatformType.IntellijIdeaCommunity, "2022.3.3", false) -// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration -kover { - reports { - total { - xml { - onCheck = true - } - } - } -} + pluginModule(implementation(project(":mise-products-goland"))) + pluginModule(implementation(project(":mise-products-gradle"))) + pluginModule(implementation(project(":mise-products-idea"))) + pluginModule(implementation(project(":mise-products-nodejs"))) + pluginModule(implementation(project(":mise-products-pythoncore"))) + pluginModule(implementation(project(":mise-products-pythonid"))) -gradle.taskGraph.whenReady( - closureOf { - val ignoreSubprojectTasks = - listOf( - "buildSearchableOptions", - "listProductsReleases", - "patchPluginXml", - "publishPlugin", - "runIde", - "runPluginVerifier", - "verifyPlugin", - ) - - // Don't run some tasks for subprojects - for (task in allTasks) { - if (task.project != task.project.rootProject) { - when (task.name) { - in ignoreSubprojectTasks -> task.enabled = false - } - } - } - }, -) + plugins(listOf()) -tasks { - wrapper { - gradleVersion = properties("gradleVersion").get() + instrumentationTools() } +} - patchPluginXml { - version = properties("pluginVersion") - sinceBuild = properties("pluginSinceBuild") - untilBuild = properties("pluginUntilBuild") +// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html +intellijPlatform { + pluginConfiguration { + version = providers.gradleProperty("platformVersion") // Extract the section from README.md and provide for the plugin's manifest - pluginDescription = + description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { val start = "" val end = "" @@ -121,7 +64,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 -> + providers.gradleProperty("pluginVersion").map { pluginVersion -> with(changelog) { renderItem( (getOrNull(pluginVersion) ?: getUnreleased()) @@ -131,29 +74,79 @@ tasks { ) } } + + ideaVersion { + sinceBuild = providers.gradleProperty("pluginSinceBuild") + untilBuild = providers.gradleProperty("pluginUntilBuild") + } + + name = providers.gradleProperty("pluginName") } +} - // 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") +// 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 + } + } } +} - 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) + } +} + +val runIdeForUnitTests 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(Constraints.LATEST_VERSION) + } +} + +val runIdePlatformTypes = + listOf( + IntelliJPlatformType.GoLand, + IntelliJPlatformType.IntellijIdeaCommunity, + IntelliJPlatformType.IntellijIdeaUltimate, + IntelliJPlatformType.WebStorm, + IntelliJPlatformType.PyCharmCommunity, + IntelliJPlatformType.PyCharmProfessional, + ) + +runIdePlatformTypes.forEach { platformType -> + intellijPlatformTesting.runIde.register("run${platformType.name}") { + type = platformType + version = "2024.1" + + plugins { +// plugin("pluginId", "1.0.0") + disablePlugin("bundledPluginId") + } } } diff --git a/gradle.properties b/gradle.properties index 9f95dbd5..79b6239d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,11 @@ pluginGroup = com.github.l34130.mise pluginName = mise pluginRepositoryUrl = https://github.com/134130/intellij-mise # SemVer format -> https://semver.org -pluginVersion = 1.2.1 +pluginVersion = 2.0.0 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 -pluginUntilBuild = 241.* - -# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension -platformType = IU -platformVersion = 2022.3.3 +pluginUntilBuild = # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b423ded6..666b6cd4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,20 +1,20 @@ [versions] # libraries -exampleLibrary = "24.1.0" +junit = "4.13.2" # plugins kotlin = "2.0.0" changelog = "2.2.1" -gradleIntelliJPlugin = "1.17.4" -qodana = "2024.1.8" +gradleIdeaExt = "1.1.8" +qodana = "2024.1.5" kover = "0.8.3" [libraries] -exampleLibrary = { group = "com.example", name = "exampleLibrary", version.ref = "exampleLibrary" } +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" } +gradleIdeaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "gradleIdeaExt" } 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/modules/core/build.gradle.kts b/modules/core/build.gradle.kts index 09d10fd5..154a3168 100644 --- a/modules/core/build.gradle.kts +++ b/modules/core/build.gradle.kts @@ -1,15 +1,20 @@ +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType + fun properties(key: String) = project.findProperty(key).toString() plugins { - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform.module") alias(libs.plugins.kotlin) // Kotlin support } dependencies { - testImplementation("org.junit.jupiter:junit-jupiter:5.10.3") -} + testImplementation("org.junit.jupiter:junit-jupiter") + + intellijPlatform { + create(IntelliJPlatformType.IntellijIdeaCommunity, properties("platformVersion"), false) + + bundledPlugin("com.intellij.java") -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - version.set(properties("platformVersion")) + instrumentationTools() + } } diff --git a/modules/products/goland/build.gradle.kts b/modules/products/goland/build.gradle.kts index 241c21c4..e942eee5 100644 --- a/modules/products/goland/build.gradle.kts +++ b/modules/products/goland/build.gradle.kts @@ -1,19 +1,21 @@ +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType + fun properties(key: String) = project.findProperty(key).toString() plugins { - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform.module") alias(libs.plugins.kotlin) // Kotlin support } -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - version.set(properties("platformVersion")) - type.set("GO") - - // Plugin Dependencies - plugins.set(listOf("org.jetbrains.plugins.go")) -} - dependencies { implementation(project(":mise-core")) + + // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin + intellijPlatform { + create(IntelliJPlatformType.GoLand, properties("platformVersion"), false) + + bundledPlugin("org.jetbrains.plugins.go") + + instrumentationTools() + } } diff --git a/modules/products/gradle/build.gradle.kts b/modules/products/gradle/build.gradle.kts index 5821e435..2d86ca88 100644 --- a/modules/products/gradle/build.gradle.kts +++ b/modules/products/gradle/build.gradle.kts @@ -1,18 +1,22 @@ +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType + fun properties(key: String) = project.findProperty(key).toString() plugins { - id("org.jetbrains.intellij") + id("org.jetbrains.gradle.plugin.idea-ext") + id("org.jetbrains.intellij.platform.module") alias(libs.plugins.kotlin) // Kotlin support } -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - version.set(properties("platformVersion")) - - // Plugin Dependencies - plugins.set(listOf("com.intellij.java", "com.intellij.gradle")) -} - dependencies { implementation(project(":mise-core")) + + // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin + intellijPlatform { + create(IntelliJPlatformType.IntellijIdeaCommunity, properties("platformVersion"), false) + + bundledPlugins("com.intellij.java", "com.intellij.gradle") + + instrumentationTools() + } } diff --git a/modules/products/idea/build.gradle.kts b/modules/products/idea/build.gradle.kts index 28ac9678..ecb566bb 100644 --- a/modules/products/idea/build.gradle.kts +++ b/modules/products/idea/build.gradle.kts @@ -1,18 +1,21 @@ +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType + fun properties(key: String) = project.findProperty(key).toString() plugins { - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform.module") alias(libs.plugins.kotlin) // Kotlin support } -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - version.set(properties("platformVersion")) - - // Plugin Dependencies - plugins.set(listOf("com.intellij.java")) -} - dependencies { implementation(project(":mise-core")) + + // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin + intellijPlatform { + create(IntelliJPlatformType.IntellijIdeaCommunity, properties("platformVersion"), false) + + bundledPlugin("com.intellij.java") + + instrumentationTools() + } } diff --git a/modules/products/nodejs/build.gradle.kts b/modules/products/nodejs/build.gradle.kts index 3afa827d..c6fb0557 100644 --- a/modules/products/nodejs/build.gradle.kts +++ b/modules/products/nodejs/build.gradle.kts @@ -1,19 +1,21 @@ +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType + fun properties(key: String) = project.findProperty(key).toString() plugins { - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform.module") alias(libs.plugins.kotlin) // Kotlin support } -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - version.set(properties("platformVersion")) - type.set("IU") - - // Plugin Dependencies - plugins.set(listOf("JavaScript", "NodeJS")) -} - dependencies { implementation(project(":mise-core")) + + // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin + intellijPlatform { + create(IntelliJPlatformType.WebStorm, properties("platformVersion"), false) + + bundledPlugins("JavaScript", "NodeJS") + + instrumentationTools() + } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 16cf7466..1bce637c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,23 @@ +import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform + +plugins { + id("org.jetbrains.intellij.platform.settings") version "2.0.0" +} + +dependencyResolutionManagement { + repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS + + // 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() + } + } +} + include( "modules/core", "modules/products/idea",