forked from intellij-rust/intellij-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
191 lines (156 loc) · 5.18 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
189
190
191
buildscript {
ext.kotlinVersion = '1.0.5'
ext.javaVersion = '1.6'
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id 'org.jetbrains.intellij' version "0.1.10"
}
allprojects {
apply plugin: 'idea'
idea {
module {
generatedSourceDirs += file('src/gen')
}
}
apply plugin: 'org.jetbrains.intellij'
intellij {
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
instrumentCode = false
publish {
username publishUsername
password publishPassword
channel publishChannel
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
sourceSets {
main {
java.srcDirs += 'src/gen'
// Exclude miglayout bundled with the IDE because we need a newer version, which
// is only available since 2016.3
compileClasspath = compileClasspath.filter { it.name != 'miglayout-swing.jar' }
}
}
test {
testLogging {
events 'skipped', 'failed'
exceptionFormat = 'full'
}
beforeSuite { suite ->
if (suite.className != null) {
println()
println(suite.className)
}
}
afterTest { desc, result ->
def c = '.'
if (result.resultType == TestResult.ResultType.FAILURE) {
c = 'X'
} else if (result.resultType == TestResult.ResultType.SKIPPED) {
c = 'S'
}
print(c)
System.out.flush()
}
afterSuite { println() }
}
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/jetbrains/markdown' }
maven { url 'https://jitpack.io' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlinVersion"
compile('com.github.matklad:miglayout:afbdb74067') {
exclude module: 'org-netbeans-api-annotations-common'
}
testCompile 'junit:junit:4.+'
testCompile 'org.assertj:assertj-core:3.2.0'
}
}
project(':') {
version = "0.1.0.$buildNumber" + (publishChannel?.trim() ? "-$publishChannel" : "")
intellij { pluginName 'intellij-rust' }
}
project(':toml') {
version = "0.0.1.$buildNumber" + (publishChannel?.trim() ? "-$publishChannel" : "")
intellij { pluginName 'intellij-toml' }
}
test {
useJUnit {
excludeCategories 'org.rust.Performance'
}
}
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
dependencies {
compile 'org.jetbrains:markdown:0.1.12'
}
lexerTask(project, 'RustLexer', 'org/rust/lang/core/lexer')
lexerTask(project, 'RustDocHighlightingLexer', 'org/rust/lang/doc/lexer')
parserTask(project, 'RustParser', 'org/rust/lang/core/psi')
project(':toml') {
lexerTask(project, 'TomlLexer', 'org/toml/lang/core/lexer')
parserTask(project, 'TomlParser', 'org/toml/lang/core/psi')
}
static def codegenTask(project, task) {
project.compileKotlin.dependsOn task
project.compileTestKotlin.dependsOn task
return task
}
def lexerTask(project, lexerName, pkg) {
return codegenTask(project, tasks.create("generate${lexerName}", JavaExec) {
def src = "$project.projectDir/src/main/grammars/${lexerName}.flex"
def dst = "$project.projectDir/src/gen/$pkg"
main = 'jflex.Main'
classpath = files('lib/jflex/jflex-1.7.0-SNAPSHOT.jar')
args = ['--skel', 'lib/jflex/idea-flex.skeleton',
'-d', dst,
src
]
inputs.file file(src)
outputs.dir file("$dst/_${lexerName}.java")
})
}
def parserTask(project, parserName, pkg) {
return codegenTask(project, tasks.create("generate${parserName}", JavaExec) {
def dstRoot = "$project.projectDir/src/gen"
def src = "$project.projectDir/src/main/grammars/${parserName}.bnf"
def dst = "$dstRoot/$pkg"
doFirst {
delete file(dst)
}
main = 'org.intellij.grammar.Main'
classpath(configurations.compile + files('lib/grammar-kit.jar'))
args = [dstRoot, file(src)]
inputs.file file(src)
outputs.dir fileTree(dir: dst, include: '**/*.java')
})
}