forked from openlawteam/openlaw-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
216 lines (188 loc) · 9.82 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
import ReleaseTransformations._
import sbt.Keys.name
import scala.language.postfixOps
import sbt.{file, _}
lazy val username = "openlaw"
lazy val repo = "openlaw-core"
licenses += ("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0"))
lazy val scalaV = "2.12.8"
lazy val scalaJavaTimeV = "2.0.0-RC3"
lazy val catsV = "1.6.1"
lazy val parboiledV = "2.1.7"
lazy val circeV = "0.11.1"
lazy val playJsonV = "2.7.4"
lazy val scalaTagsV = "0.7.0"
lazy val sLoggingV = "0.6.1"
lazy val enumeratumV = "1.5.13"
lazy val scalaCheckV = "1.14.0"
lazy val scalaTestV = "3.2.0-SNAP10"
lazy val repositories = Seq(
Resolver.jcenterRepo,
"central" at "http://central.maven.org/maven2/",
"scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
"maven central" at "https://mvnrepository.com/repos/central",
Resolver.mavenLocal
)
lazy val commonSettings = Seq(
organization := "org.openlaw",
name := "openlaw-core",
scalaVersion := scalaV,
wartremoverErrors ++= rules,
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-language:implicitConversions"),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
)
lazy val publishSettings = Seq(
publishArtifact in (Test, packageBin) := true,
homepage := Some(url(s"https://github.com/$username/$repo")),
licenses += ("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0")),
bintrayReleaseOnPublish in ThisBuild := true,
bintrayOrganization := Some("openlawos"),
bintrayRepository := "openlaw-core",
bintrayPackageLabels := Seq("openlaw-core"),
scmInfo := Some(ScmInfo(url(s"https://github.com/$username/$repo"), s"[email protected]:$username/$repo.git")),
releaseCrossBuild := true,
developers := List(
Developer(
id = "adridadou",
name = "David Roon",
email = "[email protected]",
url = new URL(s"http://github.com/adridadou")
),
Developer(
id = "outkaj",
name = "Jacqueline Outka",
email = "[email protected]",
url = new URL(s"http://github.com/outkaj")
),
Developer(
id = "openlawbot",
name = "Pizza Dog Bot",
email = "[email protected]",
url = new URL(s"http://github.com/openlawbot")
)
),
publishTo in ThisBuild := Some("Bintray" at "https://api.bintray.com/maven/openlawos/openlaw-core/openlaw-core/;publish=1"),
)
lazy val releaseSettings = releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies, // : ReleaseStep
//inquireVersions, // : ReleaseStep
//setReleaseVersion, // : ReleaseStep
//commitReleaseVersion, // : ReleaseStep, performs the initial git checks
//tagRelease, // : ReleaseStep
//releaseStepCommandAndRemaining("publish"),
publishArtifacts, // : ReleaseStep,
//setNextVersion, // : ReleaseStep
//commitNextVersion, // : ReleaseStep
//pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured
)
val rules = Seq(Wart.ArrayEquals, Wart.OptionPartial, Wart.EitherProjectionPartial, Wart.Enumeration, Wart.ExplicitImplicitTypes, Wart.FinalVal, Wart.JavaConversions, Wart.JavaSerializable, Wart.LeakingSealed)
/*
*** Library Dependencies. ***
Note that we are actively trying to reduce the scope of our dependencies.
If you are considering adding a new dependency to the application, please
take the following steps:
A.) Evaluate the new dependency thoroughly:
1) Does the dependency solve the use case in a way that it justifies
using it versus writing the code ourselves? What issues does it solve
for us?
2) Is it actively maintained? Are issues/PRs responded to in a timely
fashion?
3) Have you reviewed the dependencies' source code, checking that it
handles things in a reasonable way? (Does it have appropriate error
handling? Do you feel like we can understand and modify the code if we
need to fork it? Would you allow this code to be merged into our code
base if you saw it in a PR?).
4) How is the dependency licensed? Is it compatible with our OSS
requirements?
5) What alternative packages or approaches did you consider?
B.) Add the dependency below. You must now add a comment inline with the
dependency explaining what the dependency is used for (for one example,
so we know if we no longer need it in future!) Try to maintain
rough alphabetical order overall (but grouping related deps is also
helpful).
C.) Include a detailed description in your PR of your findings for the
above. You MUST explicitly answer all of the questions above!
D.) Make sure you get code review sign-off from the appropriate parties.
We maintain a list of dependency reviewers at `.github/CODEOWNERS`
(their name, not ours), which should automatically add them to the PR
when this file is modified.
*/
lazy val openlawCore = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure) // the project does not have separate sources for JVM and JS
.in(file("shared"))
.jvmSettings(
libraryDependencies ++= Seq(
//circe is used to serialize / deserialize json
"io.circe" %% "circe-core" % circeV,
"io.circe" %% "circe-generic" % circeV,
"io.circe" %% "circe-parser" % circeV,
"io.circe" %% "circe-java8" % circeV,
//parser / interpreter library. Used for our markup language
"org.parboiled" %% "parboiled" % parboiledV,
//cats is used for FP constructs
"org.typelevel" %% "cats-core" % catsV,
"org.typelevel" %% "cats-free" % catsV,
// scala.js compatible library to use time types
"io.github.cquiroz" %% "scala-java-time" % scalaJavaTimeV,
// logging library that is compatible with scala.js
"biz.enef" %% "slogging-slf4j" % sLoggingV,
// enumeratum provides type-safe enumerations with improvements over stdlib enumerations
"com.beachape" %% "enumeratum" % enumeratumV,
// scalatags is used for composition of XHTML documents in the document printers
"com.lihaoyi" %% "scalatags" % scalaTagsV,
//Test
"org.scalacheck" %% "scalacheck" % scalaCheckV % Test,
"org.scalatest" %% "scalatest" % scalaTestV % Test,
//Play json is used in tests to make it easier to prepare json in the tests. It shouldn't be used in the library
"com.typesafe.play" %% "play-json" % playJsonV % Test
)
).jsSettings(
libraryDependencies ++= Seq(
//circe is used to serialize / deserialize json
"io.circe" %%% "circe-core" % circeV,
"io.circe" %%% "circe-generic" % circeV,
"io.circe" %%% "circe-parser" % circeV,
"io.circe" %%% "circe-java8" % circeV,
//parser / interpreter library. Used for our markup language
"org.parboiled" %%% "parboiled" % parboiledV,
//cats is used for FP constructs
"org.typelevel" %%% "cats-core" % catsV,
"org.typelevel" %%% "cats-free" % catsV,
// scala.js compatible library to use time types
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeV,
// timezone handling is in a separate library because of its size and not everybody needs it. we do
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.0.0-RC3_2019a",
// logging library that is compatible with scala.js
"biz.enef" %%% "slogging" % sLoggingV,
// enumeratum provides type-safe enumerations with improvements over stdlib enumerations
"com.beachape" %%% "enumeratum" % enumeratumV,
// scalatags is used for composition of XHTML documents in the document printers
"com.lihaoyi" %%% "scalatags" % scalaTagsV,
//Test
"org.scalacheck" %%% "scalacheck" % scalaCheckV % Test,
"org.scalatest" %%% "scalatest" % scalaTestV % Test,
//Play json is used in tests to make it easier to prepare json in the tests. It shouldn't be used in the library
"com.typesafe.play" %%% "play-json" % playJsonV % Test
)
)
.settings(parallelExecution in Test := false)
.settings(commonSettings: _*)
.settings(publishSettings: _*)
.settings(releaseSettings: _*)
.enablePlugins(WartRemover)
lazy val version = git.gitDescribedVersion
// need commands for releasing both Scala & ScalaJS to avoid issue where release-with-defaults only releases Scala lib
// the next-version flag is to silence SBT's interactive release shell prompt - it doesn't actually alter the version
// confirmed via running `sbt version` after release.
addCommandAlias("releaseCore", ";project openlawCore ;release release-version ${version} next-version ${version-SNAPSHOT} with-defaults")
addCommandAlias("releaseCoreJS", ";project openlawCoreJS ;release release-version ${version} next-version ${version-SNAPSHOT} with-defaults")
addCommandAlias("releaseBoth", ";releaseCore ;releaseCoreJS")
lazy val openlawCoreJvm = openlawCore.jvm
lazy val openlawCoreJs = openlawCore.js
git.useGitDescribe := true
val root = (project in file("."))
.dependsOn(openlawCoreJvm, openlawCoreJs)
.aggregate(openlawCoreJvm, openlawCoreJs)
.enablePlugins(GitVersioning)