From 06ed029734c0cbc768bd80889888dffdebbd788f Mon Sep 17 00:00:00 2001 From: zeekbyte Date: Fri, 13 Sep 2024 23:03:35 +0700 Subject: [PATCH] feat(0.1.6): upgrade compatibility with IntelliJ IDEA 2024.2.1 --- .intellijPlatform/self-update.lock | 1 + CHANGELOG.md | 3 + README.md | 1 + build.gradle.kts | 182 ++++++++++++++--------- gradle.properties | 17 ++- gradle/libs.versions.toml | 20 +++ gradle/wrapper/gradle-wrapper.properties | 3 +- src/main/resources/META-INF/plugin.xml | 12 +- 8 files changed, 153 insertions(+), 86 deletions(-) create mode 100644 .intellijPlatform/self-update.lock create mode 100644 gradle/libs.versions.toml diff --git a/.intellijPlatform/self-update.lock b/.intellijPlatform/self-update.lock new file mode 100644 index 0000000..5a8b58f --- /dev/null +++ b/.intellijPlatform/self-update.lock @@ -0,0 +1 @@ +2024-09-14 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8971589..818cac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ ### Added +## [0.1.6] 13-09.2024 +- Fixed for compatibility with IntelliJ IDEA 2024.2.1 + ## [0.1.5] - 15.11.2022 - Added line coverage colors diff --git a/README.md b/README.md index 8944ad9..5b27910 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # 🏙 Tokyo Night +> I forked from the repository [tokyonight-jetbrains](https://github.com/alexadhy/tokyonight-jetbrains) and continued to maintain it. diff --git a/build.gradle.kts b/build.gradle.kts index 4bdd192..277786a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,92 +1,76 @@ 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 { - // Java support - id("java") - // Kotlin support - id("org.jetbrains.kotlin.jvm") version "1.8.10" - // Gradle IntelliJ Plugin - id("org.jetbrains.intellij") version "1.13.2" - // Gradle Changelog Plugin - id("org.jetbrains.changelog") version "2.0.0" - // Gradle Qodana Plugin - id("org.jetbrains.qodana") version "0.1.13" - // Gradle Kover Plugin - id("org.jetbrains.kotlinx.kover") version "0.6.1" + id("java") // Java support + alias(libs.plugins.kotlin) // Kotlin support + 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() -} -// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. -kotlin { - jvmToolchain(11) + // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html + intellijPlatform { + defaultRepositories() + } } -// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html -intellij { - pluginName.set(properties("pluginName")) - version.set(properties("platformVersion")) - type.set(properties("platformType")) - - // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins.set(properties("platformPlugins").map { it.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.set(properties("pluginRepositoryUrl")) -} + // 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 Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin -qodana { - cachePath.set(provider { file(".qodana").canonicalPath }) - reportPath.set(provider { file("build/reports/inspections").canonicalPath }) - saveReport.set(true) - showReport.set(environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false)) -} + // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins. + bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') }) -// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration -kover.xmlReport { - onCheck.set(true) -} + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace. + plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) -tasks { - wrapper { - gradleVersion = properties("gradleVersion").get() + instrumentationTools() + pluginVerifier() + zipSigner() + testFramework(TestFrameworkType.Platform) } +} - patchPluginXml { - version.set(properties("pluginVersion")) - sinceBuild.set(properties("pluginSinceBuild")) - untilBuild.set(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.set(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") } subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) } - }) + } val changelog = project.changelog // local variable for configuration cache compatibility // Get the latest available change notes from the changelog file - changeNotes.set(properties("pluginVersion").map { pluginVersion -> + changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion -> with(changelog) { renderItem( (getOrNull(pluginVersion) ?: getUnreleased()) @@ -95,30 +79,80 @@ tasks { 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") + } } - signPlugin { - certificateChain.set(environment("CERTIFICATE_CHAIN")) - privateKey.set(environment("PRIVATE_KEY")) - password.set(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.set(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.set(properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }) + 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() + } + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8a81ddb..8c39315 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,25 +1,28 @@ # IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html -pluginGroup = com.alex.tokyonight +pluginGroup = com.zeekbyte.tokyonight pluginName = TokyoNight Theme pluginRepositoryUrl = https://github.com/Inf166/theme-jetbrains-tokyonight # SemVer format -> https://semver.org -pluginVersion = 0.1.5 +pluginVersion = 0.1.6 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -pluginSinceBuild = 203 -pluginUntilBuild = 235.* +pluginSinceBuild = 233 +pluginUntilBuild = 242.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IC -platformVersion = 2023.1 +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 platformPlugins = +# Example: platformBundledPlugins = com.intellij.java +platformBundledPlugins = + # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 8.0.2 +gradleVersion = 8.9 # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib # suppress inspection "UnusedProperty" @@ -29,3 +32,5 @@ kotlin.stdlib.default.dependency = false # suppress inspection "UnusedProperty" org.gradle.unsafe.configuration-cache = true +# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html +org.gradle.caching = true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..dfed70a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,20 @@ +[versions] +# 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" } +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/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bdc9a83..09523c0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index d72b028..4c36e56 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,22 +1,24 @@ - com.alex.tokyonight + com.zeekbtye.tokyonight Tokyo Night Theme - Joel Maximilian Mai + zeekbyte com.intellij.modules.platform - - - + + +