From 4725ae44304a3b66b75417a979d5e3d38417875a Mon Sep 17 00:00:00 2001 From: Oleg Kizeev Date: Thu, 16 Nov 2023 12:57:25 +0700 Subject: [PATCH] Workflow configuration --- .idea/kotlinc.xml | 2 +- CHANGELOG.md | 29 ++++++++ README.md | 24 ++++--- build.gradle.kts | 92 ++++++++++++++++++-------- gradle.properties | 2 + gradle/libs.versions.toml | 29 ++++++++ src/main/resources/META-INF/plugin.xml | 24 ------- 7 files changed, 140 insertions(+), 62 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 gradle/libs.versions.toml diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index fdf8d99..f8467b4 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5c2ae93 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ + + +# Slint-Idea-Plugin Changelog + +## [Unreleased] + +## [0.2.7] - 2023-11-15 + +### Fixed +- export error; +- repetition error; +- conditional element error; +- model declaration error; + +## [0.2.6] - 2023-11-13 + +### Fixed +- color error for hex colors with alpha channel; +- state declaration error; +- export error; +- error declaring global singletons; +- property binding error; +- element declaration error; +- error declaring an animation block; +- image declaration error; +- gradient declaration error; + +### Added +- added highlighting of numeric values with units; diff --git a/README.md b/README.md index 6746b35..ece6f3d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,20 @@ # Slint plugin for the IntelliJ Platform +[![Build](https://github.com/kizeevov/slint-idea-plugin/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/kizeevov/slint-idea-plugin/actions/workflows/build.yml) +[![Version](https://img.shields.io/jetbrains/plugin/v/23065.svg)](https://plugins.jetbrains.com/plugin/23065) +[![Downloads](https://img.shields.io/jetbrains/plugin/d/23065.svg)](https://plugins.jetbrains.com/plugin/23065) + ## Description + [Slint](https://slint.dev) support for IDEs based on IntelliJ Platform. **Plugin is experimental and unofficial!** +The following features are supported: +- Syntax highlighting +- Slint-LSP support +- Preview support + + Tested with: - CLion 2023.2 - IDEA Ultimate 2023.2 @@ -16,16 +27,14 @@ Slint IntelliJ Plugin communicates with Slint-LSP. Install before you can use th $ cargo install slint-lsp ``` -> need version 1.2.2 and above - ## Installation -- Using IDE built-in plugin system: +Using IDE built-in plugin system: Preferences > Plugins > Marketplace > Search for "slint" > Install Plugin -- Manually: +Manually: Download the [latest release](https://github.com/kizeevov/slint-idea-plugin/releases) and install it manually using Preferences > Plugins > ⚙️ > Install plugin from disk... @@ -33,10 +42,3 @@ $ cargo install slint-lsp ## Configuration Go to Settings > Languages & Frameworks > Slint > Slint-lsp path selected path - -## Features - -- [x] highlighting -- [x] slint-lsp support -- [x] preview support -- [x] plugin configuration diff --git a/build.gradle.kts b/build.gradle.kts index c48e035..36458f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,17 +1,21 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.intellij.tasks.PatchPluginXmlTask +import org.jetbrains.changelog.Changelog +import org.jetbrains.changelog.markdownToHTML -fun properties(key: String) = project.findProperty(key).toString() +fun properties(key: String) = providers.gradleProperty(key) +fun environment(key: String) = providers.environmentVariable(key) plugins { id("java") - id("org.jetbrains.kotlin.jvm") version "1.9.0" - id("org.jetbrains.intellij") version "1.16.0" - id("org.jetbrains.grammarkit") version "2022.3.1" + alias(libs.plugins.kotlin) + alias(libs.plugins.intellij) + alias(libs.plugins.grammarkit) + alias(libs.plugins.changelog) } -group = properties("pluginGroup") -version = properties("pluginVersion") +group = properties("pluginGroup").get() +version = properties("pluginVersion").get() idea { module { @@ -44,25 +48,30 @@ repositories { // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { - pluginName.set(properties("pluginName")) - version.set(properties("platformVersion")) - type.set(properties("platformType")) - plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) + pluginName = properties("pluginName") + version = properties("platformVersion") + type = properties("platformType") + plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } +} + +changelog { + groups.empty() + repositoryUrl = properties("pluginRepositoryUrl") } tasks { generateLexer { - sourceFile.set(file("src/main/grammars/SlintLexer.flex")) - targetDir.set("src/gen/dev/slint/ideaplugin/lang/lexer") - targetClass.set("_SlintLexer") - purgeOldFiles.set(true) + sourceFile = file("src/main/grammars/SlintLexer.flex") + targetDir = "src/gen/dev/slint/ideaplugin/lang/lexer" + targetClass = "_SlintLexer" + purgeOldFiles = true } generateParser { - sourceFile.set(file("src/main/grammars/SlintParser.bnf")) - targetRoot.set("src/gen") - pathToParser.set("dev/slint/ideaplugin/lang/parser/SlintParser.java") - pathToPsiRoot.set("dev/slint/ideaplugin/lang/psi") - purgeOldFiles.set(true) + sourceFile = file("src/main/grammars/SlintParser.bnf") + targetRoot = "src/gen" + pathToParser = "dev/slint/ideaplugin/lang/parser/SlintParser.java" + pathToPsiRoot = "dev/slint/ideaplugin/lang/psi" + purgeOldFiles = true // classpath(project(":$grammarKitFakePsiDeps").sourceSets.main.get().runtimeClasspath) } @@ -78,18 +87,49 @@ tasks { } withType { - version.set(properties("pluginVersion")) - sinceBuild.set(properties("pluginSinceBuild")) - untilBuild.set(properties("pluginUntilBuild")) + version = properties("pluginVersion") + sinceBuild = properties("pluginSinceBuild") + untilBuild = properties("pluginUntilBuild") + + // Extract the section from README.md and provide for the plugin's manifest + pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + val start = "" + val end = "" + + with (it.lines()) { + if (!containsAll(listOf(start, end))) { + throw GradleException("Plugin description section not found in README.md:\n$start ... $end") + } + subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) + } + } + + val changelog = project.changelog // local variable for configuration cache compatibility + // Get the latest available change notes from the changelog file + changeNotes = properties("pluginVersion").map { pluginVersion -> + with(changelog) { + renderItem( + (getOrNull(pluginVersion) ?: getUnreleased()) + .withHeader(false) + .withEmptySections(false), + Changelog.OutputType.HTML, + ) + } + } } signPlugin { - certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) - privateKey.set(System.getenv("PRIVATE_KEY")) - password.set(System.getenv("PRIVATE_KEY_PASSWORD")) + certificateChain = environment("CERTIFICATE_CHAIN") + privateKey = environment("PRIVATE_KEY") + password = environment("PRIVATE_KEY_PASSWORD") } publishPlugin { - token.set(System.getenv("PUBLISH_TOKEN")) + dependsOn("patchChangelog") + token = environment("PUBLISH_TOKEN") + // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 + // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: + // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel + channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 109fc62..9cc357a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,8 @@ org.gradle.configuration-cache = true # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html org.gradle.caching = true +pluginRepositoryUrl = https://github.com/kizeevov/slint-idea-plugin + pluginGroup = dev.slint pluginName = SlintPlugin pluginVersion = 0.2.7 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..784f63a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,29 @@ +[versions] +# libraries +annotations = "24.0.1" + +# plugins +kotlin = "1.9.10" +changelog = "2.2.0" +intellij = "1.16.0" +grammarkit = "2022.3.1" + +#gradleIntelliJPlugin = "1.15.0" +#qodana = "0.1.13" +#kover = "0.7.4" + +[libraries] +annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } + +[plugins] +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } +intellij = { id = "org.jetbrains.intellij", version.ref = "intellij" } +grammarkit = { id = "org.jetbrains.grammarkit", version.ref = "grammarkit" } + + +# gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } + +#kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +#kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +#qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } \ No newline at end of file diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 7f909dd..b822913 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -11,30 +11,6 @@ kizeev messages.SlintBundle - - Slint. Plugin is experimental and unofficial
- Features:
-
    -
  • highlighting
  • -
  • slint-lsp support
  • -
  • preview support
  • -
  • plugin configuration
  • -
- ]]>
- - -
  • export error;
  • -
  • repetition error;
  • -
  • conditional element error;
  • -
  • model declaration error;
  • - - ]]>
    - com.intellij.modules.platform com.intellij.modules.ultimate