summaryrefslogtreecommitdiffstats
path: root/integration
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@vespa.ai>2023-05-05 15:30:31 +0200
committerJon Bratseth <bratseth@vespa.ai>2023-05-05 15:30:31 +0200
commit751c597ac672a25e010bbcf85bbc0c3e99438f38 (patch)
tree1493ca66c7e27da41346099eaeff4dc46572a3ba /integration
parent940d95124995063779200c6d292e2d13b49f6f60 (diff)
Support IntelliJ 2023
Diffstat (limited to 'integration')
-rw-r--r--integration/intellij/README.md9
-rw-r--r--integration/intellij/build.gradle73
-rw-r--r--integration/intellij/build.gradle.kts71
-rw-r--r--integration/intellij/pom.xml2
-rw-r--r--integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/FunctionDefinitionFinder.java2
-rw-r--r--integration/intellij/src/main/java/ai/vespa/intellij/schema/model/Schema.java2
6 files changed, 78 insertions, 81 deletions
diff --git a/integration/intellij/README.md b/integration/intellij/README.md
index d293b320028..7a872d84f42 100644
--- a/integration/intellij/README.md
+++ b/integration/intellij/README.md
@@ -13,17 +13,16 @@ Download it from JetBrains Marketplace.
Build (see below) and load it in IntelliJ by choosing
Preferences -> Plugins -> Press the gear icon -> Install Plugin from Disk.
+## Prerequisites
+
+ brew install gradle
+
## Building the plugin
gradle
This produces an installable plugin .zip in the directory build/distributions
-*Prerequisite*: gradle 7.
-
-Why gradle? Because it's what JetBrains supports for building plugins.
-However, gradle is configured with a maven directory layout.
-
## Optional IntelliJ plugins for working with plugin development
1. Plugin DevKit
diff --git a/integration/intellij/build.gradle b/integration/intellij/build.gradle
deleted file mode 100644
index 8f8c71ad5c7..00000000000
--- a/integration/intellij/build.gradle
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-plugins {
- id 'org.jetbrains.intellij' version '1.1.4'
- id 'java'
-
- id "org.jetbrains.grammarkit" version '2021.1.3'
-
- id 'maven-publish' // to deploy the plugin into a Maven repo
-}
-
-defaultTasks 'buildPlugin'
-
-apply plugin: 'org.jetbrains.grammarkit'
-
-import org.jetbrains.grammarkit.tasks.GenerateLexer
-import org.jetbrains.grammarkit.tasks.GenerateParser
-
-task generateSdLexer(type: GenerateLexer) {
- source 'src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex'
- targetDir 'target/generated-sources/jflex/ai/vespa/intellij/schema/lexer/'
- targetClass 'SdLexer'
- purgeOldFiles true
-}
-
-task generateSdParser(type: GenerateParser) {
- source 'src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf'
- targetRoot 'target/generated-sources/bnf/'
- pathToParser 'ai/vespa/intellij/schema/parser/SdParser.java'
- pathToPsiRoot 'ai/vespa/intellij/schema/parser/psi/'
- purgeOldFiles true
-}
-
-compileJava {
- dependsOn generateSdLexer
- dependsOn generateSdParser
-}
-
-group 'ai.vespa'
-version '1.3.0' // Also update pom.xml version if this is changed
-
-sourceCompatibility = 11
-
-// This "noinspection" comment below is here to fix a warning
-// noinspection GroovyAssignabilityCheck
-repositories {
- mavenCentral()
-}
-
-sourceSets.main.java.srcDirs = ['src/main/java', 'target/generated-sources/bnf', 'target/generated-sources/jflex']
-
-// See https://github.com/JetBrains/gradle-intellij-plugin/
-intellij {
- version = '2021.2'
- plugins = ['com.intellij.java']
-}
-
-buildSearchableOptions {
- enabled = false
-}
-
-patchPluginXml {
- version = project.version
- sinceBuild = '203'
- untilBuild = '222.*'
- // in changeNotes you can add a description of the changes in this version (would appear in the plugin page in preferences\plugins)
- changeNotes = """
- Support for IntelliJ 2022
- """
-}
-
-test {
- useJUnitPlatform()
-} \ No newline at end of file
diff --git a/integration/intellij/build.gradle.kts b/integration/intellij/build.gradle.kts
new file mode 100644
index 00000000000..a3ec76e2f1e
--- /dev/null
+++ b/integration/intellij/build.gradle.kts
@@ -0,0 +1,71 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+import org.jetbrains.grammarkit.tasks.GenerateLexerTask
+import org.jetbrains.grammarkit.tasks.GenerateParserTask
+
+plugins {
+ id("java-library")
+ id("org.jetbrains.intellij") version "1.13.3"
+ id("org.jetbrains.grammarkit") version "2022.3.1"
+ id("maven-publish") // to deploy the plugin into a Maven repo
+}
+
+group="ai.vespa"
+version="1.4.0" // Also update pom.xml version AND the version below if this is changed
+
+defaultTasks("buildPlugin")
+
+apply(plugin="org.jetbrains.grammarkit")
+
+task<GenerateLexerTask>("generateSdLexer") {
+ sourceFile.set(file("src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex"))
+ targetDir.set("target/generated-sources/jflex/ai/vespa/intellij/schema/lexer/")
+ targetClass.set("SdLexer")
+ purgeOldFiles.set(true)
+}
+
+task<GenerateParserTask>("generateSdParser") {
+ sourceFile.set(file("src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf"))
+ targetRoot.set("target/generated-sources/bnf/")
+ pathToParser.set("ai/vespa/intellij/schema/parser/SdParser.java")
+ pathToPsiRoot.set("ai/vespa/intellij/schema/parser/psi/")
+ purgeOldFiles.set(true)
+}
+
+repositories {
+ mavenCentral()
+}
+
+sourceSets {
+ main {
+ java.srcDirs("src/main/java", "target/generated-sources/bnf", "target/generated-sources/jflex")
+ }
+}
+
+// See https://github.com/JetBrains/gradle-intellij-plugin/
+intellij {
+ version.set("2023.1")
+}
+
+tasks {
+
+ compileJava {
+ dependsOn("generateSdLexer", "generateSdParser")
+ sourceCompatibility = "17"
+ targetCompatibility = "17"
+ }
+
+ patchPluginXml {
+ version.set("1.4.0") // TODO: Use one version property
+ sinceBuild.set("231")
+ // Appears on the plugin page in preferences/plugins
+ changeNotes.set("""
+ Support for IntelliJ 2023
+ """)
+ }
+
+ test {
+ useJUnitPlatform()
+ }
+
+}
+
diff --git a/integration/intellij/pom.xml b/integration/intellij/pom.xml
index 841c2ad7ee1..f1da8f55852 100644
--- a/integration/intellij/pom.xml
+++ b/integration/intellij/pom.xml
@@ -9,7 +9,7 @@
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>vespa-intellij</artifactId> <!-- Not used - plugin is build by gradle -->
- <version>1.3.0</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle -->
+ <version>1.4.0</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle -->
<description>
Maven wrapper for the gradle build of this IntelliJ plugin.
</description>
diff --git a/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/FunctionDefinitionFinder.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/FunctionDefinitionFinder.java
index 89e0165d55e..7d8aafc8f8b 100644
--- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/FunctionDefinitionFinder.java
+++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/FunctionDefinitionFinder.java
@@ -51,7 +51,7 @@ public class FunctionDefinitionFinder extends UsageFinder {
private boolean findDefinitionIn(RankProfile profile) {
for (var entry : profile.definedFunctions().entrySet()) {
// TODO: Resolve the right function in the list by parameter count
- if (entry.key().equals(functionNameToFind) && entry.getValue().size() > 0)
+ if (entry.getKey().equals(functionNameToFind) && entry.getValue().size() > 0)
processor().process(new UsageInfo(entry.getValue().get(0).definition()));
}
return true;
diff --git a/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/Schema.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/Schema.java
index 5479949d25a..88cbdd3e07a 100644
--- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/Schema.java
+++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/Schema.java
@@ -92,7 +92,7 @@ public class Schema {
Map<String, List<Function>> functions = new HashMap<>();
for (var profile : rankProfiles().values()) {
for (var entry : profile.definedFunctions().entrySet())
- functions.computeIfAbsent(entry.key(), k -> new ArrayList<>()).addAll(entry.getValue());
+ functions.computeIfAbsent(entry.getKey(), k -> new ArrayList<>()).addAll(entry.getValue());
}
return functions;
}