Skip to content

Commit

Permalink
Handle move to Ladybird organization, update to new JetBrains plugin
Browse files Browse the repository at this point in the history
And make sure it works for CLion 2024.2.1
  • Loading branch information
ADKaster committed Sep 10, 2024
1 parent 911ca1e commit ae2d1eb
Show file tree
Hide file tree
Showing 78 changed files with 434 additions and 453 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.gradle
.idea
.intellijPlatform
.qodana
build
src/main/gen
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
# Changelog

## Unreleased
### Added
- GML support
- Syntax highlighting
- Basic completion: navigate from a component to it's C++ definition
- A formatter which completely supports Serenity's GML styling
- Widget and property autocompletion
- Documentation on element hover for both widgets and properties
- Type linting
### Changed

- Forked into LadybirdBrowser organization

## 1.1.0 - 2024-01-21

Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2023 Matthew Olsson <[email protected]>
Copyright (c) 2024 The Ladybird Browser Initiative

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# SerenityOS DSL IntelliJ Plugin
# Ladybird DSL IntelliJ Plugin

![Build](https://github.com/mattco98/serenityos-intellij-plugin/workflows/Build/badge.svg)
[![Version](https://img.shields.io/jetbrains/plugin/v/SerenityOS-DSL.svg)](https://plugins.jetbrains.com/plugin/SerenityOS-DSL)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/SerenityOS-DSL.svg)](https://plugins.jetbrains.com/plugin/SerenityOS-DSL)
![Build](https://github.com/LadybirdBrowser/Ladybird-DSL-Plugin/workflows/Build/badge.svg)
[![Version](https://img.shields.io/jetbrains/plugin/v/Ladybird-DSL.svg)](https://plugins.jetbrains.com/plugin/Ladybird-DSL)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/Ladybird-DSL.svg)](https://plugins.jetbrains.com/plugin/Ladybird-DSL)

<!-- Plugin description -->
Adds syntax highlighting for SerenityOS-specific file types. Currently only supports .idl files.
Adds syntax highlighting for Ladybird file types. Currently supports IDL and IPC files.

Features:
- Syntax highlighting
Expand All @@ -22,16 +22,16 @@ Features:

- Using the IDE built-in plugin system:

<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "SerenityOS DSL"</kbd> >
<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "Ladybird DSL"</kbd> >
<kbd>Install</kbd>

- Manually:

Download the [latest release](https://github.com/mattco98/serenityos-intellij-plugin/releases/latest) and install it manually using
Download the [latest release](https://github.com/LadybirdBrowser/Ladybird-DSL-Plugin/releases/latest) and install it manually using
<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>⚙️</kbd> > <kbd>Install plugin from disk...</kbd>

## Attribution

The icon used as the plugin logo and file icon is the [WebIDL logo](https://resources.whatwg.org/logo-webidl.svg),
The icon used as the IDL file icon is the [WebIDL logo](https://resources.whatwg.org/logo-webidl.svg),
licensed under [CC BY 4.0](https://github.com/whatwg/webidl/blob/main/LICENSE). It has been altered slightly to have
a transparent background instead of a white background.
163 changes: 109 additions & 54 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,116 @@ import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
import org.jetbrains.grammarkit.tasks.GenerateParserTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform


fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
idea
id("idea")
id("java") // Java support
alias(libs.plugins.kotlin)
alias(libs.plugins.intellijPlatform)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.grammarkit)
alias(libs.plugins.gradleIntelliJPlugin)
alias(libs.plugins.changelog)
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(21)
}

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation(libs.kotlinSerialization)

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))


// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

instrumentationTools()
pluginVerifier()
zipSigner()
}
}

intellij {
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
version = providers.gradleProperty("pluginVersion")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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 = providers.gradleProperty("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}

ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}

signing {
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
privateKey = providers.environmentVariable("PRIVATE_KEY")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}

publishing {
token = providers.environmentVariable("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 = providers.gradleProperty("pluginVersion")
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

pluginVerification {
ides {
recommended()
}
}
}

changelog {
Expand All @@ -60,25 +139,24 @@ tasks {
generateLexer.configure { enabled = false }
generateParser.configure { enabled = false }

val supportedDSLs = listOf("GML", "IDL", "IPC")
val supportedDSLs = listOf("IDL", "IPC")

for (dsl in supportedDSLs) {
task<GenerateLexerTask>("generate${dsl}Lexer") {
group = "grammarkit"
sourceFile.set(file("src/main/resources/grammar/SerenityOS ${dsl}.flex"))
targetDir.set("src/main/gen/me/mattco/serenityos/${dsl.lowercase()}")
targetClass.set("${dsl}Lexer.java")
purgeOldFiles.set(true)
sourceFile.set(layout.projectDirectory.file("src/main/resources/grammar/Ladybird ${dsl}.flex"))
targetOutputDir.set(layout.projectDirectory.dir("src/main/gen/org/ladybird/dsl"))
purgeOldFiles.set(false)
skeleton
}

task<GenerateParserTask>("generate${dsl}Parser") {
group = "grammarkit"
sourceFile.set(file("src/main/resources/grammar/SerenityOS ${dsl}.bnf"))
targetRoot.set("src/main/gen")
pathToParser.set("me/mattco/serenityos/${dsl.lowercase()}/${dsl}Parser.java")
pathToPsiRoot.set("me/mattco/serenityos/${dsl.lowercase()}/psi")
purgeOldFiles.set(true)
sourceFile.set(layout.projectDirectory.file("src/main/resources/grammar/Ladybird ${dsl}.bnf"))
targetRootOutputDir.set(layout.projectDirectory.dir("src/main/gen"))
pathToParser.set("org/ladybird/dsl/${dsl.lowercase()}/${dsl}Parser.java")
pathToPsiRoot.set("org/ladybird/dsl/${dsl.lowercase()}/psi")
purgeOldFiles.set(false)
}
}

Expand All @@ -99,47 +177,24 @@ tasks {
gradleVersion = properties("gradleVersion").get()
}

runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
publishPlugin {
dependsOn(patchChangelog)
}
}

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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,
)
}
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
}
}

publishPlugin {
dependsOn("patchChangelog")
token = environment("PUBLISH_TOKEN")
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
plugins {
robotServerPlugin()
}
}
20 changes: 11 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
pluginGroup=me.mattco.serenityos
pluginName=SerenityOS-DSL
pluginVersion=1.1.0
pluginSinceBuild=232
pluginUntilBuild=233.*
pluginGroup=org.ladybird.dsl
pluginName=Ladybird-DSL
pluginVersion=2.0.0
pluginSinceBuild=242
pluginUntilBuild=243.*
platformType=CL
platformVersion=2023.3.2
platformVersion=2024.2.1
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins=com.intellij.clion,com.intellij.cidr.lang,com.intellij.cidr.base
javaVersion=17
gradleVersion=8.5
platformPlugins=
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins=com.intellij.clion,com.intellij.cidr.base,com.intellij.cidr.lang
javaVersion=21
gradleVersion=8.9
# The platform includes Kotlin, so we don't have to
kotlin.stdlib.default.dependency=false
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
annotations = "24.1.0"

# plugins
kotlin = "1.9.22"
intellijPlatform = "2.0.1"
kotlin = "1.9.25"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.17.0"
grammarkit = "2022.3.2.1"
grammarkit = "2022.3.2.2"
kotlinxSerialization = "1.6.2"

[libraries]
Expand All @@ -15,7 +15,7 @@ kotlinSerialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-seriali

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
intellijPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intellijPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
grammarkit = { id = "org.jetbrains.grammarkit", version.ref = "grammarkit" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

rootProject.name = "SerenityOS-DSL-Plugin"
rootProject.name = "Ladybird-DSL-Plugin"

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ae2d1eb

Please sign in to comment.