Skip to content

Commit

Permalink
feat: adds syntax Highlighter
Browse files Browse the repository at this point in the history
The Syntax Highlighter was finally added to the plugin.
It recreates the plugin using newer tools. The pkg name was also changed to one more appropriate.
Benthos references were changed to Redpanda Connect.

BREAKING-CHANGE: Minimum supported IDE version is now 2023.3
  • Loading branch information
pcha committed Feb 2, 2025
1 parent 7446db4 commit f731676
Show file tree
Hide file tree
Showing 35 changed files with 644 additions and 458 deletions.
54 changes: 51 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
/.idea/
/build/
/.gradle/
.gradle
build/
/src/main/gen/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
/.idea/.gitignore
/.idea/gradle.xml
/.idea/icon.svg
/.idea/kotlinc.xml
/.idea/material_theme_project_new.xml
/.idea/misc.xml
/.idea/vcs.xml
/.run/
/.intellijPlatform/
86 changes: 59 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,68 +1,100 @@
plugins {
id("org.jetbrains.intellij") version "1.4.0"
kotlin("jvm") version "1.5.10"
java
id("org.jetbrains.grammarkit") version "2021.2.2"
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.25"
id("org.jetbrains.intellij.platform") version "2.2.1"
id("org.jetbrains.grammarkit") version "2022.3.2.2"
}

group = "org.pcha"
group = "com.github.pcha"
version = System.getenv("VERSION")


repositories {
mavenCentral()

intellijPlatform {
defaultRepositories()
}
}

dependencies {
implementation(kotlin("stdlib"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
intellijPlatform {
intellijIdeaCommunity("2023.3")
}
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set("2022.1.2")
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
//intellij {
// version.set("2024.1.7")
// type.set("IC") // Target IDE Platform
//
// plugins.set(listOf(/* Plugin Dependencies */))
//}

grammarKit {
jflexRelease.set("1.7.0-1")
grammarKitRelease.set("2021.1.2")
}


tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}

patchPluginXml {
sinceBuild.set("233")
// untilBuild.set("243.*")
changeNotes.set(System.getenv("CHANGELOG"))
}

generateLexer {
// source flex file
source.set("src/main/java/org/pcha/benthos/language/Bloblang.flex")
sourceFile.set(file("src/main/kotlin/com/github/pcha/bloblang/Bloblang.flex"))

// target directory for lexer
targetDir.set("src/main/gen/org/pcha/benthos/language")

// target classname, target file will be targetDir/targetClass.java
targetClass.set("BloblangLexer")
targetOutputDir.set(file("src/main/gen/com/github/pcha/bloblang"))

// if set, plugin will remove a lexer output file before generating new one. Default: false
purgeOldFiles.set(true)
// purgeOldFiles.set(true)

dependsOn(generateParser)
}

generateParser {
// source bnf file
source.set("src/main/java/org/pcha/benthos/language/Bloblang.bnf")
sourceFile.set(file("src/main/kotlin/com/github/pcha/bloblang/Bloblang.bnf"))

// optional, task-specific root for the generated files. Default: none
targetRoot.set("src/main/gen")
targetRootOutputDir.set(file("src/main/gen"))

// path to a parser file, relative to the targetRoot
pathToParser.set("org/pcha/benthos/language/parser/BloblangParser.java")
pathToParser.set("com/github/pcha/bloblang/parser/BloblangParser.java")

// path to a directory with generated psi files, relative to the targetRoot
pathToPsiRoot.set("org/pcha/benthos/language/psi")
pathToPsiRoot.set("com/github/pcha/bloblang/psi")

// if set, the plugin will remove a parser output file and psi output directory before generating new ones. Default: false
purgeOldFiles.set(true)
}

compileJava {
dependsOn(generateLexer, generateParser)
compileKotlin {
dependsOn(generateLexer)
}

patchPluginXml {
sinceBuild.set("203")
changeNotes.set(System.getenv("CHANGELOG"))
}


// signPlugin {
// certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
// privateKey.set(System.getenv("PRIVATE_KEY"))
// password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
// }

publishPlugin {
token.set(System.getenv("INTELLIJ_MARKETPLACE_TOKEN"))
Expand Down
7 changes: 6 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
kotlin.code.style=official
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency=false
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache=true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit f731676

Please sign in to comment.