-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.sbt
186 lines (169 loc) · 6.98 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
// Copyright 2018 EPFL DATA Lab (data.epfl.ch)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
val scala211Version = "2.11.12"
val scala212Version = "2.12.10"
val paradiseVersion = "2.1.0"
val squidVersion = "0.4.1-SNAPSHOT"
val squidIsSnapshot: Boolean = squidVersion endsWith "-SNAPSHOT"
val initialConsoleCommands = "import squid.IR, IR.Predef._, IR.Quasicodes._"
lazy val commonSettings = Seq(
version := squidVersion,
scalaVersion := scala212Version, // default Scala version
crossScalaVersions := Seq(scala211Version, scala212Version),
organization := "ch.epfl.data",
autoCompilerPlugins := true,
scalacOptions ++= Seq("-feature", "-language:implicitConversions", "-language:higherKinds", "-language:postfixOps"
, "-deprecation", "-unchecked"
//, "-Ybackend-parallelism", "4" // does not seem to result in noticeable improvements of compile time,
// as measured by repeatedly doing ";reload ;clean ;test:clean ;test:compile" in
// sbt, which is reported to take around "Total time: 48 s"
),
incOptions := incOptions.value.withLogRecompileOnMacro(false), // silences macro-related recompilation messages (cf. https://github.com/sbt/zinc/issues/142)
parallelExecution in Test := false,
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += Resolver.sonatypeRepo("releases"),
addCompilerPlugin("org.scalamacros" % "paradise" % paradiseVersion cross CrossVersion.full),
unmanagedSources in Compile := (unmanagedSources in Compile).value.filterNot(_.getPath.contains("_perso")),
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test",
libraryDependencies += "com.lihaoyi" %% "sourcecode" % "0.1.4",
libraryDependencies += "eu.timepit" %% "singleton-ops" % "0.3.1",
libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.3",
//libraryDependencies += "com.lihaoyi" % "ammonite" % "1.1.2" % "test" cross CrossVersion.full,
//// For the ammonite REPL:
//sourceGenerators in Test += Def.task {
// val file = (sourceManaged in Test).value / "amm.scala"
// IO.write(file, """object amm extends App { ammonite.Main().run() }""")
// Seq(file)
//}.taskValue,
) ++ publishSettings
lazy val main = (project in file(".")).
dependsOn(core).
dependsOn(core % "test->test").
settings(commonSettings: _*).
settings(
name := "squid",
initialCommands in console := initialConsoleCommands,
)
lazy val core = (project in file("core")).
dependsOn(core_macros).
settings(commonSettings: _*).
settings(
name := "squid-core",
//libraryDependencies += "ch.epfl.lamp" % "scala-yinyang_2.11" % "0.2.0-SNAPSHOT",
libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _).value,
libraryDependencies += scalaVersion("org.scala-lang" % "scala-library" % _).value,
libraryDependencies += scalaVersion("org.scala-lang" % "scala-compiler" % _).value,
publishArtifact in packageDoc := false // otherwise compiler crashes while trying to gen doc (java.util.NoSuchElementException: next on empty iterator)
)
lazy val core_macros = (project in file("core_macros")).
settings(commonSettings: _*).
settings(
name := "squid-core-macros",
libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _).value
)
lazy val example = (project in file("example")).
settings(commonSettings: _*).
settings(
name := "squid-example",
parallelExecution in Test := false,
initialCommands in console := initialConsoleCommands,
).
dependsOn(main).
dependsOn(main % "test->test")
val developers =
<developers>
<developer>
<id>LPTK</id>
<name>Lionel Parreaux</name>
<url>http://people.epfl.ch/lionel.parreaux</url>
</developer>
</developers>
lazy val publishSettings = Seq(
publishMavenStyle := true,
isSnapshot := squidIsSnapshot,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishArtifact in (Compile, packageSrc) := false,
pomIncludeRepository := { _ => false },
pomExtra := developers,
publishArtifact in Test := false,
publishArtifact in packageDoc := !squidIsSnapshot // publishing doc is super slow -- don't do it for snapshots to ease development
)
import microsites.ExtraMdFileConfig
val makeMicrositeNoTut: TaskKey[Unit] = taskKey[Unit]("Main Task to build a Microsite")
val makeMicrositeQuick: TaskKey[Unit] = taskKey[Unit]("Main Task to build a Microsite")
lazy val micrositeSettings = Seq(
micrositeName := "Squid",
micrositeDescription := "Squid ― type-safe metaprogramming for Scala",
micrositeAuthor := "Lionel Parreaux (@lptk)",
micrositeBaseUrl := "/squid",
micrositeDocumentationUrl := "/squid/reference",
micrositeGithubOwner := "epfldata",
micrositeGithubRepo := "squid",
micrositeGitterChannel := true,
micrositeGitterChannelUrl := "epfldata-squid/Lobby",
micrositeHighlightTheme := "atom-one-light",
micrositeOrganizationHomepage := "https://data.epfl.ch/",
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md" | "*.svg",
micrositeCssDirectory := (resourceDirectory in Compile).value / "microsite" / "styles",
micrositeJsDirectory := (resourceDirectory in Compile).value / "microsite" / "js",
fork in tut := true,
git.remoteRepo := "[email protected]:epfldata/squid.git",
micrositeExtraMdFiles := Map(
//file("CONTRIBUTING.md") -> ExtraMdFileConfig(
// "contributing.md",
// "home",
// Map("title" -> "Contributing", "section" -> "contributing", "position" -> "50")
//),
file("README.md") -> ExtraMdFileConfig(
"home.md",
"home",
Map("title" -> "Home", "section" -> "home", "position" -> "0")
)
),
makeMicrositeNoTut := {
Def
.sequential(
microsite,
//tut,
//micrositeTutExtraMdFiles,
makeSite,
micrositeConfig
)
.value
},
makeMicrositeQuick := {
Def
.sequential(
microsite,
tutQuick,
//micrositeTutExtraMdFiles,
makeSite,
micrositeConfig
)
.value
},
)
lazy val site = (project in file("site"))
.enablePlugins(MicrositesPlugin)
.settings(moduleName := "site")
.settings(commonSettings)
.settings(micrositeSettings)
.dependsOn(example)