Skip to content

Commit 8270a7e

Browse files
committed
Update files according to JetBrains/intellij-platform-plugin-template
1 parent 146d104 commit 8270a7e

File tree

6 files changed

+109
-71
lines changed

6 files changed

+109
-71
lines changed

plugin/build.gradle.kts

Lines changed: 68 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,112 @@
11
import org.jetbrains.changelog.Changelog
22
import org.jetbrains.changelog.markdownToHTML
33

4-
fun properties(key: String) = project.findProperty(key).toString()
4+
fun properties(key: String) = providers.gradleProperty(key)
5+
fun environment(key: String) = providers.environmentVariable(key)
56

67
plugins {
7-
// Java support
8-
id("java")
9-
// Kotlin support
10-
id("org.jetbrains.kotlin.jvm") version "1.9.22"
11-
// Gradle IntelliJ Plugin
12-
id("org.jetbrains.intellij") version "1.16.1"
13-
// Gradle Changelog Plugin
14-
/* ROLL_BACK_CHANGELOG_PLUGIN BEGIN - https://github.com/JetBrains/gradle-changelog-plugin/issues/147
15-
id("org.jetbrains.changelog") version "2.0.0"
16-
*/
17-
id("org.jetbrains.changelog") version "2.2.0"
18-
/* ROLL_BACK_CHANGELOG_PLUGIN END */
19-
// Gradle Qodana Plugin
20-
id("org.jetbrains.qodana") version "0.1.13"
8+
id("java") // Java support
9+
alias(libs.plugins.kotlin) // Kotlin support
10+
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
11+
alias(libs.plugins.changelog) // Gradle Changelog Plugin
12+
alias(libs.plugins.qodana) // Gradle Qodana Plugin
13+
alias(libs.plugins.kover) // Gradle Kover Plugin
2114
}
2215

23-
group = properties("pluginGroup")
24-
version = properties("pluginVersion")
16+
group = properties("pluginGroup").get()
17+
version = properties("pluginVersion").get()
2518

2619
// Configure project's dependencies
2720
repositories {
2821
mavenCentral()
2922
}
23+
24+
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
3025
dependencies {
31-
implementation("io.ktor:ktor-client-content-negotiation:2.3.7")
32-
implementation("io.ktor:ktor-client-core:2.3.7")
33-
implementation("io.ktor:ktor-client-cio:2.3.7")
34-
implementation("io.ktor:ktor-client-gson:2.3.7")
35-
implementation("io.ktor:ktor-serialization-gson:2.3.7")
26+
implementation(libs.ktor.content.negotiation)
27+
implementation(libs.ktor.client.core)
28+
implementation(libs.ktor.client.cio)
29+
implementation(libs.ktor.client.gson)
30+
implementation(libs.ktor.serialization.gson)
3631
}
3732

3833
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
3934
kotlin {
40-
jvmToolchain(17)
35+
jvmToolchain {
36+
languageVersion = JavaLanguageVersion.of(17)
37+
vendor = JvmVendorSpec.JETBRAINS
38+
}
4139
}
4240

4341
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
4442
intellij {
45-
pluginName.set(properties("pluginName"))
46-
version.set(properties("platformVersion"))
47-
type.set(properties("platformType"))
43+
pluginName = properties("pluginName")
44+
version = properties("platformVersion")
45+
type = properties("platformType")
4846

4947
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
50-
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
48+
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
5149
}
5250

5351
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
5452
changelog {
55-
groups.set(emptyList())
56-
/* ROLL_BACK_CHANGELOG_PLUGIN BEGIN - https://github.com/JetBrains/gradle-changelog-plugin/issues/147
57-
repositoryUrl.set(properties("pluginRepositoryUrl"))
58-
*/
59-
/* ROLL_BACK_CHANGELOG_PLUGIN END */
60-
path.set(File(projectDir, "../CHANGELOG.md").absolutePath)
53+
groups.empty()
54+
repositoryUrl = properties("pluginRepositoryUrl")
55+
path = File(projectDir, "../CHANGELOG.md").absolutePath
6156
}
6257

6358
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
6459
qodana {
65-
cachePath.set(file(".qodana").canonicalPath)
66-
reportPath.set(file("build/reports/inspections").canonicalPath)
67-
saveReport.set(true)
68-
showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false)
60+
cachePath = provider { file(".qodana").canonicalPath }
61+
reportPath = provider { file("build/reports/inspections").canonicalPath }
62+
saveReport = true
63+
showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false)
64+
}
65+
66+
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
67+
koverReport {
68+
defaults {
69+
xml {
70+
onCheck = true
71+
}
72+
}
6973
}
7074

7175
tasks {
7276
wrapper {
73-
gradleVersion = properties("gradleVersion")
77+
gradleVersion = properties("gradleVersion").get()
7478
}
7579

7680
patchPluginXml {
77-
version.set(properties("pluginVersion"))
78-
sinceBuild.set(properties("pluginSinceBuild"))
79-
untilBuild.set(properties("pluginUntilBuild"))
81+
version = properties("pluginVersion")
82+
sinceBuild = properties("pluginSinceBuild")
83+
untilBuild = properties("pluginUntilBuild")
8084

8185
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
82-
pluginDescription.set(
83-
file("../README.md").readText().lines().run {
84-
val start = "<!-- Plugin description -->"
85-
val end = "<!-- Plugin description end -->"
86+
pluginDescription = providers.fileContents(layout.projectDirectory.file("../README.md")).asText.map {
87+
val start = "<!-- Plugin description -->"
88+
val end = "<!-- Plugin description end -->"
8689

90+
with (it.lines()) {
8791
if (!containsAll(listOf(start, end))) {
8892
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
8993
}
90-
subList(indexOf(start) + 1, indexOf(end))
91-
}.joinToString("\n").let { markdownToHTML(it) }
92-
)
94+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
95+
}
96+
}
9397

98+
val changelog = project.changelog // local variable for configuration cache compatibility
9499
// Get the latest available change notes from the changelog file
95-
changeNotes.set(provider {
96-
/* ROLL_BACK_CHANGELOG_PLUGIN BEGIN - https://github.com/JetBrains/gradle-changelog-plugin/issues/147
97-
renderItem(
98-
getOrNull(properties("pluginVersion"))
99-
?: runCatching { getLatest() }.getOrElse { getUnreleased() },
100-
Changelog.OutputType.HTML,
101-
)
102-
*/
103-
changelog.renderItem(changelog.run {
104-
getOrNull(properties("pluginVersion")) ?: getLatest()
105-
}, Changelog.OutputType.HTML)
106-
/* ROLL_BACK_CHANGELOG_PLUGIN END */
107-
})
100+
changeNotes = properties("pluginVersion").map { pluginVersion ->
101+
with(changelog) {
102+
renderItem(
103+
(getOrNull(pluginVersion) ?: getUnreleased())
104+
.withHeader(false)
105+
.withEmptySections(false),
106+
Changelog.OutputType.HTML,
107+
)
108+
}
109+
}
108110
}
109111

110112
// Configure UI tests plugin
@@ -135,17 +137,17 @@ tasks {
135137
}
136138

137139
signPlugin {
138-
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
139-
privateKey.set(System.getenv("PRIVATE_KEY"))
140-
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
140+
certificateChain = environment("CERTIFICATE_CHAIN")
141+
privateKey = environment("PRIVATE_KEY")
142+
password = environment("PRIVATE_KEY_PASSWORD")
141143
}
142144

143145
publishPlugin {
144146
dependsOn("patchChangelog")
145-
token.set(System.getenv("PUBLISH_TOKEN"))
147+
token = environment("PUBLISH_TOKEN")
146148
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
147149
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
148150
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
149-
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
151+
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
150152
}
151153
}

plugin/gradle.properties

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@ platformVersion = 231.9225.16
1919
platformPlugins =
2020

2121
# Gradle Releases -> https://github.com/gradle/gradle/releases
22-
gradleVersion = 7.6
22+
gradleVersion = 8.5
2323

2424
# Opt-out flag for bundling Kotlin standard library -> https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library
2525
# suppress inspection "UnusedProperty"
2626
kotlin.stdlib.default.dependency = false
2727

2828
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
29-
# suppress inspection "UnusedProperty"
30-
org.gradle.unsafe.configuration-cache = true
29+
org.gradle.configuration-cache = true
30+
31+
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
32+
org.gradle.caching = true
33+
34+
# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
35+
systemProp.org.gradle.unsafe.kotlin.assignment = true

plugin/gradle/libs.versions.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[versions]
2+
# libraries
3+
annotations = "24.1.0"
4+
ktor = "2.3.7"
5+
6+
# plugins
7+
kotlin = "1.9.22"
8+
changelog = "2.2.0"
9+
gradleIntelliJPlugin = "1.16.1"
10+
qodana = "0.1.13"
11+
kover = "0.7.5"
12+
13+
[libraries]
14+
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
15+
ktor-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
16+
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" }
17+
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
18+
ktor-client-gson = { group = "io.ktor", name = "ktor-client-gson", version.ref = "ktor" }
19+
ktor-serialization-gson = { group = "io.ktor", name = "ktor-serialization-gson", version.ref = "ktor" }
20+
21+
[plugins]
22+
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
23+
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
24+
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
25+
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
26+
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
-17.7 KB
Binary file not shown.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
6-
zipStorePath=wrapper/dists
7+
zipStorePath=wrapper/dists

plugin/settings.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
plugins {
2+
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
3+
}
4+
15
rootProject.name = "Rossynt"

0 commit comments

Comments
 (0)