-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sbt
128 lines (116 loc) · 3.57 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
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import ReleaseTransformations._
scalaVersion in ThisBuild := "2.12.10"
crossScalaVersions in ThisBuild := Seq("2.11.12", scalaVersion.value, "2.13.0")
organization in ThisBuild := "com.github.vertical-blank"
onChangedBuildSource in Global := ReloadOnSourceChanges
lazy val root = project
.in(file("."))
.settings(moduleName := "root")
.settings(publishingSettings)
.settings(noPublishSettings)
.aggregate(scala_sql_formatterJVM, scala_sql_formatterJS)
.dependsOn(scala_sql_formatterJVM, scala_sql_formatterJS)
lazy val scala_sql_formatter = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full)
.in(file("."))
.settings(moduleName := "scala-sql-formatter", sharedSettings, publishingSettings)
.jvmSettings(
libraryDependencies += "com.github.vertical-blank" % "sql-formatter" % "1.0.1"
)
.jsSettings(
jsDependencies += "org.webjars.npm" % "sql-formatter" % "2.3.3" / "2.3.3/dist/sql-formatter.js" commonJSName "sqlFormatter",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
)
lazy val scala_sql_formatterJVM = scala_sql_formatter.jvm
lazy val scala_sql_formatterJS = scala_sql_formatter.js
lazy val commonScalacOptions = Def.setting {
Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:_",
"-unchecked",
"-Xlint",
"-Xlint:-nullary-unit",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard"
) ++ {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) if v >= 13 =>
Seq(
"-Ymacro-annotations"
)
case _ =>
Seq(
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ypartial-unification",
"-Xfuture"
)
}
}
}
lazy val sharedSettings = Seq(
scalacOptions ++= commonScalacOptions.value,
(scalacOptions in Test) ~= (_.filterNot(_ == "-Xfatal-warnings")),
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.2.0" % Test
)
)
lazy val publishingSettings = Seq(
pgpSecretRing := file("local.secring.gpg"),
pgpPublicRing := file("local.pubring.gpg"),
name := "scala-sql-formatter",
description := "SQL Formatter for Scala",
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ =>
false
},
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
homepage := Some(url("https://github.com/vertical-blank/scala-sql-formatter")),
scmInfo := Some(
ScmInfo(
url("https://github.com/vertical-blank/scala-sql-formatter"),
"scm:git@github.com:vertical-blank/scala-sql-formatter.git"
)
),
developers := List(
Developer(
id = "vertical-blank",
name = "Yohei Yamana",
email = "fixeight@gmail.com",
url = url("https://github.com/vertical-blank")
)
)
) ++ sharedReleaseProcess
lazy val sharedReleaseProcess = Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
)
)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)