-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
117 lines (95 loc) · 2.74 KB
/
build.gradle
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
plugins {
id 'org.jetbrains.intellij' version "0.4.13"
id "org.jetbrains.grammarkit" version "2019.3"
}
repositories {
mavenCentral()
}
apply plugin: 'scala'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
if (project.hasProperty('JDK8_HOME')) {
options.bootstrapClasspath = files("$JDK8_HOME/jre/lib/rt.jar")
}
}
tasks.withType(ScalaCompile) {
options.encoding = 'UTF-8'
if (project.hasProperty('JDK8_HOME')) {
options.bootstrapClasspath = files("$JDK8_HOME/jre/lib/rt.jar")
}
}
sourceSets {
main {
scala {
srcDirs = ['src/main/scala', 'src/main/java', 'src/main/gen']
}
java {
srcDirs = []
}
}
}
dependencies {
compile 'org.scala-lang:scala-library:2.12.4'
}
apply plugin: 'org.jetbrains.intellij'
intellij {
plugins = [ 'PsiViewer:193-SNAPSHOT' ]
version ideaVersion
updateSinceUntilBuild = false
}
apply plugin: 'org.jetbrains.grammarkit'
import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.grammarkit.tasks.GenerateParser
task initGenerate(type: GenerateParser) {
source = 'src/main/grammars/GoYacc.bnf'
targetRoot = 'src/main/gen'
pathToParser = '/idea/goyacc/ast/GoYaccParser.java'
pathToPsiRoot = '/idea/goyacc/psi'
}
task initCompile(type: ScalaCompile) {
source = fileTree(dir: 'src/main',
includes: [
'scala/**/psi/GoYaccPsiUtil.scala',
'scala/**/psi/GoYaccRefs.scala',
'java/**/GoYaccLanguage.java',
'java/**/GoYaccFileType.java',
'java/**/psi/GoYaccNamedElement.java',
'gen/**/psi/*.java'],
excludes: ['gen/**/GoYaccType.java'])
classpath = sourceSets.main.compileClasspath
destinationDir = sourceSets.main.scala.outputDir
doLast {
delete "${rootDir}/src/main/gen/idea/goyacc/psi"
}
}
task generateGoYaccParser(type: GenerateParser) {
dependsOn(initCompile)
doFirst {
classpath files(sourceSets.main.runtimeClasspath)
}
source = 'src/main/grammars/GoYacc.bnf'
targetRoot = 'src/main/gen'
pathToParser = '/idea/goyacc/ast/GoYaccParser.java'
pathToPsiRoot = '/idea/goyacc/psi'
}
task generateGoYaccLexer(type: GenerateLexer) {
source = 'src/main/grammars/GoYacc.flex'
targetDir = 'src/main/gen/idea/goyacc/ast'
targetClass = '_GoYaccLexer'
}
initCompile {
dependsOn initGenerate
dependsOn generateGoYaccLexer
}
compileScala {
dependsOn generateGoYaccParser
dependsOn generateGoYaccLexer
}
task cleanGen {
doLast { delete "${rootDir}/src/main/gen" }
}
clean {
dependsOn cleanGen
}