forked from JetBrains/intellij-arend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
156 lines (133 loc) · 4.57 KB
/
build.gradle.kts
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
import org.jetbrains.grammarkit.tasks.GenerateParserTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
import org.jetbrains.intellij.tasks.RunIdeBase
val projectArend = gradle.includedBuild("Arend")
group = "org.arend.lang"
version = "1.9.0.4"
plugins {
idea
kotlin("jvm") version "1.9.21"
id("org.jetbrains.intellij") version "1.16.1"
id("org.jetbrains.grammarkit") version "2022.3.2"
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.arend:base")
implementation(kotlin("reflect"))
implementation(kotlin("stdlib-jdk8"))
implementation("org.scilab.forge:jlatexmath:1.0.7")
implementation("guru.nidi:graphviz-java:0.18.1")
}
java {
// toolchain.languageVersion.set(JavaLanguageVersion.of(17))
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks["jar"].dependsOn(
projectArend.task(":api:jar"),
projectArend.task(":proto:jar"),
projectArend.task(":base:jar")
)
val generated = arrayOf("src/main/doc-lexer", "src/main/lexer", "src/main/parser")
sourceSets {
main {
java.srcDirs(*generated)
}
}
idea {
module {
generatedSourceDirs.addAll(generated.map(::file))
outputDir = file("$buildDir/classes/main")
testOutputDir = file("$buildDir/classes/test")
}
}
tasks {
val test by getting(Test::class) {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
include("**/*Test.class")
}
}
intellij {
version.set("2023.3")
pluginName.set("Arend")
updateSinceUntilBuild.set(true)
instrumentCode.set(true)
plugins.set(listOf("org.jetbrains.plugins.yaml", "com.intellij.java", "IdeaVIM:2.7.5"))
}
tasks.named<JavaExec>("runIde") {
jvmArgs = listOf("-Xmx2g")
}
tasks.withType<PatchPluginXmlTask>().configureEach {
version.set(project.version.toString())
pluginId.set(project.group.toString())
changeNotes.set(file("src/main/html/change-notes.html").readText())
pluginDescription.set(file("src/main/html/description.html").readText())
}
val generateArendLexer = tasks.register<GenerateLexerTask>("genArendLexer") {
description = "Generates lexer"
group = "build setup"
sourceFile.set(file("src/main/grammars/ArendLexer.flex"))
targetDir.set("src/main/lexer/org/arend/lexer")
targetClass.set("ArendLexer")
purgeOldFiles.set(true)
}
val generateArendParser = tasks.register<GenerateParserTask>("genArendParser") {
description = "Generates parser"
group = "build setup"
sourceFile.set(file("src/main/grammars/ArendParser.bnf"))
targetRoot.set("src/main/parser")
pathToParser.set("/org/arend/parser/ArendParser.java")
pathToPsiRoot.set("/org/arend/psi")
purgeOldFiles.set(true)
}
val generateArendDocLexer = tasks.register<GenerateLexerTask>("genArendDocLexer") {
description = "Generates doc lexer"
group = "build setup"
sourceFile.set(file("src/main/grammars/ArendDocLexer.flex"))
targetDir.set("src/main/doc-lexer/org/arend/lexer")
targetClass.set("ArendDocLexer")
purgeOldFiles.set(true)
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
languageVersion = "1.9"
apiVersion = "1.9"
freeCompilerArgs = listOf("-Xjvm-default=all")
}
dependsOn(generateArendLexer, generateArendParser, generateArendDocLexer)
}
tasks.withType<Test>().configureEach {
maxHeapSize = "2048m"
testLogging {
if (prop("showTestStatus") == "true") {
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
exceptionFormat = TestExceptionFormat.FULL
}
}
tasks.register<Copy>("prelude") {
val dir = projectArend.projectDir
from(dir.resolve("lib/Prelude.ard"))
into("src/main/resources/lib")
dependsOn(projectArend.task(":cli:buildPrelude"))
}
tasks.withType<Wrapper> {
gradleVersion = "8.5"
}
tasks.register<RunIdeBase>("generateArendLibHTML") {
systemProperty("java.awt.headless", true)
args = listOf("generateArendLibHtml") +
(project.findProperty("pathToArendLib") as String? ?: "") +
(project.findProperty("pathToArendLibInArendSite") as String? ?: "") +
(project.findProperty("versionArendLib") as String? ?: "")
}
// Utils
fun prop(name: String): Any? = extra.properties[name]