Skip to content

Commit

Permalink
Migrate to intellij-platform-gradle-plugin v2.0.0 (#14)
Browse files Browse the repository at this point in the history
* Migrate to intellij-platform-gradle-plugin 2.0.0

* use `org.jetbrains.intellij.platform.modules` plugin

* Add CONTRIBUTING.md

* Update plugin until build to 242.*

* drop until build

* update changelog.md
  • Loading branch information
134130 authored Aug 11, 2024
1 parent f049bc6 commit b0e635b
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 157 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle
.idea
.intellijPlatform
.qodana
build
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
195 changes: 94 additions & 101 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<TaskExecutionGraph> {
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 <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription =
description =
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"
Expand All @@ -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())
Expand All @@ -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", "<!--999.999-->")
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=<!--999.999-->",
"-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")
}
}
}
8 changes: 2 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
17 changes: 11 additions & 6 deletions modules/core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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()
}
}
Loading

0 comments on commit b0e635b

Please sign in to comment.