summaryrefslogtreecommitdiffstats
path: root/integration/intellij/build.gradle.kts
blob: 6af7a48c0c1c8ba0c21c4479fea7dd15e30da219 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright Vespa.ai. 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.17.2"
  id("org.jetbrains.grammarkit") version "2022.3.2.2"
  id("maven-publish") // to deploy the plugin into a Maven repo
}

group="ai.vespa"
version="1.6.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.3")
}

tasks {

  compileJava {
    dependsOn("generateSdLexer", "generateSdParser")
    sourceCompatibility = "17"
    targetCompatibility = "17"
  }

  patchPluginXml {
    version.set("1.6.0") // Keep in sync with pom.xml TODO: Use one version property
    // Appears on the plugin page in preferences/plugins
    changeNotes.set("""
      Updated Vespa icon
      Support for IntelliJ 2023.3
      Compatibility with all JetBrains IDEs
    """)
  }

  test {
    useJUnitPlatform()
  }

}