-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
135 lines (118 loc) · 4.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
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
import CommonSettings.autoImport.network
import ReleasePlugin.autoImport._
import sbt.Keys._
import sbt._
import sbt.internal.inc.ReflectUtilities
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
def nodeVersionTag: String = "v1.1.2"
lazy val node = ProjectRef(uri(s"git://github.com/acrylplatform/Acryl.git#$nodeVersionTag"), "node")
lazy val `node-it` = ProjectRef(uri(s"git://github.com/acrylplatform/Acryl.git#$nodeVersionTag"), "node-it")
lazy val dex = project.dependsOn(node % "compile;test->test;runtime->provided")
lazy val `dex-it` = project
.dependsOn(
dex,
`node-it` % "compile;test->test"
)
lazy val `dex-generator` = project.dependsOn(
dex,
`node-it` % "compile->test", // Without this IDEA doesn't find classes
`dex-it` % "compile->test"
)
lazy val it = project
.settings(
description := "Hack for near future to support builds in TeamCity for old and new branches both",
Test / test := Def
.sequential(
root / Compile / packageAll,
`dex-it` / Docker / docker,
`dex-it` / Test / test
)
.value
)
lazy val root = (project in file("."))
.aggregate(
dex,
`dex-it`,
`dex-generator`
)
inScope(Global)(
Seq(
scalaVersion := "2.12.8",
organization := "com.acrylplatform",
organizationName := "Acryl Platform",
organizationHomepage := Some(url("https://acrylplatform.com")),
scmInfo := Some(ScmInfo(url("https://github.com/acrylplatform/dex"), "[email protected]:acrylplatform/dex.git", None)),
licenses := Seq(("MIT", url("https://github.com/acrylplatform/dex/blob/master/LICENSE"))),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-unchecked",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-Ywarn-unused:-implicits",
"-Xlint",
"-Ypartial-unification",
"-opt:l:inline",
"-opt-inline-from:**"
),
crossPaths := false,
scalafmtOnCompile := false,
dependencyOverrides ++= Dependencies.enforcedVersions.value,
cancelable := true,
logBuffered := false,
coverageExcludedPackages := ".*",
parallelExecution := false,
testListeners := Seq.empty, // Fix for doubled test reports
/* http://www.scalatest.org/user_guide/using_the_runner
* o - select the standard output reporter
* I - show reminder of failed and canceled tests without stack traces
* D - show all durations
* O - drop InfoProvided events
* F - show full stack traces
* u - select the JUnit XML reporter with output directory
*/
testOptions += Tests.Argument("-oIDOF", "-u", "target/test-reports"),
testOptions += Tests.Setup(_ => sys.props("sbt-testing") = "true"),
concurrentRestrictions := {
val threadNumber = Option(System.getenv("SBT_THREAD_NUMBER")).fold(1)(_.toInt)
Seq(Tags.limit(Tags.ForkedTestGroup, threadNumber))
},
network := NodeNetwork(sys.props.get("network")),
nodeVersion := (node / version).value,
buildNodeContainer := (`node-it` / Docker / docker).value
))
// ThisBuild options
git.useGitDescribe := true
git.uncommittedSignifier := Some("DIRTY")
// root project settings
enablePlugins(ReleasePlugin)
// https://stackoverflow.com/a/48592704/4050580
def allProjects: List[ProjectReference] = ReflectUtilities.allVals[Project](this).values.toList.map(x => x: ProjectReference) ++ List(
node,
`node-it`
)
Compile / cleanAll := {
val xs = allProjects
streams.value.log.info(s"Cleaning ${xs.mkString(", ")}")
clean.all(ScopeFilter(inProjects(allProjects: _*), inConfigurations(Compile, Test))).value
}
lazy val checkPRRaw = taskKey[Unit]("Build a project and run unit tests")
checkPRRaw := {
// try/finally is a hack to run clean before all tasks
try {
(root / Compile / cleanAll).value
} finally {
(dex / Test / test).value
(`dex-generator` / Test / compile).value
}
}
commands += Command.command("checkPR") { state =>
val updatedState = Project
.extract(state)
.appendWithoutSession(Seq(Global / scalacOptions ++= Seq("-Xfatal-warnings", "-Ywarn-unused:-imports")), state)
Project.extract(updatedState).runTask(root / checkPRRaw, updatedState)
state
}
// IDE settings
ideExcludedDirectories := Seq((root / baseDirectory).value / "_local")