Skip to content

Commit 56f7a99

Browse files
committed
feat(plugin): add support for HarmonyOS
This commit adds support for HarmonyOS to the plugin. It modifies the `plugin.xml` file to include a new module called `cc.unitmesh.harmonyos`. It also adds a new file called `cc.unitmesh.harmonyos.xml` to the `exts/ext-harmonyos/src/main/resources` directory. The new file defines an IntelliJ plugin with a custom intention called `AndroidPageToArkUiAction`. Lastly, it modifies the `build.gradle.kts` and `settings.gradle.kts` files to include the new HarmonyOS module as a dependency.
1 parent ebc575f commit 56f7a99

File tree

6 files changed

+46
-1
lines changed

6 files changed

+46
-1
lines changed

build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ project(":plugin") {
263263
implementation(project(":scala"))
264264
implementation(project(":exts:database"))
265265
implementation(project(":exts:ext-android"))
266+
implementation(project(":exts:ext-harmonyos"))
266267
}
267268

268269
// Collects all jars produced by compilation of project modules and merges them into singe one.
@@ -571,6 +572,18 @@ project(":exts:ext-android") {
571572
}
572573
}
573574

575+
project(":exts:ext-harmonyos") {
576+
intellij {
577+
version.set(ideaVersion)
578+
type.set("AI")
579+
plugins.set((ideaPlugins + prop("androidPlugin").ifBlank { "" }).filter(String::isNotEmpty))
580+
}
581+
582+
dependencies {
583+
implementation(project(":"))
584+
}
585+
}
586+
574587
fun File.isPluginJar(): Boolean {
575588
if (!isFile) return false
576589
if (extension != "jar") return false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cc.unitmesh.harmonyos.actions
2+
3+
import cc.unitmesh.devti.intentions.action.base.ChatBaseIntention
4+
import com.intellij.openapi.editor.Editor
5+
import com.intellij.openapi.project.Project
6+
import com.intellij.psi.PsiFile
7+
8+
class AndroidPageToArkUiAction : ChatBaseIntention() {
9+
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean {
10+
return System.getProperty("idea.platform.prefix", "idea") == "DevEcoStudio"
11+
}
12+
13+
override fun priority(): Int = 900
14+
15+
override fun getText(): String = "Android Page to Ark UI"
16+
17+
override fun getFamilyName(): String = "Android Page to Ark UI"
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<idea-plugin package="cc.unitmesh.harmonyos">
2+
<!--suppress PluginXmlValidity -->
3+
<dependencies>
4+
</dependencies>
5+
6+
<extensions defaultExtensionNs="cc.unitmesh">
7+
<autoDevIntention>
8+
<className>cc.unitmesh.harmonyos.actions.AndroidPageToArkUiAction</className>
9+
<bundleName>messages.AutoDevBundle</bundleName>
10+
<categoryKey>intention.category.llm</categoryKey>
11+
</autoDevIntention>
12+
</extensions>>
13+
</idea-plugin>

goland/src/main/kotlin/cc/unitmesh/go/provider/testing/GoWriteTestService.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import com.intellij.psi.PsiElement
1818
import com.intellij.psi.PsiFile
1919
import com.intellij.psi.util.PsiTreeUtil
2020
import com.intellij.testIntegration.TestFinderHelper
21-
import com.intellij.util.PlatformUtils
2221

2322
class GoWriteTestService : WriteTestService() {
2423
override fun isApplicable(element: PsiElement): Boolean = element.containingFile?.language == GoLanguage.INSTANCE

plugin/src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434
<!-- extension modules -->
3535
<module name="cc.unitmesh.database"/>
3636
<module name="cc.unitmesh.android"/>
37+
<module name="cc.unitmesh.harmonyos"/>
3738
</content>
3839
</idea-plugin>

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ include(
2222
"exts:database",
2323
// since JetBrains also call `android.jar`, so we rename it to `ext-android`
2424
"exts:ext-android",
25+
"exts:ext-harmonyos",
2526
)

0 commit comments

Comments
 (0)