Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7f3e3d

Browse files
committed
chore: upgrade Gradle IntelliJ Plugin
This is needed in order to be able to specify "unlimited until builds".IntelliJ Platform Gradle Plugin 2.x is the build system that supersedesthe Gradle IntelliJ Plugin 1.x, and this is the version that comes withthe ability to provide unlimited until build support.This is a major overhaul of the DSL, I've tested these changes locally withGW 2023.3 (the minimum supported version), and I've also compared the plugin.xmlwith a previous version to make sure it is generated correctly.
1 parenta12ea59 commitc7f3e3d

File tree

2 files changed

+132
-94
lines changed

2 files changed

+132
-94
lines changed

‎build.gradle.kts

Lines changed: 121 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
importorg.jetbrains.changelog.Changelog
12
importorg.jetbrains.changelog.markdownToHTML
2-
importorg.jetbrains.kotlin.gradle.tasks.KotlinCompile
33

44
funproperties(key:String)= project.findProperty(key).toString()
55

@@ -10,18 +10,34 @@ plugins {
1010
id("groovy")
1111
// Kotlin support
1212
id("org.jetbrains.kotlin.jvm") version"1.9.23"
13-
// Gradle IntelliJ Plugin
14-
id("org.jetbrains.intellij") version"1.13.3"
13+
// Gradle IntelliJPlatformPlugin
14+
id("org.jetbrains.intellij.platform") version"2.5.0"
1515
// Gradle Changelog Plugin
1616
id("org.jetbrains.changelog") version"2.2.1"
1717
// Gradle Qodana Plugin
1818
id("org.jetbrains.qodana") version"0.1.13"
19+
// Gradle Kover Plugin
20+
id("org.jetbrains.kotlinx.kover") version"0.9.1"
1921
// Generate Moshi adapters.
2022
id("com.google.devtools.ksp") version"1.9.23-1.0.20"
2123
}
2224

23-
group= properties("pluginGroup")
24-
version= properties("pluginVersion")
25+
group= providers.gradleProperty("pluginGroup").get()
26+
version= providers.gradleProperty("pluginVersion").get()
27+
28+
// Set the JVM language level used to build the project.
29+
kotlin {
30+
jvmToolchain(17)
31+
}
32+
33+
// Configure project's dependencies
34+
repositories {
35+
mavenCentral()
36+
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
37+
intellijPlatform {
38+
defaultRepositories()
39+
}
40+
}
2541

2642
dependencies {
2743
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
@@ -37,23 +53,76 @@ dependencies {
3753
implementation("org.zeroturnaround:zt-exec:1.12")
3854

3955
testImplementation(kotlin("test"))
40-
}
4156

42-
// Configure project's dependencies
43-
repositories {
44-
mavenCentral()
45-
maven(url="https://www.jetbrains.com/intellij-repository/snapshots")
57+
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
58+
intellijPlatform {
59+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
60+
61+
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
62+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
63+
64+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
65+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
66+
67+
pluginVerifier()
68+
}
4669
}
4770

4871
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
49-
intellij {
50-
pluginName.set(properties("pluginName"))
51-
version.set(properties("platformVersion"))
52-
type.set(properties("platformType"))
53-
54-
downloadSources.set(properties("platformDownloadSources").toBoolean())
55-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
56-
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
72+
intellijPlatform {
73+
buildSearchableOptions=false
74+
instrumentCode=true
75+
76+
pluginConfiguration {
77+
name= providers.gradleProperty("pluginName")
78+
version= providers.gradleProperty("pluginVersion")
79+
80+
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
81+
description= providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
82+
val start="<!-- Plugin description -->"
83+
val end="<!-- Plugin description end -->"
84+
85+
with(it.lines()) {
86+
if (!containsAll(listOf(start, end))) {
87+
throwGradleException("Plugin description section not found in README.md:\n$start ...$end")
88+
}
89+
subList(indexOf(start)+1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
90+
}
91+
}
92+
93+
val changelog= project.changelog// local variable for configuration cache compatibility
94+
// Get the latest available change notes from the changelog file
95+
changeNotes= providers.gradleProperty("pluginVersion").map { pluginVersion->
96+
with(changelog) {
97+
renderItem(
98+
(getOrNull(pluginVersion)?: getUnreleased())
99+
.withHeader(false)
100+
.withEmptySections(false),
101+
Changelog.OutputType.HTML,
102+
)
103+
}
104+
}
105+
106+
ideaVersion {
107+
sinceBuild= providers.gradleProperty("pluginSinceBuild")
108+
untilBuild= providers.gradleProperty("pluginUntilBuild")
109+
}
110+
}
111+
112+
pluginVerification {
113+
ides {
114+
recommended()
115+
}
116+
}
117+
118+
publishing {
119+
token= providers.environmentVariable("PUBLISH_TOKEN")
120+
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
121+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
122+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
123+
channels= providers.gradleProperty("pluginVersion")
124+
.map {listOf(it.substringAfter('-',"").substringBefore('.').ifEmpty {"default" }) }
125+
}
57126
}
58127

59128
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
@@ -62,6 +131,17 @@ changelog {
62131
groups.set(emptyList())
63132
}
64133

134+
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
135+
kover {
136+
reports {
137+
total {
138+
xml {
139+
onCheck=true
140+
}
141+
}
142+
}
143+
}
144+
65145
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
66146
qodana {
67147
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
@@ -72,88 +152,43 @@ qodana {
72152

73153
tasks {
74154
buildPlugin {
155+
archiveBaseName= providers.gradleProperty("artifactName").get()
75156
exclude {"coroutines"in it.name }
76157
}
77158
prepareSandbox {
78159
exclude {"coroutines"in it.name }
79160
}
80161

81-
// Set the JVM compatibility versions
82-
properties("javaVersion").let {
83-
withType<JavaCompile> {
84-
sourceCompatibility= it
85-
targetCompatibility= it
86-
}
87-
withType<KotlinCompile> {
88-
kotlinOptions.jvmTarget= it
89-
}
90-
}
91-
92162
wrapper {
93-
gradleVersion= properties("gradleVersion")
94-
}
95-
96-
instrumentCode {
97-
compilerVersion.set(properties("instrumentationCompiler"))
98-
}
99-
100-
// TODO - this fails with linkage error, but we don't need it now
101-
// because the plugin does not provide anything to search for in Preferences
102-
buildSearchableOptions {
103-
isEnabled=false
104-
}
105-
106-
patchPluginXml {
107-
version.set(properties("pluginVersion"))
108-
sinceBuild.set(properties("pluginSinceBuild"))
109-
untilBuild.set(properties("pluginUntilBuild"))
110-
111-
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
112-
pluginDescription.set(
113-
projectDir.resolve("README.md").readText().lines().run {
114-
val start="<!-- Plugin description -->"
115-
val end="<!-- Plugin description end -->"
116-
117-
if (!containsAll(listOf(start, end))) {
118-
throwGradleException("Plugin description section not found in README.md:\n$start ...$end")
119-
}
120-
subList(indexOf(start)+1, indexOf(end))
121-
}.joinToString("\n").run { markdownToHTML(this) },
122-
)
123-
124-
// Get the latest available change notes from the changelog file
125-
changeNotes.set(
126-
provider {
127-
changelog.run {
128-
getOrNull(properties("pluginVersion"))?: getLatest()
129-
}.toHTML()
130-
},
131-
)
132-
}
133-
134-
runIde {
135-
autoReloadPlugins.set(true)
136-
}
137-
138-
// Configure UI tests plugin
139-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
140-
runIdeForUiTests {
141-
systemProperty("robot-server.port","8082")
142-
systemProperty("ide.mac.message.dialogs.as.sheets","false")
143-
systemProperty("jb.privacy.policy.text","<!--999.999-->")
144-
systemProperty("jb.consents.confirmation.enabled","false")
163+
gradleVersion= providers.gradleProperty("gradleVersion").get()
145164
}
146165

147166
publishPlugin {
148-
dependsOn("patchChangelog")
149-
token.set(System.getenv("PUBLISH_TOKEN"))
167+
dependsOn(patchChangelog)
150168
}
151169

152170
test {
153171
useJUnitPlatform()
154172
}
173+
}
174+
175+
intellijPlatformTesting {
176+
runIde {
177+
register("runIdeForUiTests") {
178+
task {
179+
jvmArgumentProviders+=CommandLineArgumentProvider {
180+
listOf(
181+
"-Drobot-server.port=8082",
182+
"-Dide.mac.message.dialogs.as.sheets=false",
183+
"-Djb.privacy.policy.text=<!--999.999-->",
184+
"-Djb.consents.confirmation.enabled=false",
185+
)
186+
}
187+
}
155188

156-
runPluginVerifier {
157-
ideVersions.set(properties("verifyVersions").split(","))
189+
plugins {
190+
robotServerPlugin()
191+
}
192+
}
158193
}
159-
}
194+
}

‎gradle.properties

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
33
pluginGroup=com.coder.gateway
44
# Zip file name.
5-
pluginName=coder-gateway
5+
artifactName=coder-gateway
6+
pluginName=Coder
67
# SemVer format -> https://semver.org
78
pluginVersion=2.20.0
89
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
@@ -26,20 +27,22 @@ pluginUntilBuild=251.*
2627
# that exists, ideally the most recent one, for example
2728
# 233.15325-EAP-CANDIDATE-SNAPSHOT).
2829
platformType=GW
29-
platformVersion=241.19416-EAP-CANDIDATE-SNAPSHOT
30-
instrumentationCompiler=243.15521-EAP-CANDIDATE-SNAPSHOT
30+
platformVersion=2023.3
3131
# Gateway does not have open sources.
3232
platformDownloadSources=true
33-
verifyVersions=2023.3,2024.1,2024.2,2024.3
33+
verifyVersions=2023.3,2024.1,2024.2,2024.3,2025.1
3434
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
3535
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
3636
platformPlugins=
37-
# Java language level used to compile sources and to generate the files for -
38-
# Java 17 is required since 2022.2
39-
javaVersion=17
37+
# Example: platformBundledPlugins = com.intellij.java
38+
platformBundledPlugins =
4039
# Gradle Releases -> https://github.com/gradle/gradle/releases
41-
gradleVersion=7.4
40+
gradleVersion=8.5
4241
# Opt-out flag for bundling Kotlin standard library.
4342
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
4443
# suppress inspection "UnusedProperty"
4544
kotlin.stdlib.default.dependency=true
45+
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
46+
org.gradle.configuration-cache =true
47+
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
48+
org.gradle.caching =true

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp