-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
57 lines (48 loc) · 2.24 KB
/
build.sbt
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
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import sbtsonar.SonarPlugin.autoImport.sonarProperties
ThisBuild / version := getVersion(0, 2)
ThisBuild / scalaVersion := "2.12.20"
val scalaCommonVersion = "2.1.102"
lazy val commonTest = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
.settings(
Common.settings ++ Common.publish ++ Seq(
name := "scala-common-test",
organization := "org.mule.common",
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.2.0",
"org.mule.common" %%% "scala-common" % scalaCommonVersion
),
resolvers ++= List(Common.releases, Common.snapshots, Resolver.mavenLocal),
credentials ++= Common.credentials()
)
)
.jvmSettings(libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided")
.jsSettings(
scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.CommonJSModule)
}
)
.disablePlugins(SonarPlugin, ScoverageSbtPlugin)
lazy val commonTestJVM = commonTest.jvm.in(file("./jvm"))
lazy val commonTestJS = commonTest.js.in(file("./js")).disablePlugins(SonarPlugin, ScoverageSbtPlugin)
def getVersion(major: Int, minor: Int): String = {
lazy val build = sys.env.getOrElse("BUILD_NUMBER", "0")
lazy val branch = sys.env.get("BRANCH_NAME")
if (branch.contains("master")) s"$major.$minor.$build" else s"$major.${minor + 1}.0-SNAPSHOT"
}
lazy val sonarUrl = sys.env.getOrElse("SONAR_SERVER_URL", "Not found url.")
lazy val sonarToken = sys.env.getOrElse("SONAR_SERVER_TOKEN", "Not found token.")
lazy val branch = sys.env.getOrElse("BRANCH_NAME", "master")
sonarProperties := Map(
"sonar.login" -> sonarToken,
"sonar.projectKey" -> "mulesoft.scala-common-test",
"sonar.projectName" -> "scala-common-test",
"sonar.projectVersion" -> version.value,
"sonar.sourceEncoding" -> "UTF-8",
"sonar.github.repository" -> "aml-org/scala-common-test",
"sonar.branch.name" -> branch,
"sonar.sources" -> "shared/src/main/scala",
"sonar.tests" -> "shared/src/test/scala",
"sonar.userHome" -> "${buildDir}/.sonar"
)