forked from intellij-rust/intellij-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
188 lines (143 loc) · 5.2 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
///////////////////////////////////////////////////////////////////////////////////////////////////
// Buildscript
///////////////////////////////////////////////////////////////////////////////////////////////////
buildscript {
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id 'org.jetbrains.intellij' version "0.1.10"
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Projects
///////////////////////////////////////////////////////////////////////////////////////////////////
allprojects {
// IntelliJ plugin configuration
apply plugin: 'org.jetbrains.intellij'
intellij {
pluginName 'intellij-rust'
version ideaVersion
downloadSources Boolean.valueOf(downloadIdeaSources)
// FIXME: hack to support both IDEA 15 and IDEA 16.
// See https://github.com/intellij-rust/intellij-rust/issues/243
updateSinceUntilBuild = false
publish {
username publishUsername
password publishPassword
channel publishChannel
}
sandboxDirectory project.rootDir.canonicalPath + "/.sandbox"
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
sourceSets {
main.java.srcDirs += "gen"
}
test {
useJUnit {
excludeCategories 'org.rust.Performance'
}
testLogging {
events "passed", "skipped", "failed"
exceptionFormat = 'full'
}
}
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/jetbrains/markdown' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlinVersion"
compile "org.jetbrains:markdown:0.1.12"
testCompile "junit:junit:4.+"
testCompile 'org.assertj:assertj-core:3.2.0'
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// IDE support
///////////////////////////////////////////////////////////////////////////////////////////////////
apply plugin: 'idea'
idea {
project {
jdkName = javaVersion
languageLevel = javaVersion
}
module {
generatedSourceDirs += file('gen')
excludeDirs += file('.sandbox')
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Tasks
///////////////////////////////////////////////////////////////////////////////////////////////////
def lexerConfig(src, dst, lexerFileName) {
return {
classpath = files('lib/jflex/jflex-1.7.0-SNAPSHOT.jar')
main = "jflex.Main"
args = ["--skel", 'lib/jflex/idea-flex.skeleton',
"-d", dst,
src
]
inputs .file file(src)
outputs .dir file(dst + lexerFileName)
}
}
task generateRustLexer(type: JavaExec) {
configure lexerConfig(
"src/main/kotlin/org/rust/lang/core/lexer/RustLexer.flex",
"gen/org/rust/lang/core/lexer/",
"_RustLexer.java"
)
}
task generateRustDocHighlightingLexer(type: JavaExec) {
configure lexerConfig(
"src/main/kotlin/org/rust/lang/doc/lexer/RustDocHighlightingLexer.flex",
"gen/org/rust/lang/doc/lexer/",
"_RustDocHighlightingLexer.java"
)
}
task generateRustPsiAndParser(type: JavaExec) {
doFirst {
delete file("gen/org/rust/lang/core/psi/")
}
ext.src = "src/main/kotlin/org/rust/lang/core/grammar/rust.bnf"
ext.dstRoot = "gen"
main = "org.intellij.grammar.Main"
args = [ dstRoot, file(src) ]
inputs .file file(src)
outputs .dir fileTree(dir: dstRoot + '/org/rust/lang/core/', include: '**/*.java')
classpath (configurations.compile + files('lib/grammar-kit.jar'))
}
task generate {
dependsOn generateRustLexer, generateRustDocHighlightingLexer, generateRustPsiAndParser
}
compileKotlin.dependsOn generate
compileTestKotlin.dependsOn generate
task performanceTest(type: Test, group: 'Verification', dependsOn: [classes, testClasses]) {
useJUnit {
includeCategories 'org.rust.Performance'
reports.html.destination = "$buildDir/reports/performanceTests"
}
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
exceptionFormat = 'full'
}
outputs.upToDateWhen { false } // always execute task, even if already executed.
}
check.dependsOn performanceTest
///////////////////////////////////////////////////////////////////////////////////////////////////
// Misc
///////////////////////////////////////////////////////////////////////////////////////////////////
version = "$version.$buildNumber" + (publishChannel?.trim() ? "-$publishChannel" : "")