Skip to content

Commit f5aaf99

Browse files
committed
build(mpp-idea): update dependencies and enable Compose support
Add required repositories and bundled Compose modules, update plugin list, and configure Kotlin toolchain for improved IntelliJ compatibility.
1 parent 6082869 commit f5aaf99

File tree

1 file changed

+57
-33
lines changed

1 file changed

+57
-33
lines changed

mpp-idea/build.gradle.kts

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import groovy.xml.XmlParser
2-
import org.gradle.api.JavaVersion.VERSION_17
32
import org.jetbrains.changelog.Changelog
43
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
54
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType.IntellijIdeaUltimate
@@ -58,14 +57,33 @@ changelog {
5857
}
5958

6059
repositories {
60+
mavenLocal() // For locally published mpp-ui and mpp-core artifacts
6161
mavenCentral()
62+
google()
63+
// Required for mpp-ui's webview dependencies (jogamp)
64+
maven("https://jogamp.org/deployment/maven")
65+
maven("https://oss.sonatype.org/content/repositories/snapshots/")
66+
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies/")
6267

6368
intellijPlatform {
6469
defaultRepositories()
6570
jetbrainsRuntime()
6671
}
6772
}
6873

74+
75+
kotlin {
76+
jvmToolchain(17)
77+
78+
compilerOptions {
79+
freeCompilerArgs.addAll(
80+
listOf(
81+
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi"
82+
)
83+
)
84+
}
85+
}
86+
6987
configure(subprojects) {
7088
apply {
7189
plugin("idea")
@@ -96,8 +114,8 @@ configure(subprojects) {
96114
}
97115

98116
configure<JavaPluginExtension> {
99-
sourceCompatibility = VERSION_17
100-
targetCompatibility = VERSION_17
117+
sourceCompatibility = JavaVersion.VERSION_17
118+
targetCompatibility = JavaVersion.VERSION_17
101119
}
102120

103121
tasks.withType<KotlinCompile> {
@@ -156,28 +174,32 @@ project(":") {
156174
}
157175
}
158176

159-
// Exclude root project source compilation temporarily
160-
// Root project Compose code requires additional configuration
177+
// Enable root project source compilation for toolwindow classes
178+
// Temporarily disable root project source compilation due to Compose dependency conflicts
179+
// All functionality is in sub-modules which compile successfully
161180
sourceSets {
162181
main {
163182
java {
164-
setSrcDirs(emptyList<String>())
183+
// srcDirs("src/main/java")
165184
}
166185
kotlin {
167-
setSrcDirs(emptyList<String>())
186+
// srcDirs("src/main/kotlin")
168187
}
169-
}
170-
test {
171-
java {
172-
setSrcDirs(emptyList<String>())
173-
}
174-
kotlin {
175-
setSrcDirs(emptyList<String>())
188+
resources {
189+
srcDirs("src/main/resources")
176190
}
177191
}
178192
}
179193

194+
// Handle duplicate resources from dependencies
195+
tasks.named<Copy>("processResources") {
196+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
197+
}
198+
180199
repositories {
200+
mavenCentral()
201+
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
202+
181203
intellijPlatform {
182204
defaultRepositories()
183205
jetbrainsRuntime()
@@ -227,7 +249,12 @@ project(":") {
227249
jetbrainsRuntime()
228250
}
229251

230-
val pluginList: MutableList<String> = mutableListOf("Git4Idea")
252+
val pluginList: MutableList<String> = mutableListOf(
253+
"Git4Idea",
254+
"org.jetbrains.plugins.terminal",
255+
"org.intellij.plugins.markdown",
256+
"com.jetbrains.sh"
257+
)
231258
when (lang) {
232259
"idea" -> {
233260
pluginList += javaPlugins
@@ -247,6 +274,18 @@ project(":") {
247274
}
248275
intellijPlugins(pluginList)
249276

277+
// Compose support dependencies (bundled in IDEA 252+)
278+
// Note: Jewel modules are not available in IU-252, only use platform.compose
279+
// Compose support dependencies (bundled in IDEA 252+)
280+
bundledModules(
281+
"intellij.libraries.skiko",
282+
"intellij.libraries.compose.foundation.desktop",
283+
"intellij.platform.jewel.foundation",
284+
"intellij.platform.jewel.ui",
285+
"intellij.platform.jewel.ideLafBridge",
286+
"intellij.platform.compose"
287+
)
288+
250289
pluginModule(implementation(project(":mpp-idea-core")))
251290
pluginModule(implementation(project(":mpp-idea-lang:java")))
252291
pluginModule(implementation(project(":mpp-idea-lang:kotlin")))
@@ -278,24 +317,9 @@ project(":") {
278317
implementation(project(":mpp-idea-exts:ext-terminal"))
279318
implementation(project(":mpp-idea-exts:devins-lang"))
280319

281-
// mpp-core dependency for root project source code
282-
implementation("cc.unitmesh:mpp-core:${prop("mppVersion")}") {
283-
// Exclude Compose dependencies - IntelliJ provides its own via bundledModules
284-
exclude(group = "org.jetbrains.compose")
285-
exclude(group = "org.jetbrains.compose.runtime")
286-
exclude(group = "org.jetbrains.compose.foundation")
287-
exclude(group = "org.jetbrains.compose.material3")
288-
exclude(group = "org.jetbrains.compose.material")
289-
exclude(group = "org.jetbrains.compose.ui")
290-
exclude(group = "org.jetbrains.skiko")
291-
// Exclude kotlinx libraries - IntelliJ provides its own
292-
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
293-
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core-jvm")
294-
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-json")
295-
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-json-jvm")
296-
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-core")
297-
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-core-jvm")
298-
}
320+
// mpp-core dependency for root project - allow Compose dependencies for compilation
321+
// Runtime will use IntelliJ's bundled Compose via bundledModule
322+
implementation("cc.unitmesh:mpp-core:${prop("mppVersion")}")
299323
}
300324

301325
tasks {

0 commit comments

Comments
 (0)