generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,123 @@ | ||
import org.jetbrains.changelog.Changelog | ||
import org.jetbrains.changelog.markdownToHTML | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
fun properties(key: String) = project.findProperty(key).toString() | ||
fun properties(key: String) = providers.gradleProperty(key) | ||
fun environment(key: String) = providers.environmentVariable(key) | ||
|
||
plugins { | ||
// Java support | ||
id("java") | ||
// Kotlin support | ||
id("org.jetbrains.kotlin.jvm") version "1.6.0" | ||
// Gradle IntelliJ Plugin | ||
id("org.jetbrains.intellij") version "1.11.0" | ||
// Gradle Changelog Plugin | ||
id("org.jetbrains.changelog") version "1.3.1" | ||
// Gradle Qodana Plugin | ||
id("org.jetbrains.qodana") version "0.1.13" | ||
id("java") // Java support | ||
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") | ||
version = properties("pluginVersion") | ||
group = properties("pluginGroup").get() | ||
version = properties("pluginVersion").get() | ||
|
||
// Configure project's dependencies | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin | ||
|
||
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog | ||
dependencies { | ||
// implementation(libs.annotations) | ||
} | ||
|
||
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. | ||
kotlin { | ||
jvmToolchain(17) | ||
} | ||
|
||
// 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")) | ||
pluginName = properties("pluginName") | ||
version = properties("platformVersion") | ||
type = properties("platformType") | ||
|
||
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. | ||
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) | ||
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } | ||
} | ||
|
||
|
||
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin | ||
changelog { | ||
version.set(properties("pluginVersion")) | ||
groups.set(emptyList()) | ||
groups.empty() | ||
repositoryUrl = properties("pluginRepositoryUrl") | ||
} | ||
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin | ||
qodana { | ||
cachePath = provider { file(".qodana").canonicalPath } | ||
reportPath = provider { file("build/reports/inspections").canonicalPath } | ||
saveReport = true | ||
showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false) | ||
} | ||
|
||
tasks { | ||
// Set the JVM compatibility versions | ||
properties("javaVersion").let { | ||
withType<JavaCompile> { | ||
sourceCompatibility = it | ||
targetCompatibility = it | ||
} | ||
withType<KotlinCompile> { | ||
kotlinOptions.jvmTarget = it | ||
|
||
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration | ||
koverReport { | ||
defaults { | ||
xml { | ||
onCheck = true | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
wrapper { | ||
gradleVersion = properties("gradleVersion") | ||
gradleVersion = properties("gradleVersion").get() | ||
} | ||
|
||
patchPluginXml { | ||
version.set(properties("pluginVersion")) | ||
sinceBuild.set(properties("pluginSinceBuild")) | ||
untilBuild.set(properties("pluginUntilBuild")) | ||
version = properties("pluginVersion") | ||
sinceBuild = properties("pluginSinceBuild") | ||
untilBuild = properties("pluginUntilBuild") | ||
|
||
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest | ||
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { | ||
with (it.lines()) { | ||
joinToString("\n").let(::markdownToHTML) | ||
} | ||
} | ||
|
||
pluginDescription.set( | ||
File("./DESCRIPTION.md") | ||
.readText().lines() | ||
.joinToString("\n") | ||
.run { markdownToHTML(this) } | ||
) | ||
|
||
val changelog = project.changelog // local variable for configuration cache compatibility | ||
// Get the latest available change notes from the changelog file | ||
changeNotes.set(provider { | ||
changelog.run { | ||
getOrNull(properties("pluginVersion")) ?: getLatest() | ||
}.toHTML() | ||
}) | ||
changeNotes = properties("pluginVersion").map { pluginVersion -> | ||
with(changelog) { | ||
renderItem( | ||
(getOrNull(pluginVersion) ?: getUnreleased()) | ||
.withHeader(false) | ||
.withEmptySections(false), | ||
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", "<!--999.999-->") | ||
systemProperty("jb.consents.confirmation.enabled", "false") | ||
} | ||
|
||
signPlugin { | ||
certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) | ||
privateKey.set(System.getenv("PRIVATE_KEY")) | ||
password.set(System.getenv("PRIVATE_KEY_PASSWORD")) | ||
certificateChain = environment("CERTIFICATE_CHAIN") | ||
privateKey = environment("PRIVATE_KEY") | ||
password = environment("PRIVATE_KEY_PASSWORD") | ||
} | ||
|
||
publishPlugin { | ||
dependsOn("patchChangelog") | ||
token.set(System.getenv("PUBLISH_TOKEN")) | ||
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 | ||
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.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())) | ||
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[versions] | ||
# libraries | ||
annotations = "24.0.1" | ||
|
||
# plugins | ||
dokka = "1.8.10" | ||
kotlin = "1.8.21" | ||
changelog = "2.1.0" | ||
gradleIntelliJPlugin = "1.14.1" | ||
qodana = "0.1.13" | ||
kover = "0.7.1" | ||
|
||
[libraries] | ||
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } | ||
|
||
[plugins] | ||
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } | ||
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } | ||
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } | ||
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" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters