Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Backbase AI #63

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--scan" />
<option name="scriptParameters" value="--debug" />
<option name="taskDescriptions">
<list />
</option>
59 changes: 22 additions & 37 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -2,30 +2,21 @@ import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType


fun properties(key: String) = project.findProperty(key).toString()

plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.9.25"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij.platform") version "2.1.0"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.2.1"
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "2024.2.3"
// Kover
id("org.jetbrains.kotlinx.kover") version "0.8.3"
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
}

group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project. Use Java 17 for 2022.2+ and Java 21 for 2024.2+ .
kotlin {
jvmToolchain(17)
jvmToolchain(21)

}

@@ -44,18 +35,22 @@ repositories {
dependencies {

val junitVersion = "5.10.2"
implementation("com.squareup.okhttp3:okhttp:4.9.3")
implementation("com.google.code.gson:gson:2.8.8")
implementation("com.vladsch.flexmark:flexmark-all:0.64.0")
implementation("org.asciidoctor:asciidoctorj:2.5.3")
implementation("com.azure:azure-search-documents:11.7.0") {
exclude(group = "org.slf4j", module = "slf4j-api")
}

testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.vintage:junit-vintage-engine:$junitVersion")

intellijPlatform {

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html

create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))

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

@@ -71,7 +66,6 @@ dependencies {

// 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")

@@ -106,19 +100,21 @@ intellijPlatform {
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" }) }
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

pluginVerification {
ides {
recommended()
@@ -128,15 +124,11 @@ intellijPlatform {

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {

groups.empty()
version = providers.gradleProperty("pluginVersion")
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl") //NA

repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}

// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
// (Kover is a set of solutions for collecting test coverage of Kotlin code compiled for JVM and Android platforms. )
kover {
reports {
total {
@@ -145,11 +137,6 @@ kover {
}
}
}
currentProject {
instrumentation {
excludedClasses.add("org.apache.velocity.*")
}
}
}

tasks {
@@ -171,7 +158,7 @@ intellijPlatformTesting {
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false"
"-Djb.consents.confirmation.enabled=false",
)
}
}
@@ -181,6 +168,4 @@ intellijPlatformTesting {
}
}
}
}


}
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -5,25 +5,25 @@ pluginGroup = com.backbase
pluginName = backbase-services-toolkit
pluginRepositoryUrl = https://github.com/Backbase/backbase-services-toolkit
# SemVer format -> https://semver.org
pluginVersion = 1.0.2
pluginVersion = 2.0.2

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 241
pluginSinceBuild = 242
pluginUntilBuild = 243.*

# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
#platformVersion is RC version of 2024.3
platformType = IC
platformVersion = 243.21565.129
platformVersion = 2024.3

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins =
platformBundledPlugins = com.intellij.java, org.jetbrains.idea.maven,

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.9
gradleVersion = 8.10.2

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
20 changes: 20 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[versions]
# libraries
junit = "4.13.2"

# plugins
changelog = "2.2.1"
intelliJPlatform = "2.1.0"
kotlin = "1.9.25"
kover = "0.8.3"
qodana = "2024.2.3"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ class DefineEventAction : DumbAwareAction(){
configuration.ensureTagExists()


val packageName = SsdkUtils.cleanPackageName(project.name.lowercase())
val packageName = SsdkUtils.cleanPackageName(project.name.toLowerCase())
addElement(configuration, "inputFile", "\${project.basedir}/src/main/resources/events")
addElement(configuration, "outputFile", "\${project.build.directory}/generated-sources/events")
addElement(configuration, "basePackageName", "\${project.groupId}")
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ class GenerateHooksAction : DumbAwareAction() {
BehaviourExtensionsConstants.PACKAGE_NAME,
apiPackage
)
properties.setProperty(BehaviourExtensionsConstants.BEHAVIOUR_NAME, serviceNameWithBehaviour.lowercase())
properties.setProperty(BehaviourExtensionsConstants.BEHAVIOUR_NAME, serviceNameWithBehaviour.toLowerCase())
properties.setProperty(
BehaviourExtensionsConstants.BEHAVIOUR_NAME_CAMELCASE,
CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, serviceNameWithBehaviour.replace("-", "_"))
47 changes: 47 additions & 0 deletions src/main/kotlin/com/backbase/bst/ai/AIResponsePanel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import com.vladsch.flexmark.html.HtmlRenderer
import com.vladsch.flexmark.parser.Parser
import java.awt.BorderLayout
import javax.swing.BorderFactory
import javax.swing.JEditorPane
import javax.swing.JPanel

class AIResponsePanel(message: String) : JPanel() {

Check notice on line 8 in src/main/kotlin/com/backbase/bst/ai/AIResponsePanel.kt

GitHub Actions / Qodana Community for JVM

Package name does not match containing directory

Package directive does not match the file location
init {
layout = BorderLayout()
val parser = Parser.builder().build()
val renderer = HtmlRenderer.builder().build()
val document = parser.parse(message)
val htmlContent = """
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align: justify;
}
pre {
position: relative;
padding: 10px;
background: #f5f5f5;
border: 1px solid #ddd;
}
pre code {
display: block;
}
</style>


</head>
<body>
<h><b>Backbase AI</b></h>
${renderer.render(document)}
</body>
</html>
""".trimIndent()
System.out.println(htmlContent);

Check warning on line 41 in src/main/kotlin/com/backbase/bst/ai/AIResponsePanel.kt

GitHub Actions / Qodana Community for JVM

Redundant semicolon

Redundant semicolon

Check notice on line 41 in src/main/kotlin/com/backbase/bst/ai/AIResponsePanel.kt

GitHub Actions / Qodana Community for JVM

Java methods should be replaced with Kotlin analog

Should be replaced with Kotlin function
val editorPane = JEditorPane("text/html", htmlContent)
editorPane.isEditable = false
editorPane.border = BorderFactory.createEmptyBorder(5, 5, 5, 5)
add(editorPane, BorderLayout.CENTER)
}
}
Loading
Loading