-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.sbt
175 lines (163 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
import sbt._, Keys._
import org.fusesource.scalate.ScalatePlugin._, ScalateKeys._
import skinny.servlet._, ServletPlugin._, ServletKeys._
import org.sbtidea.SbtIdeaPlugin._
import scala.language.postfixOps
// -------------------------------------------------------
// Common Settings
// -------------------------------------------------------
val appOrganization = "jp.co.atware"
val appName = "scuruto"
val appVersion = "1.1.1-SNAPSHOT"
val skinnyVersion = "2.5.2"
val theScalaVersion = "2.12.4"
val jettyVersion = "9.3.22.v20171030"
lazy val baseSettings = servletSettings ++ Seq(
organization := appOrganization,
name := appName,
version := appVersion,
scalaVersion := theScalaVersion,
dependencyOverrides := Set(
"org.scala-lang" % "scala-library" % scalaVersion.value,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.6",
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.6",
"org.slf4j" % "slf4j-api" % "1.7.25"
),
libraryDependencies ++= Seq(
"org.skinny-framework" %% "skinny-framework" % skinnyVersion,
"org.skinny-framework" %% "skinny-assets" % skinnyVersion,
"org.skinny-framework" %% "skinny-task" % skinnyVersion,
"org.skinny-framework" % "skinny-logback" % "1.0.14",
"org.skinny-framework" %% "skinny-oauth2-controller" % skinnyVersion,
"org.skinny-framework" %% "skinny-scaldi" % skinnyVersion,
"com.h2database" % "h2" % "1.4.196",
"org.postgresql" % "postgresql" % "42.1.4",
"org.skinny-framework" %% "skinny-factory-girl" % skinnyVersion % "test",
"org.skinny-framework" %% "skinny-test" % skinnyVersion % "test",
"org.eclipse.jetty" % "jetty-webapp" % jettyVersion % "container",
"org.eclipse.jetty" % "jetty-plus" % jettyVersion % "container",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "container;provided;test",
"org.pegdown" % "pegdown" % "1.6.0",
"org.scilab.forge" % "jlatexmath" % "1.0.6",
"com.github.t3hnar" %% "scala-bcrypt" % "3.1",
"com.github.roundrop" %% "scalikejdbc-sqlsyntax-ext" % "1.1.2",
"com.unboundid" % "unboundid-ldapsdk" % "2.3.8", // for LDAP
"org.zapodot" % "embedded-ldap-junit" % "0.5.2" % "test" // for LDAP TEST
),
// ------------------------------
// for ./skinnny console
initialCommands := """
import _root_.skinny._
import _root_.controller._
import _root_.model._
import _root_.org.joda.time._
import _root_.scalikejdbc._
import _root_.scalikejdbc.config._
DBSettings.initialize()
""",
resolvers ++= Seq(
"sonatype releases" at "https://oss.sonatype.org/content/repositories/releases"
//, "sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
//, "LocalRepo" at file(Path.userHome.absolutePath + "/.ivy2/local").getAbsolutePath
, "jlatexmath latest" at "https://dl.bintray.com/porst17/maven/" // by http://forge.scilab.org/index.php/p/jlatexmath/issues/1293/
),
// Faster "./skinny idea"
transitiveClassifiers in Global := Seq(Artifact.SourceClassifier),
// the name-hashing algorithm for the incremental compiler.
incOptions := incOptions.value.withNameHashing(true),
updateOptions := updateOptions.value.withCachedResolution(true),
logBuffered in Test := false,
javaOptions in Test ++= Seq("-Dskinny.env=test"),
fork in Test := true,
suppressSbtShellNotification := true,
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature"),
ideaExcludeFolders := Seq(".idea",
".idea_modules",
"db",
"target",
"task/target",
"build",
"standalone-build",
"node_modules")
)
lazy val scalatePrecompileSettings = scalateSettings ++ Seq(
scalateTemplateConfig in Compile := {
val base = (sourceDirectory in Compile).value
Seq(
TemplateConfig(
file(".") / "src" / "main" / "webapp" / "WEB-INF",
// These imports should be same as src/main/scala/templates/ScalatePackage.scala
Seq("import controller._", "import model._"),
Seq(
Binding("context",
"_root_.skinny.micro.contrib.scalate.SkinnyScalateRenderContext",
importMembers = true,
isImplicit = true)
),
Some("templates")
)
)
}
)
// -------------------------------------------------------
// Development
// -------------------------------------------------------
lazy val devBaseSettings = baseSettings ++ Seq(
unmanagedClasspath in Test += Attributed.blank(baseDirectory.value / "src/main/webapp"),
// Integration tests become slower when multiple controller tests are loaded in the same time
parallelExecution in Test := false,
port in container.Configuration := 8080
)
lazy val dev = (project in file("."))
.settings(devBaseSettings)
.settings(
name := appName + "-dev",
target := baseDirectory.value / "target" / "dev"
)
// --------------------------------------------------------
// Enable this sub project when you'd like to use --precompile option
// --------------------------------------------------------
/*
lazy val precompileDev = (project in file(".")).settings(devBaseSettings, scalatePrecompileSettings).settings(
name := appName + "-precompile-dev",
target := baseDirectory.value / "target" / "precompile-dev",
ideaIgnoreModule := true
)
*/
// -------------------------------------------------------
// Task Runner
// -------------------------------------------------------
lazy val task = (project in file("task"))
.settings(baseSettings)
.settings(
mainClass := Some("TaskRunner"),
name := appName + "-task",
libraryDependencies += "javax.servlet" % "javax.servlet-api" % "3.1.0"
) dependsOn (dev)
// -------------------------------------------------------
// Packaging
// -------------------------------------------------------
lazy val packagingBaseSettings = baseSettings ++ scalatePrecompileSettings ++ Seq(
sources in doc in Compile := List(),
publishTo := {
val base = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT")) Some("snapshots" at base + "content/repositories/snapshots")
else Some("releases" at base + "service/local/staging/deploy/maven2")
}
)
lazy val build = (project in file("build"))
.settings(packagingBaseSettings)
.settings(
name := appName,
ideaIgnoreModule := true
)
lazy val standaloneBuild = (project in file("standalone-build"))
.settings(packagingBaseSettings)
.settings(
name := appName + "-standalone",
libraryDependencies += "org.skinny-framework" %% "skinny-standalone" % skinnyVersion,
ideaIgnoreModule := true,
ivyXML := <dependencies><exclude org="org.eclipse.jetty.orbit" /></dependencies>
)