-
Notifications
You must be signed in to change notification settings - Fork 39
/
build.gradle
179 lines (147 loc) · 4.39 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
plugins {
id "org.jetbrains.intellij" version "1.7.0"
id "org.jetbrains.changelog" version "1.3.1"
}
String properties(String key) {
return project.findProperty(key).toString()
}
version = properties('pluginVersion')
task validateDic(type: Exec) {
commandLine './tools/validate-dic'
}
task runJFlex(type: Exec) {
commandLine './tools/run-jflex'
}
task cleanJFlex(type: Exec) {
commandLine './tools/run-jflex', 'clean'
}
ext {
javaVersion = properties('javaVersion')
scalaVersion = properties('scalaVersion')
scalaBinaryVersion = scalaVersion.split('\\.').take(2).join('.')
}
allprojects {
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'org.jetbrains.intellij'
intellij {
pluginName = properties('pluginName')
version = properties('platformVersion')
type = properties('platformType')
plugins = ['java', 'yaml']
}
repositories {
mavenCentral()
}
configurations {
provided
compile.extendsFrom provided
}
dependencies {
// Scala support
compileOnly "org.scala-lang:scala-compiler:${scalaVersion}"
compile "org.scala-lang:scala-reflect:${scalaVersion}"
compile "org.scala-lang:scala-library:${scalaVersion}"
compile "io.estatico:newtype_${scalaBinaryVersion}:0.1.0"
compile "org.scalaz:scalaz-core_${scalaBinaryVersion}:7.2.17"
compile "org.yaml:snakeyaml:1.16"
// Compile-time-only deps.
compileOnly "com.google.code.findbugs:findbugs:3.0.1"
compileOnly "com.google.guava:guava:21.0"
}
// NOTE: We have Scala and Java sources that depend on each other, and the java.srcDirs
// will try to be compiled first, so instead we're just setting the scala.srcDirs.
sourceSets {
main {
scala.srcDirs 'src', 'gen'
resources.srcDirs 'resources'
}
test {
scala.srcDirs 'tests'
resources.srcDirs 'tests'
}
}
it.tasks.withType(ScalaCompile) {
scalaCompileOptions.setAdditionalParameters([
'-deprecation',
'-feature',
'-language:existentials',
'-language:experimental.macros',
'-language:higherKinds',
'-unchecked',
'-Xfatal-warnings',
'-Xlint',
'-Xlint:-unused,_',
'-Yno-adapted-args',
'-Ywarn-dead-code',
'-Ywarn-numeric-widen',
'-Ywarn-unused:imports',
'-Ywarn-unused:locals',
'-Ywarn-unused:patvars',
'-Ywarn-unused:patvars',
'-Ywarn-unused:privates',
'-Ywarn-value-discard',
])
}
}
assemble.dependsOn(validateDic, runJFlex)
project(':jps-plugin') {
dependencies {
compile project(':jps-shared')
}
}
dependencies {
compile project(':macros')
compile project(':jps-shared')
compile project(':jps-plugin')
}
// These are libraries, not plugins, so we disable building them as such.
[':macros', ':jps-shared', ':jps-plugin'].each {
project(it) {
buildPlugin.enabled = false
verifyPlugin.enabled = false
}
}
static def getGitRev() {
def proc = "git rev-parse --short HEAD".execute()
proc.waitFor()
return proc.text.trim()
}
static def isGitDirty() {
return "git diff-index --quiet HEAD".execute().waitFor() != 0
}
def getPluginVersion() {
if (version.endsWith('SNAPSHOT')) {
if (isGitDirty()) {
return "$version-${getGitRev()}-dirty"
} else {
return "$version-${getGitRev()}"
}
} else {
return version
}
}
clean.dependsOn cleanJFlex
compileJava.dependsOn runJFlex
// Fixes "unmappable character for encoding ASCII" when compiling files
// containing unicode characters in strings via IntelliJ gradle tasks.
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
compileScala.options.encoding = "UTF-8"
compileTestScala.options.encoding = "UTF-8"
patchPluginXml {
version = getPluginVersion()
}
// Allow re-running tests without forcing a recompile.
test.outputs.upToDateWhen { false }
buildPlugin {
archiveFileName = "haskforce-${getPluginVersion()}.zip"
}
test {
if ("1" == System.getenv("OVERWRITE_FIXTURES")) {
systemProperties.put("idea.tests.overwrite.data", "true")
}
}
changelog {
version = properties('pluginVersion')
}