-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
55 lines (47 loc) · 2.25 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
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import sbtsonar.SonarPlugin.autoImport.sonarProperties
ThisBuild / version := getVersion(2, 1)
ThisBuild / scalacOptions ++= Seq("-feature")
ThisBuild / scalaVersion := "2.12.20"
lazy val common = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
.settings(
Common.settings ++ Common.publish ++ Seq(
organization := "org.mule.common",
name := "scala-common",
libraryDependencies ++= Seq(
"org.scalactic" %%% "scalactic" % "3.2.0" % Test,
"org.scalatest" %%% "scalatest" % "3.2.0" % Test
),
credentials ++= Common.credentials()
)
)
.jvmSettings(libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided")
.jsSettings(
libraryDependencies += "org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
.settings(AutomaticModuleName.settings("org.mulesoft.common"))
lazy val commonJVM = common.jvm.in(file("./jvm"))
lazy val commonJS = common.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", "develop")
sonarProperties ++= Map(
"sonar.login" -> sonarToken,
"sonar.projectKey" -> "mulesoft.scala-common.gec",
"sonar.projectName" -> "Scala-common",
"sonar.projectVersion" -> version.value,
"sonar.sourceEncoding" -> "UTF-8",
"sonar.github.repository" -> "aml-org/scala-common",
"sonar.branch.name" -> branch,
"sonar.sources" -> "shared/src/main/scala",
"sonar.tests" -> "shared/src/test/scala",
"sonar.userHome" -> "${buildDir}/.sonar",
"sonar.scala.coverage.reportPaths" -> "target/scala-2.12/scoverage-report/scoverage.xml"
)