-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.sbt
171 lines (158 loc) · 5.7 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
lazy val Constants = _root_.scalatex.Constants
sharedSettings
noPublish
version in ThisBuild := Constants.version
releasePublishArtifactsAction := PgpKeys.publishSigned.value
releaseVersionBump := sbtrelease.Version.Bump.Minor
releaseTagComment := s"Releasing ${(version in ThisBuild).value}"
releaseCommitMessage := s"Bump version to ${(version in ThisBuild).value}"
sonatypeProfileName := "lihaoyi"
releaseCrossBuild := true
publishMavenStyle := true
//publishTo in ThisBuild := sonatypePublishToBundle.value
publishConfiguration := publishConfiguration.value.withOverwrite(true)
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
//inquireVersions,
runClean,
runTest,
//setReleaseVersion,
//commitReleaseVersion,
tagRelease,
//publishArtifacts,
//setNextVersion,
//commitNextVersion,
//releaseStepCommand("+publishSigned"),
//releaseStepCommand("sonatypeBundleRelease"),
releaseStepCommand("+publishSigned"),
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
)
def supportedScalaVersion = Seq(Constants.scala212, Constants.scala213)
lazy val sharedSettings = Seq(
version := Constants.version,
organization := "com.lihaoyi",
scalaVersion := Constants.scala213,
crossScalaVersions := supportedScalaVersion,
libraryDependencies += "com.lihaoyi" %% "acyclic" % "0.2.0" % "provided",
addCompilerPlugin("com.lihaoyi" %% "acyclic" % "0.2.0"),
autoCompilerPlugins := true,
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
pomExtra :=
<url>https://github.com/lihaoyi/Scalatex</url>
<licenses>
<license>
<name>MIT license</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<developers>
<developer>
<id>lihaoyi</id>
<name>Li Haoyi</name>
<url>https://github.com/lihaoyi</url>
</developer>
</developers>
)
lazy val noPublish = Seq(
publishArtifact := false,
publishLocal := {},
publish := {}
)
lazy val circe =
Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser"
).map(_ % Constants.circe)
lazy val api = project.settings(sharedSettings:_*)
.settings(
name := "scalatex-api",
libraryDependencies ++= Seq(
"com.lihaoyi" %% "utest" % Constants.uTest % "test",
"com.lihaoyi" %% "scalaparse" % "2.2.3",
"com.lihaoyi" %% "scalatags" % Constants.scalaTags,
"org.scala-lang" % "scala-reflect" % scalaVersion.value
),
testFrameworks += new TestFramework("utest.runner.Framework")
)
def isScala12(v: String) =
v match {
case "2.12" => false
case _ => true
}
lazy val scalatexSbtPlugin = project.settings(sharedSettings:_*)
.settings(
name := "scalatex-sbt-plugin",
scalaVersion := Constants.scala212,
skip in Compile := isScala12(scalaBinaryVersion.value),
sources in (Compile, doc) := Nil,
publishArtifact := !isScala12(scalaBinaryVersion.value),
publishArtifact in (Compile, packageDoc) := !isScala12(scalaBinaryVersion.value),
crossSbtVersions := List("1.3.7"),
sbtPlugin := true,
(unmanagedSources in Compile) += baseDirectory.value/".."/"project"/"Constants.scala"
)
lazy val site =
project
.dependsOn(api)
.settings(scalatex.SbtPlugin.projectSettings:_*)
.settings(sharedSettings:_*)
.settings(
libraryDependencies := libraryDependencies.value.filter(!_.toString.contains("scalatex-api")),
name := "scalatex-site",
crossScalaVersions := supportedScalaVersion,
libraryDependencies ++= Seq(
"com.lihaoyi" %% "utest" % Constants.uTest % "test",
"com.lihaoyi" %% "ammonite-ops" % "2.0.4",
"org.webjars.bower" % "highlightjs" % "9.12.0",
"org.webjars.bowergithub.highlightjs" % "highlight.js" % "9.12.0",
"org.webjars" % "font-awesome" % "4.7.0",
"com.lihaoyi" %% "scalatags" % Constants.scalaTags,
"org.webjars" % "pure" % "0.6.2",
"org.scalaj" %% "scalaj-http" % "2.4.2"
) ++ circe,
testFrameworks += new TestFramework("utest.runner.Framework"),
(managedResources in Compile) += {
val file = (resourceManaged in Compile).value/"scalatex"/"scrollspy"/"scrollspy.js"
val js = (fullOptJS in (scrollspy, Compile)).value.data
sbt.IO.copyFile(js, file)
file
}
)
lazy val scrollspy = project
.enablePlugins(ScalaJSPlugin)
.settings(
sharedSettings,
scalaVersion := Constants.scala213,
crossScalaVersions := supportedScalaVersion,
scalacOptions += "-P:scalajs:suppressExportDeprecations", // see https://github.com/scala-js/scala-js/issues/3092
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.8",
"com.lihaoyi" %%% "scalatags" % Constants.scalaTags,
"io.circe" %%% "circe-core" % Constants.circe,
"io.circe" %%% "circe-generic" % Constants.circe,
"io.circe" %%% "circe-parser" % Constants.circe
),
emitSourceMaps := false,
noPublish
)
lazy val readme = scalatex.ScalatexReadme(
projectId = "readme",
wd = file(""),
url = "https://github.com/lihaoyi/scalatex/tree/master",
source = "Readme"
)
.settings(
sharedSettings,
siteSourceDirectory := target.value / "scalatex",
git.remoteRepo := "git@github.com:lihaoyi/scalatex.git",
libraryDependencies := libraryDependencies.value.filter(_.name == "scalatex-site"),
(unmanagedSources in Compile) += baseDirectory.value/".."/"project"/"Constants.scala",
noPublish
)
.dependsOn(
site
)
.enablePlugins(GhpagesPlugin)