-
Notifications
You must be signed in to change notification settings - Fork 5
/
settings.gradle
32 lines (26 loc) · 1.02 KB
/
settings.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
rootProject.name = 'sumobot'
determineAndSetScalaVersion()
private void determineAndSetScalaVersion() {
def selectedScalaVersion = resolveScalaVersion()
applyScalaVersion(selectedScalaVersion)
println "Scala version: ${gradle.ext.scalaMajorVersion}.${gradle.ext.scalaMinorVersion}"
}
private String resolveScalaVersion() {
def selectedScalaVersion = ext.has("scalaVersion")
? ext.scalaVersion
: ext.defaultScalaVersion
if (!ext.supportedScalaVersions
.split(",")
.collect{it.trim()}
.contains(selectedScalaVersion)) {
throw new GradleException("Unsupported scala version '$selectedScalaVersion'. " +
"Available versions: '${ext.supportedScalaVersions}'")
}
return selectedScalaVersion
}
private void applyScalaVersion(selectedScalaVersion) {
def m = (selectedScalaVersion =~ /(\d+\.\d+)\.(\d+(-(RC|M)\d+)?)/)
m.matches()
gradle.ext.scalaMajorVersion = m.group(1)
gradle.ext.scalaMinorVersion = m.group(2)
}