From 7f9e729c8181f9a6689849895f464e4ad6e7a80b Mon Sep 17 00:00:00 2001 From: legap Date: Sun, 4 Jan 2026 15:40:17 +0100 Subject: [PATCH 1/2] chore: upgrade to latest gradle plugin and template --- .gitignore | 6 +- .idea/gradle.xml | 8 +- build.gradle.kts | 203 +++++++++++++---------- codecov.yml | 10 ++ gradle.properties | 38 +++-- gradle/libs.versions.toml | 22 +++ gradle/wrapper/gradle-wrapper.properties | 4 +- qodana.yml | 8 +- settings.gradle.kts | 4 + 9 files changed, 185 insertions(+), 118 deletions(-) create mode 100644 codecov.yml create mode 100644 gradle/libs.versions.toml diff --git a/.gitignore b/.gitignore index 9df7ba5..b9038ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +.DS_Store .gradle .idea +.intellijPlatform +.kotlin .qodana -build -local +build \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 9454257..9baac6c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,11 +4,9 @@ - + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 5f84ae0..ca911d9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,135 +1,158 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import java.util.* - -fun properties(key: String) = project.findProperty(key).toString() +import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { - // Java support - id("java") - // Kotlin support - id("org.jetbrains.kotlin.jvm") version "1.9.0" - // Gradle IntelliJ Plugin - id("org.jetbrains.intellij") version "1.15.0" - // Gradle Changelog Plugin - id("org.jetbrains.changelog") version "2.1.2" - // Gradle Qodana Plugin - id("org.jetbrains.qodana") version "0.1.13" - // Dependency Updates - id("com.github.ben-manes.versions") version "0.47.0" + 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") -version = properties("pluginVersion") +group = providers.gradleProperty("pluginGroup").get() +version = providers.gradleProperty("pluginVersion").get() + +// Set the JVM language level used to build the project. +kotlin { + jvmToolchain(21) +} // 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() + } } -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - pluginName.set(properties("pluginName")) - version.set(properties("platformVersion")) - type.set(properties("platformType")) +// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/version_catalogs.html +dependencies { + testImplementation(libs.junit) + testImplementation(libs.opentest4j) - // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) -} + // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html + intellijPlatform { + intellijIdea(providers.gradleProperty("platformVersion")) -// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin -changelog { - version.set(properties("pluginVersion")) - groups.set(emptyList()) -} + // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins. + bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') }) -// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin -qodana { - cachePath.set(projectDir.resolve(".qodana").canonicalPath) - reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath) - saveReport.set(true) - showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false) -} + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace. + plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) -tasks { - // Set the JVM compatibility versions - properties("javaVersion").let { - withType { - sourceCompatibility = it - targetCompatibility = it - } - withType { - kotlinOptions.jvmTarget = it - } - } + // Module Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules. + bundledModules(providers.gradleProperty("platformBundledModules").map { it.split(',') }) - wrapper { - gradleVersion = properties("gradleVersion") + 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 { + name = providers.gradleProperty("pluginName") + version = providers.gradleProperty("pluginVersion") // Extract the section from README.md and provide for the plugin's manifest - pluginDescription.set( - projectDir.resolve("README.md").readText().lines().run { - val start = "" - val end = "" + description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + val start = "" + val end = "" + 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").run { markdownToHTML(this) } - ) + 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(provider { + changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion -> with(changelog) { renderItem( - (getOrNull(properties("pluginVersion")) ?: getUnreleased()) + (getOrNull(pluginVersion) ?: getUnreleased()) .withHeader(false) .withEmptySections(false), Changelog.OutputType.HTML, ) - } - }) + } + + ideaVersion { + sinceBuild = providers.gradleProperty("pluginSinceBuild") + } } + signing { + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") + privateKey = providers.environmentVariable("PRIVATE_KEY") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") + } - // 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") + 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/publishing-plugin.html#specifying-a-release-channel + channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } } - signPlugin { - if (System.getenv("PRIVATE_KEY_PASSWORD") == null) { - return@signPlugin + pluginVerification { + ides { + recommended() } - val decoder = Base64.getDecoder() - certificateChain.set(String(decoder.decode(System.getenv("CERTIFICATE_CHAIN")))) - privateKey.set(String(decoder.decode(System.getenv("PRIVATE_KEY")))) - password.set(String(decoder.decode(System.getenv("PRIVATE_KEY_PASSWORD")))) } +} - publishPlugin { - dependsOn("patchChangelog") - if (System.getenv("PUBLISH_TOKEN") == null) { - return@publishPlugin +// 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://kotlin.github.io/kotlinx-kover/gradle-plugin/#configuration-details +kover { + reports { + total { + xml { + onCheck = true + } } - val decoder = Base64.getDecoder() - token.set(String(decoder.decode(System.getenv("PUBLISH_TOKEN")))) - // 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(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())) } } + +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/codecov.yml b/codecov.yml new file mode 100644 index 0000000..0c0aace --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + informational: true + threshold: 0% + base: auto + patch: + default: + informational: true \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b5e0cdd..6a53258 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,31 +1,33 @@ -# IntelliJ Platform Artifacts Repositories -# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html +# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html pluginGroup = com.github.serverfrog.bitburnerplugin pluginName = Bitburner-Plugin +pluginRepositoryUrl = https://github.com/JetBrains/intellij-platform-plugin-template # SemVer format -> https://semver.org -pluginVersion=0.0.6 +pluginVersion=0.0.8 -# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -# for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild=222.* -pluginUntilBuild=232.* +# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html +pluginSinceBuild = 252 -# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties -platformType=IC -platformVersion=LATEST-EAP-SNAPSHOT +# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension +platformVersion = 2025.2.5 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html -# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 +# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP platformPlugins = - -# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3 -javaVersion=17 +# Example: platformBundledPlugins = com.intellij.java +platformBundledPlugins = +# Example: platformBundledModules = intellij.spellchecker +platformBundledModules = # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion=8.2.1 +gradleVersion=9.2.1 -# Opt-out flag for bundling Kotlin standard library. -# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details. -# suppress inspection "UnusedProperty" +# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency = false + +# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html +org.gradle.configuration-cache = true + +# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html +org.gradle.caching = true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..3c12682 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,22 @@ +[versions] +# libraries +junit = "4.13.2" +opentest4j = "1.3.0" + +# plugins +changelog = "2.5.0" +intelliJPlatform = "2.10.5" +kotlin = "2.2.21" +kover = "0.9.3" +qodana = "2025.2.2" + +[libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } +opentest4j = { group = "org.opentest4j", name = "opentest4j", version.ref = "opentest4j" } + +[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" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9f4197d..d205b54 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.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/qodana.yml b/qodana.yml index dac95d3..6415c31 100644 --- a/qodana.yml +++ b/qodana.yml @@ -1,6 +1,12 @@ # Qodana configuration: # https://www.jetbrains.com/help/qodana/qodana-yaml.html -version: 1.0 +version: "1.0" +linter: jetbrains/qodana-jvm-community:2024.3 +projectJDK: "21" profile: name: qodana.recommended +exclude: + - name: All + paths: + - .qodana \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index f8c5207..2aa8565 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,5 @@ rootProject.name = "Bitburner-Plugin" + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} \ No newline at end of file From 94322432a45be67877299b31365ba58555754af8 Mon Sep 17 00:00:00 2001 From: legap Date: Sun, 4 Jan 2026 17:01:45 +0100 Subject: [PATCH 2/2] chore: fix plugin repository url --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6a53258..75eed91 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ pluginGroup = com.github.serverfrog.bitburnerplugin pluginName = Bitburner-Plugin -pluginRepositoryUrl = https://github.com/JetBrains/intellij-platform-plugin-template +pluginRepositoryUrl = https://github.com/Serverfrog/Bitburner-Plugin # SemVer format -> https://semver.org pluginVersion=0.0.8