Skip to content

Commit 91e0631

Browse files
author
Serverfrog
committed
Removed pluginUntilBuild part
Updated Dependencies and Gradle Script according to the newest Template
1 parent 1ee8bf1 commit 91e0631

File tree

5 files changed

+154
-93
lines changed

5 files changed

+154
-93
lines changed

.idea/gradle.xml

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

+118-84
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,169 @@
11
import org.jetbrains.changelog.Changelog
22
import org.jetbrains.changelog.markdownToHTML
3-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4-
import java.util.*
3+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
54

65
fun properties(key: String) = project.findProperty(key).toString()
76

87
plugins {
98
// Java support
109
id("java")
1110
// Kotlin support
12-
id("org.jetbrains.kotlin.jvm") version "1.9.0"
13-
// Gradle IntelliJ Plugin
14-
id("org.jetbrains.intellij") version "1.15.0"
15-
// Gradle Changelog Plugin
16-
id("org.jetbrains.changelog") version "2.1.2"
17-
// Gradle Qodana Plugin
18-
id("org.jetbrains.qodana") version "0.1.13"
19-
// Dependency Updates
20-
id("com.github.ben-manes.versions") version "0.47.0"
11+
// id("org.jetbrains.kotlin.jvm") version "2.0.21"
12+
// // Gradle IntelliJ Plugin
13+
// id("org.jetbrains.intellij") version "1.17.0"
14+
// // Gradle Changelog Plugin
15+
// id("org.jetbrains.changelog") version "2.2.1"
16+
// // Gradle Qodana Plugin
17+
// id("org.jetbrains.qodana") version "0.1.13"
18+
// // Dependency Updates
19+
// id("com.github.ben-manes.versions") version "0.51.0"
20+
21+
alias(libs.plugins.kotlin) // Kotlin support
22+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
23+
alias(libs.plugins.changelog) // Gradle Changelog Plugin
24+
alias(libs.plugins.qodana) // Gradle Qodana Plugin
25+
alias(libs.plugins.kover) // Gradle Kover Plugin
2126
}
2227

2328
group = properties("pluginGroup")
2429
version = properties("pluginVersion")
2530

31+
32+
kotlin {
33+
jvmToolchain(17)
34+
}
2635
// Configure project's dependencies
2736
repositories {
2837
mavenCentral()
38+
intellijPlatform {
39+
defaultRepositories()
40+
}
2941
}
3042

31-
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
32-
intellij {
33-
pluginName.set(properties("pluginName"))
34-
version.set(properties("platformVersion"))
35-
type.set(properties("platformType"))
43+
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
44+
dependencies {
45+
testImplementation(libs.junit)
46+
testImplementation("org.opentest4j:opentest4j:1.3.0")
3647

37-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
38-
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
39-
}
40-
41-
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
42-
changelog {
43-
version.set(properties("pluginVersion"))
44-
groups.set(emptyList())
45-
}
48+
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
49+
intellijPlatform {
50+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
4651

47-
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
48-
qodana {
49-
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
50-
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
51-
saveReport.set(true)
52-
showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false)
53-
}
52+
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
53+
// bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
5454

55-
tasks {
56-
// Set the JVM compatibility versions
57-
properties("javaVersion").let {
58-
withType<JavaCompile> {
59-
sourceCompatibility = it
60-
targetCompatibility = it
61-
}
62-
withType<KotlinCompile> {
63-
kotlinOptions.jvmTarget = it
64-
}
65-
}
55+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
56+
// plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
6657

67-
wrapper {
68-
gradleVersion = properties("gradleVersion")
58+
instrumentationTools()
59+
pluginVerifier()
60+
zipSigner()
61+
testFramework(TestFrameworkType.Platform)
6962
}
70-
71-
patchPluginXml {
72-
version.set(properties("pluginVersion"))
73-
sinceBuild.set(properties("pluginSinceBuild"))
74-
untilBuild.set(properties("pluginUntilBuild"))
63+
}
64+
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
65+
intellijPlatform {
66+
pluginConfiguration {
67+
version = providers.gradleProperty("pluginVersion")
7568

7669
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
77-
pluginDescription.set(
78-
projectDir.resolve("README.md").readText().lines().run {
79-
val start = "<!-- Plugin description -->"
80-
val end = "<!-- Plugin description end -->"
70+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
71+
val start = "<!-- Plugin description -->"
72+
val end = "<!-- Plugin description end -->"
8173

74+
with(it.lines()) {
8275
if (!containsAll(listOf(start, end))) {
8376
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
8477
}
85-
subList(indexOf(start) + 1, indexOf(end))
86-
}.joinToString("\n").run { markdownToHTML(this) }
87-
)
78+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
79+
}
80+
}
8881

82+
val changelog = project.changelog // local variable for configuration cache compatibility
8983
// Get the latest available change notes from the changelog file
90-
changeNotes.set(provider {
84+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
9185
with(changelog) {
9286
renderItem(
93-
(getOrNull(properties("pluginVersion")) ?: getUnreleased())
87+
(getOrNull(pluginVersion) ?: getUnreleased())
9488
.withHeader(false)
9589
.withEmptySections(false),
9690
Changelog.OutputType.HTML,
9791
)
98-
9992
}
100-
})
93+
}
94+
95+
ideaVersion {
96+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
97+
// untilBuild = providers.gradleProperty("pluginUntilBuild")
98+
}
99+
}
100+
101+
signing {
102+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
103+
privateKey = providers.environmentVariable("PRIVATE_KEY")
104+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
101105
}
102106

107+
publishing {
108+
token = providers.environmentVariable("PUBLISH_TOKEN")
109+
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
110+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
111+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
112+
channels = providers.gradleProperty("pluginVersion")
113+
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
114+
}
103115

104-
// Configure UI tests plugin
105-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
106-
runIdeForUiTests {
107-
systemProperty("robot-server.port", "8082")
108-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
109-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
110-
systemProperty("jb.consents.confirmation.enabled", "false")
116+
pluginVerification {
117+
ides {
118+
recommended()
119+
}
111120
}
121+
}
122+
123+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
124+
changelog {
125+
groups.empty()
126+
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
127+
}
112128

113-
signPlugin {
114-
if (System.getenv("PRIVATE_KEY_PASSWORD") == null) {
115-
return@signPlugin
129+
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
130+
kover {
131+
reports {
132+
total {
133+
xml {
134+
onCheck = true
135+
}
116136
}
117-
val decoder = Base64.getDecoder()
118-
certificateChain.set(String(decoder.decode(System.getenv("CERTIFICATE_CHAIN"))))
119-
privateKey.set(String(decoder.decode(System.getenv("PRIVATE_KEY"))))
120-
password.set(String(decoder.decode(System.getenv("PRIVATE_KEY_PASSWORD"))))
137+
}
138+
}
139+
140+
tasks {
141+
wrapper {
142+
gradleVersion = providers.gradleProperty("gradleVersion").get()
121143
}
122144

123145
publishPlugin {
124-
dependsOn("patchChangelog")
125-
if (System.getenv("PUBLISH_TOKEN") == null) {
126-
return@publishPlugin
146+
dependsOn(patchChangelog)
147+
}
148+
}
149+
150+
intellijPlatformTesting {
151+
runIde {
152+
register("runIdeForUiTests") {
153+
task {
154+
jvmArgumentProviders += CommandLineArgumentProvider {
155+
listOf(
156+
"-Drobot-server.port=8082",
157+
"-Dide.mac.message.dialogs.as.sheets=false",
158+
"-Djb.privacy.policy.text=<!--999.999-->",
159+
"-Djb.consents.confirmation.enabled=false",
160+
)
161+
}
162+
}
163+
164+
plugins {
165+
robotServerPlugin()
166+
}
127167
}
128-
val decoder = Base64.getDecoder()
129-
token.set(String(decoder.decode(System.getenv("PUBLISH_TOKEN"))))
130-
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
131-
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
132-
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
133-
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
134168
}
135169
}

gradle.properties

+9-5
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,32 @@
44
pluginGroup = com.github.serverfrog.bitburnerplugin
55
pluginName = Bitburner-Plugin
66
# SemVer format -> https://semver.org
7-
pluginVersion=0.0.6
7+
pluginVersion=0.0.7
88

99
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
# for insight into build numbers and IntelliJ Platform versions.
1111
pluginSinceBuild=222.*
12-
pluginUntilBuild=232.*
12+
#pluginUntilBuild=232.*
1313

1414
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
1515
platformType=IC
16-
platformVersion=LATEST-EAP-SNAPSHOT
16+
platformVersion=2024.2.3
1717

1818
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1919
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
2020
platformPlugins =
2121

2222
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
23-
javaVersion=17
23+
#javaVersion=17
2424

2525
# Gradle Releases -> https://github.com/gradle/gradle/releases
26-
gradleVersion=8.2.1
26+
gradleVersion=8.10.2
2727

2828
# Opt-out flag for bundling Kotlin standard library.
2929
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
3030
# suppress inspection "UnusedProperty"
3131
kotlin.stdlib.default.dependency = false
32+
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
33+
org.gradle.configuration-cache=true
34+
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
35+
org.gradle.caching=true

gradle/libs.versions.toml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[versions]
2+
# libraries
3+
junit = "4.13.2"
4+
5+
# plugins
6+
changelog = "2.2.1"
7+
intelliJPlatform = "2.1.0"
8+
kotlin = "1.9.25"
9+
kover = "0.8.3"
10+
qodana = "2024.2.3"
11+
12+
[libraries]
13+
junit = { group = "junit", name = "junit", version.ref = "junit" }
14+
15+
[plugins]
16+
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
17+
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
18+
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
19+
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
20+
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }

settings.gradle.kts

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
rootProject.name = "Bitburner-Plugin"
2+
3+
plugins {
4+
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
5+
}

0 commit comments

Comments
 (0)