diff --git a/mpp-idea/build.gradle.kts b/mpp-idea/build.gradle.kts index 323b6c2987..5cf4bf53e4 100644 --- a/mpp-idea/build.gradle.kts +++ b/mpp-idea/build.gradle.kts @@ -37,6 +37,31 @@ repositories { } } +// Global exclusions for heavy dependencies not needed in IntelliJ plugin +// These exclusions apply to ALL configurations including transitive dependencies from includeBuild projects +configurations.all { + exclude(group = "aws.sdk.kotlin") // AWS SDK (~30MB) - from ai.koog:prompt-executor-bedrock-client + exclude(group = "aws.smithy.kotlin") // AWS Smithy runtime + exclude(group = "org.apache.tika") // Apache Tika (~100MB) - document parsing + exclude(group = "org.apache.poi") // Apache POI - Office document parsing (from Tika) + exclude(group = "org.apache.pdfbox") // PDFBox (~10MB) - PDF parsing + exclude(group = "net.sourceforge.plantuml") // PlantUML (~20MB) - from dev.snipme:highlights + exclude(group = "org.jsoup") // Jsoup HTML parser + exclude(group = "ai.koog", module = "prompt-executor-bedrock-client") // Bedrock executor + // Redis/Lettuce - not needed in IDEA plugin (~5MB) + exclude(group = "io.lettuce") + exclude(group = "io.projectreactor") + // RxJava - not needed (~2.6MB) + exclude(group = "io.reactivex.rxjava3") + // RSyntaxTextArea - IDEA has its own editor (~1.3MB) + exclude(group = "com.fifesoft") + // Netty - not needed for IDEA plugin (~3MB) + exclude(group = "io.netty") + // pty4j/jediterm - IDEA has its own terminal (~3MB) + exclude(group = "org.jetbrains.pty4j") + exclude(group = "org.jetbrains.jediterm") +} + dependencies { // Depend on mpp-ui and mpp-core JVM targets for shared UI components and ConfigManager // For KMP projects, we need to depend on the JVM target specifically @@ -98,6 +123,7 @@ dependencies { exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-core-jvm") exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-io-core") exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-io-core-jvm") + // Note: Heavy dependencies (AWS, Tika, POI, PDFBox, PlantUML, Jsoup) are excluded globally above } // Use platform-provided kotlinx libraries to avoid classloader conflicts @@ -192,6 +218,21 @@ tasks { useJUnitPlatform() } + // Exclude large font files from mpp-ui that are not needed in IDEA plugin + // These fonts are for Desktop/WASM apps, IDEA has its own fonts + named("prepareSandbox") { + // Exclude font files from the plugin distribution + // NotoSansSC-Regular.ttf (~18MB), NotoColorEmoji.ttf (~11MB x2), FiraCode fonts (~1MB) + exclude("**/fonts/**") + exclude("**/composeResources/**/font/**") + exclude("**/*.ttf") + exclude("**/*.otf") + // Also exclude icon files meant for desktop app + exclude("**/icon.icns") + exclude("**/icon.ico") + exclude("**/icon-512.png") + } + // Task to verify no conflicting dependencies are included register("verifyNoDuplicateDependencies") { group = "verification" diff --git a/mpp-idea/src/main/resources/META-INF/plugin.xml b/mpp-idea/src/main/resources/META-INF/plugin.xml index f3c963d3f7..6101d71f1c 100644 --- a/mpp-idea/src/main/resources/META-INF/plugin.xml +++ b/mpp-idea/src/main/resources/META-INF/plugin.xml @@ -1,11 +1,11 @@ cc.unitmesh.devins.idea - AutoDev Compose UI - UnitMesh + AutoDev Next + UnitMesh diff --git a/mpp-ui/build.gradle.kts b/mpp-ui/build.gradle.kts index c5f321e74c..eeb55f8719 100644 --- a/mpp-ui/build.gradle.kts +++ b/mpp-ui/build.gradle.kts @@ -696,7 +696,8 @@ tasks.register("downloadWasmFonts") { group = "build" description = "Download fonts for WASM UTF-8 support (not committed to Git)" - fontDir.set(file("src/commonMain/composeResources/font")) + // Fonts are only needed for WASM platform, so download to wasmJsMain + fontDir.set(file("src/wasmJsMain/composeResources/font")) useCJKFont.set(project.findProperty("useCJKFont")?.toString()?.toBoolean() ?: true) } diff --git a/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.android.kt b/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.android.kt index d2756605ce..102f83de33 100644 --- a/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.android.kt +++ b/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.android.kt @@ -1,5 +1,6 @@ package cc.unitmesh.devins.ui.compose.sketch +import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight @@ -30,3 +31,10 @@ actual fun getFiraCodeFontFamily(): FontFamily { FontFamily.Monospace } } + +/** + * Android implementation - use default font family + * Android has good system font support for UTF-8 + */ +@Composable +actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default diff --git a/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/AgentMessageList.kt b/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/AgentMessageList.kt index 0ba49a12ab..69dcd043e9 100644 --- a/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/AgentMessageList.kt +++ b/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/AgentMessageList.kt @@ -17,17 +17,14 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import autodev_intellij.mpp_ui.generated.resources.NotoSansSC_Regular -import autodev_intellij.mpp_ui.generated.resources.Res -import cc.unitmesh.agent.Platform import cc.unitmesh.agent.render.TimelineItem import cc.unitmesh.devins.llm.Message import cc.unitmesh.devins.llm.MessageRole import cc.unitmesh.devins.ui.compose.icons.AutoDevComposeIcons import cc.unitmesh.devins.ui.compose.sketch.SketchRenderer +import cc.unitmesh.devins.ui.compose.sketch.getUtf8FontFamily import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import org.jetbrains.compose.resources.Font @Composable fun AgentMessageList( @@ -278,7 +275,7 @@ fun MessageItem( } else { Text( text = message.content, - fontFamily = if (Platform.isWasm) FontFamily(Font(Res.font.NotoSansSC_Regular)) else FontFamily.Monospace, + fontFamily = getUtf8FontFamily(), style = MaterialTheme.typography.bodyMedium ) } diff --git a/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/editor/DevInEditorInput.kt b/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/editor/DevInEditorInput.kt index 3a45add3ce..b693d16301 100644 --- a/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/editor/DevInEditorInput.kt +++ b/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/editor/DevInEditorInput.kt @@ -25,8 +25,6 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import autodev_intellij.mpp_ui.generated.resources.NotoSansSC_Regular -import autodev_intellij.mpp_ui.generated.resources.Res import cc.unitmesh.agent.Platform import cc.unitmesh.agent.mcp.McpClientManager import cc.unitmesh.agent.mcp.McpConfig @@ -41,13 +39,13 @@ import cc.unitmesh.devins.ui.compose.editor.completion.CompletionPopup import cc.unitmesh.devins.ui.compose.editor.completion.CompletionTrigger import cc.unitmesh.devins.ui.compose.editor.highlighting.DevInSyntaxHighlighter import cc.unitmesh.devins.ui.config.ConfigManager +import cc.unitmesh.devins.ui.compose.sketch.getUtf8FontFamily import cc.unitmesh.devins.workspace.WorkspaceManager import cc.unitmesh.llm.KoogLLMService import cc.unitmesh.llm.ModelConfig import cc.unitmesh.llm.PromptEnhancer import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import org.jetbrains.compose.resources.Font /** * DevIn 编辑器输入组件 @@ -485,7 +483,7 @@ fun DevInEditorInput( .onPreviewKeyEvent { handleKeyEvent(it) }, textStyle = TextStyle( - fontFamily = if (Platform.isWasm) FontFamily(Font(Res.font.NotoSansSC_Regular)) else FontFamily.Monospace, + fontFamily = getUtf8FontFamily(), fontSize = inputFontSize, color = MaterialTheme.colorScheme.onSurface, lineHeight = inputLineHeight diff --git a/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.kt b/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.kt index 7053a1fa0c..7999a37b04 100644 --- a/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.kt +++ b/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.kt @@ -1,5 +1,6 @@ package cc.unitmesh.devins.ui.compose.sketch +import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily /** @@ -12,3 +13,11 @@ expect fun getFiraCodeFontFamily(): FontFamily * Get default monospace font family as fallback */ fun getDefaultMonospaceFontFamily(): FontFamily = FontFamily.Monospace + +/** + * Get UTF-8 font family for text display + * On WASM, returns Noto Sans SC for CJK support + * On other platforms, returns default font family + */ +@Composable +expect fun getUtf8FontFamily(): FontFamily diff --git a/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.ios.kt b/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.ios.kt index 61a74f917d..a9323e9558 100644 --- a/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.ios.kt +++ b/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.ios.kt @@ -1,5 +1,6 @@ package cc.unitmesh.devins.ui.compose.sketch +import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily /** @@ -12,3 +13,10 @@ actual fun getFiraCodeFontFamily(): FontFamily { return FontFamily.Monospace } +/** + * iOS implementation - use default font family + * iOS has good system font support for UTF-8 + */ +@Composable +actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default + diff --git a/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.js.kt b/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.js.kt index 1cca68b762..d18464c1ec 100644 --- a/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.js.kt +++ b/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.js.kt @@ -1,5 +1,6 @@ package cc.unitmesh.devins.ui.compose.sketch +import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily /** @@ -14,3 +15,10 @@ actual fun getFiraCodeFontFamily(): FontFamily { // The browser will use the system's monospace font return FontFamily.Monospace } + +/** + * JS implementation - use default font family + * Browser has good system font support for UTF-8 + */ +@Composable +actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default diff --git a/mpp-ui/src/jvmMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.jvm.kt b/mpp-ui/src/jvmMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.jvm.kt index 168039403d..5edd109a24 100644 --- a/mpp-ui/src/jvmMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.jvm.kt +++ b/mpp-ui/src/jvmMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.jvm.kt @@ -1,5 +1,6 @@ package cc.unitmesh.devins.ui.compose.sketch +import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.platform.Font @@ -29,3 +30,10 @@ actual fun getFiraCodeFontFamily(): FontFamily { FontFamily.Monospace } } + +/** + * JVM implementation - use default font family + * JVM has good system font support for UTF-8 + */ +@Composable +actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default diff --git a/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.wasmJs.kt b/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.wasmJs.kt index d6ea550974..c6ffa413ce 100644 --- a/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.wasmJs.kt +++ b/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/CodeFont.wasmJs.kt @@ -1,14 +1,27 @@ package cc.unitmesh.devins.ui.compose.sketch +import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily +import autodev_intellij.mpp_ui.generated.resources.NotoSansSC_Regular +import autodev_intellij.mpp_ui.generated.resources.Res +import org.jetbrains.compose.resources.Font /** * WASM JS implementation of FiraCode font loading * Falls back to default monospace - * + * * Note: This is non-composable to match the expect declaration in commonMain */ actual fun getFiraCodeFontFamily(): FontFamily { // WASM uses default monospace for code return FontFamily.Monospace } + +/** + * WASM implementation - use Noto Sans SC for CJK support + * This font is only bundled in WASM builds (~18MB) + */ +@Composable +actual fun getUtf8FontFamily(): FontFamily { + return FontFamily(Font(Res.font.NotoSansSC_Regular)) +}