diff --git a/README.md b/README.md index 8731052..46a6b68 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ # VbsCLion -CLion (JetBrains) plugin assets for VoidBuildSystem, generated by `vbs ide plugin`. \ No newline at end of file +CLion (JetBrains) plugin assets for VoidBuildSystem (VBS), generated by: + +```sh +vbs ide plugin --editor clion --output ./ +``` + +CLion can also read the CMake File API document emitted by `vbs ide generate`, so this plugin is +complementary: it adds Tools-menu actions for `vbs build` and `vbs install`. + +## Build + +```sh +./gradlew buildPlugin +``` + +Set `VBS_BIN` if `vbs` is not on `PATH`. diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..ba7133c --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + kotlin("jvm") version "2.0.21" + id("org.jetbrains.intellij.platform") version "2.1.0" +} + +group = "com.faumaray" +version = "0.1.0" + +repositories { + mavenCentral() + intellijPlatform { defaultRepositories() } +} + +dependencies { + intellijPlatform { create("CL", "2024.2") } +} + +intellijPlatform { + pluginConfiguration { ideaVersion { sinceBuild = "242" } } +} diff --git a/src/main/kotlin/com/faumaray/vbs/VbsActions.kt b/src/main/kotlin/com/faumaray/vbs/VbsActions.kt new file mode 100644 index 0000000..eaddabf --- /dev/null +++ b/src/main/kotlin/com/faumaray/vbs/VbsActions.kt @@ -0,0 +1,29 @@ +package com.faumaray.vbs + +import com.intellij.execution.configurations.GeneralCommandLine +import com.intellij.execution.process.OSProcessHandler +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.project.Project + +private fun runVbs(project: Project, title: String, args: List) { + val command = GeneralCommandLine(listOf(System.getenv("VBS_BIN") ?: "vbs") + args) + .withWorkDirectory(project.basePath) + val handler = OSProcessHandler(command) + handler.startNotify() + println("[$title] ${command.commandLineString}") +} + +class BuildAction : AnAction("VBS: Build") { + override fun actionPerformed(event: AnActionEvent) { + event.project?.let { runVbs(it, "build", listOf("build")) } + } +} + +class InstallAction : AnAction("VBS: Install") { + override fun actionPerformed(event: AnActionEvent) { + event.project?.let { + runVbs(it, "install", listOf("install", "--prefix", "build/install")) + } + } +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml new file mode 100644 index 0000000..3c54986 --- /dev/null +++ b/src/main/resources/META-INF/plugin.xml @@ -0,0 +1,18 @@ + + com.faumaray.vbs + VoidBuildSystem + Void + Build, test, install and package with VoidBuildSystem (VBS). + com.intellij.modules.platform + com.intellij.modules.cidr.lang + + + + + + + + +