forked from Log4s/log4s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
177 lines (161 loc) · 5.42 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import Dependencies._
import ReleaseTransformations._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
/* TODO: Attempts to do this with the existing `TaskKey` have failed, but that
* would be better than doing it using the string. This approach also won't
* work if you were to dynamically modify the cross-build settings. The key is
* autoimported and named `mimaReportBinaryIssues`. */
lazy val binaryCompatStep = releaseStepCommandAndRemaining("+mimaReportBinaryIssues")
/* This is the standard release process plus a binary compat check after tests */
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
binaryCompatStep,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
pushChanges
)
val prevVersions = settingKey[Set[String]]("The previous versions for the current project")
val prevArtifacts = Def.derive {
mimaPreviousArtifacts := {
/* TODO: I imagine there's a better way to do this */
val artName = {
val suffix = if (isScalaJSProject.value) "_sjs0.6" else ""
artifact.value.name + suffix
}
prevVersions.value.map(organization.value %% artName % _)
}
}
def jsOpts = new Def.SettingList(Seq(
scalacOptions += "-P:scalajs:sjsDefinedByDefault",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
))
lazy val root: Project = (project in file ("."))
.enablePlugins(BasicSettings)
.settings(Publish.settings: _*)
.settings(Release.settings: _*)
.aggregate(coreJVM, coreJS, testingJVM, testingJS)
.settings (
name := "Log4s Root",
publish := {},
publishLocal := {},
publishArtifact := false,
exportJars := false,
skip in Compile := true,
skip in Test := true
)
lazy val jsPrevVersions = Set.empty[String]
lazy val core = (crossProject(JSPlatform, JVMPlatform) in file ("core"))
.enablePlugins(BasicSettings, SiteSettingsPlugin)
.dependsOn(testing % "test")
.settings(Publish.settings: _*)
.settings(Release.settings: _*)
.settings(
name := "Log4s",
prevArtifacts,
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import ProblemFilters.exclude
/* import com.typesafe.tools.mima.core.ProblemFilters._ */
/* These macros are not part of the runtime and are not a binary compatibility concern */
Seq(
exclude[IncompatibleResultTypeProblem]("org.log4s.LoggerMacros.*"),
exclude[IncompatibleMethTypeProblem]("org.log4s.LoggerMacros.getLoggerImpl"),
)
},
libraryDependencies ++= Seq (
slf4j,
logback % "test",
"org.scalacheck" %%% "scalacheck" % scalacheckVersion % "test",
"org.scalatest" %%% "scalatest" % scalatestVersion % "test",
reflect.value % "provided"
),
unmanagedSourceDirectories in Compile ++= {
scalaBinaryVersion.value match {
case "2.10" | "2.11" =>
Seq.empty
case _ =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-2.11")
}
},
unmanagedSourceDirectories in Compile ++= {
scalaBinaryVersion.value match {
case "2.10" | "2.11" | "2.12" =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-oldcoll")
case _ =>
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-newcoll")
}
}
)
.jvmSettings(
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % scalaJSVersion % "provided",
prevVersions := {
/* I'm using the first & last version of each minor release rather than
* including every single patch-level update. */
def `2.11Versions` =
Set("1.0.3", "1.0.5",
"1.1.0", "1.1.5",
"1.2.0", "1.2.1",
"1.3.0")
def `2.12Versions` =
Set("1.3.3", "1.3.6",
"1.4.0",
"1.5.0",
"1.6.0", "1.6.1",
"1.7.0",
"1.8.0", "1.8.1")
def `2.13Versions` =
Set("1.8.2")
scalaBinaryVersion.value match {
case "2.10" | "2.11" => `2.11Versions` ++ `2.12Versions` ++ `2.13Versions`
case "2.12" => `2.12Versions` ++ `2.13Versions`
case "2.13" => `2.13Versions`
case other =>
sLog.value.info(s"No known MIMA artifacts for: $other")
Set.empty
}
}
)
.jsSettings(jsOpts)
.jsSettings(
prevVersions := jsPrevVersions
)
lazy val coreJS = core.js
lazy val coreJVM = core.jvm
lazy val testing = (crossProject(JSPlatform, JVMPlatform) in file ("testing"))
.enablePlugins(BasicSettings, SiteSettingsPlugin)
.settings(Publish.settings: _*)
.settings(Release.settings: _*)
.settings(
name := "Log4s Testing",
description := "Utilities to help with build-time unit tests for logging",
prevArtifacts,
libraryDependencies ++= Seq (
slf4j,
logback
)
)
.jvmSettings(
prevVersions := {
val `2.12Versions` = Set("1.5.0", "1.6.0", "1.6.1", "1.7.0", "1.8.0", "1.8.1")
val `2.13Versions` = Set("1.8.2")
scalaBinaryVersion.value match {
case "2.10" | "2.11" | "2.12" => `2.12Versions` ++ `2.13Versions`
case "2.13" => `2.13Versions`
case other =>
Set.empty
}
}
)
.jsSettings(jsOpts)
.jsSettings(
prevVersions := jsPrevVersions
)
lazy val testingJS = testing.js
lazy val testingJVM = testing.jvm