-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
72 lines (61 loc) · 2.81 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sbt.Keys.{libraryDependencies, resolvers}
import sbtcrossproject.CrossPlugin.autoImport.crossProject
ThisBuild / version := getVersion(2, 1)
ThisBuild / scalaVersion := "2.12.20"
val scalaCommonVersion = "2.1.102"
val scalaCommonTestVersion = "0.2.15"
val settings = Common.settings ++ Common.publish ++ Seq(
organization := "org.mule.syaml",
name := "syaml",
libraryDependencies ++= Seq(
"org.mule.common" %%% "scala-common-test" % scalaCommonTestVersion % Test
),
resolvers ++= List(Common.releases, Common.snapshots, Resolver.mavenLocal),
credentials ++= Common.credentials()
)
lazy val workspaceDirectory: File =
sys.props.get("sbt.mulesoft") match {
case Some(x) => file(x)
case _ => Path.userHome / "mulesoft"
}
lazy val scalaCommonJVMRef = ProjectRef(workspaceDirectory / "scala-common", "commonJVM")
lazy val scalaCommonJSRef = ProjectRef(workspaceDirectory / "scala-common", "commonJS")
lazy val scalaCommonLibJVM = "org.mule.common" %% "scala-common" % scalaCommonVersion
lazy val scalaCommonLibJS = "org.mule.common" %% "scala-common_sjs1" % scalaCommonVersion
lazy val syaml = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
.settings(settings: _*)
.settings(AutomaticModuleName.settings("org.syaml"))
.jvmSettings(
// JVM-specific settings here
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided"
)
.jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
lazy val syamlJVM = syaml.jvm.in(file("./jvm")).sourceDependency(scalaCommonJVMRef, scalaCommonLibJVM)
lazy val syamlJS = syaml.js
.in(file("./js"))
.sourceDependency(scalaCommonJSRef, scalaCommonLibJS)
.disablePlugins(SonarPlugin, ScoverageSbtPlugin)
def getVersion(major: Int, minor: Int) = {
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.syaml.gec",
"sonar.projectName" -> "syaml",
"sonar.projectVersion" -> version.value,
"sonar.sourceEncoding" -> "UTF-8",
"sonar.github.repository" -> "aml-org/syaml",
"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"
)