0
0
Fork 0
mirror of https://github.com/alexadhy/tokyonight-jetbrains.git synced 2024-11-07 20:24:19 -05:00
jetbrains/build.gradle.kts

125 lines
4.7 KiB
Text
Raw Normal View History

2023-04-11 04:00:46 -04:00
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
2022-03-21 15:59:33 -04:00
2023-04-11 04:00:46 -04:00
fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
2022-03-21 15:59:33 -04:00
plugins {
// Java support
id("java")
// Kotlin support
2023-04-11 04:00:46 -04:00
id("org.jetbrains.kotlin.jvm") version "1.8.10"
2022-03-21 15:59:33 -04:00
// Gradle IntelliJ Plugin
2023-04-11 04:00:46 -04:00
id("org.jetbrains.intellij") version "1.13.2"
2022-03-21 15:59:33 -04:00
// Gradle Changelog Plugin
2023-04-11 04:00:46 -04:00
id("org.jetbrains.changelog") version "2.0.0"
2022-03-21 15:59:33 -04:00
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "0.1.13"
2023-04-11 04:00:46 -04:00
// Gradle Kover Plugin
id("org.jetbrains.kotlinx.kover") version "0.6.1"
2022-03-21 15:59:33 -04:00
}
2023-04-11 04:00:46 -04:00
group = properties("pluginGroup").get()
version = properties("pluginVersion").get()
2022-03-21 15:59:33 -04:00
// Configure project's dependencies
repositories {
mavenCentral()
}
2023-04-11 04:00:46 -04:00
// 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)
}
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
2022-03-21 15:59:33 -04:00
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
2023-04-11 04:00:46 -04:00
plugins.set(properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) })
2022-03-21 15:59:33 -04:00
}
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
2023-04-11 04:00:46 -04:00
groups.empty()
repositoryUrl.set(properties("pluginRepositoryUrl"))
2022-03-21 15:59:33 -04:00
}
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
qodana {
2023-04-11 04:00:46 -04:00
cachePath.set(provider { file(".qodana").canonicalPath })
reportPath.set(provider { file("build/reports/inspections").canonicalPath })
2022-03-21 15:59:33 -04:00
saveReport.set(true)
2023-04-11 04:00:46 -04:00
showReport.set(environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false))
2022-03-21 15:59:33 -04:00
}
2023-04-11 04:00:46 -04:00
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
kover.xmlReport {
onCheck.set(true)
}
2022-03-21 15:59:33 -04:00
2023-04-11 04:00:46 -04:00
tasks {
2022-03-21 15:59:33 -04:00
wrapper {
2023-04-11 04:00:46 -04:00
gradleVersion = properties("gradleVersion").get()
2022-03-21 15:59:33 -04:00
}
patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
2023-04-11 04:00:46 -04:00
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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").let(::markdownToHTML)
}
})
val changelog = project.changelog // local variable for configuration cache compatibility
2022-03-21 15:59:33 -04:00
// Get the latest available change notes from the changelog file
2023-04-11 04:00:46 -04:00
changeNotes.set(properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
2022-03-21 15:59:33 -04:00
})
}
// 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")
}
2023-04-11 04:00:46 -04:00
signPlugin {
certificateChain.set(environment("CERTIFICATE_CHAIN"))
privateKey.set(environment("PRIVATE_KEY"))
password.set(environment("PRIVATE_KEY_PASSWORD"))
}
2022-03-21 15:59:33 -04:00
publishPlugin {
dependsOn("patchChangelog")
2023-04-11 04:00:46 -04:00
token.set(environment("PUBLISH_TOKEN"))
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
2022-03-21 15:59:33 -04:00
// 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
2023-04-11 04:00:46 -04:00
channels.set(properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) })
2022-03-21 15:59:33 -04:00
}
}