forked from shvetsgroup/squirrel-lang-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
123 lines (102 loc) · 3.11 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
116
117
118
119
120
121
122
123
plugins {
id "org.jetbrains.intellij" version "0.4.4"
id 'org.jetbrains.grammarkit' version '2018.3'
}
repositories {
mavenCentral()
}
version = System.getenv().getOrDefault('BUILD_NUMBER', '1.2.1')
apply plugin: 'org.jetbrains.grammarkit'
import org.jetbrains.grammarkit.tasks.GenerateParser
import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.intellij.tasks.RunIdeTask
grammarKit {
// version of IntelliJ patched JFlex
jflexRelease = '1.7.0-2'
// tag or short commit hash of Grammar-Kit to use
grammarKitRelease = '2017.1.7'
}
//noinspection GroovyAssignabilityCheck
task generateSquirrelParser(type: GenerateParser) {
source = 'src/com/sqide/Squirrel.bnf'
targetRoot = 'gen'
pathToParser = "/com/sqide/SquirrelParser.java"
pathToPsiRoot = "/com/sqide/psi"
purgeOldFiles = true
}
//noinspection GroovyAssignabilityCheck
task generateSquirrelLexer(type: GenerateLexer) {
source = "src/com/sqide/lexer/SquirrelLexer.flex"
skeleton = "tools/idea-flex.skeleton"
targetDir = "gen/com/sqide/lexer/"
targetClass = "_SquirrelLexer"
purgeOldFiles = true
}
//noinspection GroovyAssignabilityCheck
task generateSquirrelDocLexer(type: GenerateLexer) {
source = "src/com/sqide/lexer/SquirrelDocLexer.flex"
skeleton = "tools/idea-flex.skeleton"
targetDir = "gen/com/sqide/lexer/"
targetClass = "_SquirrelDocLexer"
purgeOldFiles = true
}
//noinspection GroovyAssignabilityCheck
task generateSquirrelParser2ndPass(type: GenerateParser) {
doFirst {
classpath sourceSets.main.runtimeClasspath
}
outputs.upToDateWhen { false }
source = 'src/com/sqide/Squirrel.bnf'
targetRoot = 'gen'
pathToParser = "/com/sqide/SquirrelParser.java"
pathToPsiRoot = "/com/sqide/psi"
purgeOldFiles = true
}
sourceSets {
main {
java.srcDirs 'src', 'gen'
resources.srcDirs 'resources', 'pluginResources', 'src'
}
test {
java.srcDir 'tests'
}
}
apply plugin: 'java'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
//noinspection GroovyAssignabilityCheck
task generateCode {
// todo separate lines?
dependsOn generateSquirrelDocLexer, generateSquirrelLexer, generateSquirrelParser
}
//noinspection GroovyAssignabilityCheck
task compileJavaAgain(type: JavaCompile) {
outputs.upToDateWhen { false }
classpath = sourceSets.main.compileClasspath
source = sourceSets.main.allSource.srcDirs
destinationDir = file('build/classes/java/main')
}
compileJava {
dependsOn generateCode
finalizedBy generateSquirrelParser2ndPass, compileJavaAgain
}
apply plugin: 'org.jetbrains.intellij'
intellij {
version 'LATEST-EAP-SNAPSHOT' // for a full list of releases see https://www.jetbrains.com/intellij-repository/releases
pluginName 'Squirrel-KiWiPower'
patchPluginXml {
sinceBuild '131.0'
}
}
apply plugin: 'idea'
idea {
module {
excludeDirs += [file("out"), file("gen")]
generatedSourceDirs.add(file('src/gen'))
}
}
dependencies {
testCompile("org.mockito:mockito-core:2.1.0")
testCompile("org.assertj:assertj-core:3.11.1")
}