Skip to content

Commit c5c2b04

Browse files
committed
Migrate plugin to Jewel
1 parent 7684a44 commit c5c2b04

28 files changed

+419
-489
lines changed

build.gradle.kts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,24 @@ allprojects {
3232
}
3333
}
3434
mavenCentral()
35+
maven("https://www.jetbrains.com/intellij-repository/releases")
36+
maven("https://www.jetbrains.com/intellij-repository/snapshots")
37+
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
38+
3539
intellijPlatform {
3640
defaultRepositories()
3741
}
3842
}
3943
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#setting-up-intellij-platform
4044
dependencies {
4145
extensions.configure<IntelliJPlatformDependenciesExtension> {
42-
intellijIdeaCommunity("2024.3")
46+
// https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
47+
intellijIdea("2025.2.4")
48+
4349
bundledPlugin("org.jetbrains.kotlin")
50+
51+
// https://github.com/JetBrains/intellij-platform-compose-plugin-template
52+
composeUI()
4453
}
4554
}
4655
}

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[versions]
2-
compose = "1.8.2"
2+
compose = "1.9.0"
33
intellij = "2.10.5"
44
jacoco = "0.8.13"
55
jdkRelease = "17"
66
kotlin = "2.2.21"
77
kover = "0.9.4"
8-
leviathan = "3.1.0-1.8.2"
8+
leviathan = "3.1.0"
99
ktor = "3.3.3"
1010

1111
[libraries]
@@ -24,7 +24,7 @@ ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "kto
2424
ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
2525
leviathan = { module = "io.github.composegears:leviathan", version.ref = "leviathan" }
2626
leviathan-compose = { module = "io.github.composegears:leviathan-compose", version.ref = "leviathan" }
27-
tiamat = "io.github.composegears:tiamat:2.1.0-1.8.2"
27+
tiamat = "io.github.composegears:tiamat:2.1.0"
2828
xpp3 = "org.ogce:xpp3:1.1.6"
2929
xmlutil = "io.github.pdvrieze.xmlutil:serialization:0.91.3"
3030

settings.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ dependencyResolutionManagement {
3939
}
4040
}
4141
mavenCentral()
42+
maven("https://www.jetbrains.com/intellij-repository/releases")
43+
maven("https://www.jetbrains.com/intellij-repository/snapshots")
44+
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
4245
maven(url = file("m2"))
4346

4447
versionCatalogs {

tools/idea-plugin/build.gradle.kts

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import io.github.composegears.valkyrie.task.CheckComposeVersionCompatibility
22
import org.jetbrains.changelog.Changelog
3-
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
43
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel
54
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
65

@@ -15,8 +14,26 @@ plugins {
1514
group = rootProject.providers.gradleProperty("GROUP").get()
1615
version = rootProject.providers.gradleProperty("VERSION_NAME").get()
1716

18-
repositories {
19-
maven(url = file("../../m2"))
17+
configurations.all {
18+
// Exclude Compose Multiplatform dependencies not needed in IntelliJ plugin
19+
// exclude("androidx.annotation")
20+
// exclude("androidx.arch.core")
21+
// exclude("androidx.compose")
22+
// exclude("androidx.lifecycle")
23+
// exclude("org.jetbrains.compose")
24+
// exclude("org.jetbrains.compose.foundation")
25+
// exclude("org.jetbrains.compose.runtime")
26+
// exclude("org.jetbrains.compose.ui")
27+
// exclude("org.jetbrains.jewel")
28+
// exclude("org.jetbrains.kotlin")
29+
// exclude("org.jetbrains.kotlinx")
30+
exclude("org.jetbrains.skiko")
31+
32+
exclude(group = "net.sourceforge.plantuml") // PlantUML (~20MB) - from dev.snipme:highlights
33+
34+
// Exclude kotlinx-serialization-json-io to prevent conflicts with IntelliJ's bundled libraries
35+
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-json-io")
36+
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-json-io-jvm")
2037
}
2138

2239
configurations.all {
@@ -42,28 +59,8 @@ dependencies {
4259
implementation(projects.sdk.ir.xml)
4360
implementation(projects.shared)
4461

45-
compileOnly(compose.desktop.currentOs) {
46-
exclude(group = "org.jetbrains.compose.material")
47-
}
48-
implementation(compose.desktop.common) {
49-
exclude(group = "org.jetbrains.compose.material")
50-
}
51-
implementation(compose.desktop.linux_arm64) {
52-
exclude(group = "org.jetbrains.compose.material")
53-
}
54-
implementation(compose.desktop.linux_x64) {
55-
exclude(group = "org.jetbrains.compose.material")
56-
}
57-
implementation(compose.desktop.macos_arm64) {
58-
exclude(group = "org.jetbrains.compose.material")
59-
}
60-
implementation(compose.desktop.macos_x64) {
61-
exclude(group = "org.jetbrains.compose.material")
62-
}
63-
implementation(compose.desktop.windows_x64) {
64-
exclude(group = "org.jetbrains.compose.material")
65-
}
6662
implementation(compose.material3)
63+
implementation(compose.preview)
6764

6865
implementation(libs.android.build.tools)
6966
implementation(libs.fonticons)
@@ -84,6 +81,7 @@ dependencies {
8481

8582
intellijPlatform {
8683
zipSigner()
84+
pluginVerifier()
8785
}
8886
}
8987

@@ -96,7 +94,7 @@ intellijPlatform {
9694
projectName = "valkyrie-plugin"
9795
pluginConfiguration {
9896
ideaVersion {
99-
sinceBuild = "243"
97+
sinceBuild = "252"
10098
untilBuild = provider { null }
10199
}
102100
changeNotes = provider { changelog.render(Changelog.OutputType.HTML) }
@@ -113,14 +111,7 @@ intellijPlatform {
113111
FailureLevel.NOT_DYNAMIC,
114112
)
115113
ides {
116-
create(
117-
type = IntelliJPlatformType.IntellijIdeaCommunity,
118-
version = "2024.3.7",
119-
)
120-
create(
121-
type = IntelliJPlatformType.IntellijIdeaCommunity,
122-
version = "2025.2",
123-
)
114+
recommended()
124115
}
125116
}
126117
signing {
Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package io.github.composegears.valkyrie
22

3-
import androidx.compose.runtime.Composable
43
import androidx.compose.runtime.CompositionLocalProvider
5-
import androidx.compose.ui.awt.ComposePanel
64
import com.intellij.openapi.project.DumbAware
75
import com.intellij.openapi.project.Project
86
import com.intellij.openapi.wm.ToolWindow
@@ -13,24 +11,20 @@ import io.github.composegears.valkyrie.ui.di.DI
1311
import io.github.composegears.valkyrie.ui.foundation.LocalSnackBar
1412
import io.github.composegears.valkyrie.ui.foundation.rememberSnackbarState
1513
import io.github.composegears.valkyrie.ui.foundation.theme.ValkyrieTheme
16-
import io.github.composegears.valkyrie.ui.platform.buildComposePanel
14+
import org.jetbrains.jewel.bridge.addComposeTab
1715

1816
class ValkyrieToolWindow :
1917
ToolWindowFactory,
2018
DumbAware {
2119

2220
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
23-
System.setProperty("compose.swing.render.on.graphics", "true")
24-
2521
DI.initWith(project)
2622

27-
toolWindow.apply {
28-
setTitleActions(listOf(RefreshPluginAction()))
29-
addComposePanel {
30-
ValkyrieTheme(project = project, currentComponent = this) {
31-
CompositionLocalProvider(LocalSnackBar provides rememberSnackbarState()) {
32-
ValkyriePlugin()
33-
}
23+
toolWindow.setTitleActions(listOf(RefreshPluginAction()))
24+
toolWindow.addComposeTab(focusOnClickInside = true) {
25+
ValkyrieTheme(project = project) {
26+
CompositionLocalProvider(LocalSnackBar provides rememberSnackbarState()) {
27+
ValkyriePlugin()
3428
}
3529
}
3630
}
@@ -40,10 +34,3 @@ class ValkyrieToolWindow :
4034
const val ID = "Valkyrie"
4135
}
4236
}
43-
44-
private fun ToolWindow.addComposePanel(
45-
displayName: String = "",
46-
isLockable: Boolean = true,
47-
content: @Composable ComposePanel.() -> Unit,
48-
) = buildComposePanel(content = content)
49-
.also { contentManager.addContent(contentManager.factory.createContent(it, displayName, isLockable)) }

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/action/dialog/RequiredIconPackModeDialog.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import io.github.composegears.valkyrie.sdk.compose.foundation.layout.CenterVerti
2020
import io.github.composegears.valkyrie.ui.foundation.icons.Warning
2121
import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme
2222
import io.github.composegears.valkyrie.ui.foundation.theme.ValkyrieTheme
23-
import io.github.composegears.valkyrie.ui.platform.buildComposePanel
2423
import java.awt.event.ActionEvent
2524
import javax.swing.Action
25+
import org.jetbrains.jewel.bridge.compose
2626

2727
class RequiredIconPackModeDialog(
2828
private val message: String,
@@ -36,7 +36,7 @@ class RequiredIconPackModeDialog(
3636
init()
3737
}
3838

39-
override fun createCenterPanel() = buildComposePanel {
39+
override fun createCenterPanel() = compose(focusOnClickInside = true) {
4040
ValkyrieTheme {
4141
DialogContentUi(
4242
modifier = Modifier.fillMaxSize(),

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/editor/TextEditorWithImageVectorPreview.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private class ImageVectorPreviewEditor(
5252

5353
private val composePanel = ComposePanel().apply {
5454
setContent {
55-
ValkyrieTheme(project, this) {
55+
ValkyrieTheme(project) {
5656
VirtualFileImageVector(
5757
modifier = Modifier.fillMaxSize(),
5858
file = file,

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/ScrollableTabRow.kt

Lines changed: 0 additions & 113 deletions
This file was deleted.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/theme/CompositionLocal.kt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/theme/Theme.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ import com.intellij.openapi.project.Project
1717
import io.github.composegears.valkyrie.ui.foundation.compositionlocal.LocalProject
1818
import io.github.composegears.valkyrie.ui.foundation.compositionlocal.ProjectWrapper
1919
import io.github.composegears.valkyrie.ui.foundation.theme.IntelliJTheme.Theme
20-
import java.awt.Component
2120

2221
@Composable
2322
fun ValkyrieTheme(
2423
project: Project,
25-
currentComponent: Component,
2624
content: @Composable () -> Unit,
2725
) {
2826
val rootContent = @Composable {
2927
CompositionLocalProvider(
3028
LocalProject provides ProjectWrapper.Platform(project),
31-
LocalComponent provides currentComponent,
3229
content = content,
3330
)
3431
}
@@ -51,6 +48,7 @@ fun ValkyrieTheme(content: @Composable () -> Unit) {
5148
}
5249
}
5350

51+
@Deprecated("use jewel")
5452
@Composable
5553
fun PreviewTheme(
5654
modifier: Modifier = Modifier,

0 commit comments

Comments
 (0)