-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
180 lines (151 loc) · 5.35 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
/*
* Copyright (C) 2015 Fabrizio Colonna
*
* 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.
*/
/*
* Tankwar SBT Build File
* Ref: http://www.scala-sbt.org/0.13.0/docs/Examples/Quick-Configuration-Examples.html
*/
import com.typesafe.sbt.SbtScalariform._
import de.johoop.cpd4sbt.CopyPasteDetector._
import sbt.File
import sbt.Keys._
import wartremover.WartRemover.autoImport._
import scalariform.formatter.preferences._
// Project Definition
name := "TankWar"
version := "0.2.0"
scalaVersion := "2.11.7"
mainClass in Compile := Some("com.colofabrix.scala.TankWarMain")
fork := true
// Dependencies
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies ++= Seq(
"org.lwjgl.lwjgl" % "lwjgl-platform" % "2.9.0" classifier "natives-windows" classifier "natives-linux" classifier "natives-osx",
"slick-util" % "slick-util" % "1.0.0" from "http://slick.ninjacave.com/slick-util.jar",
//"com.github.wookietreiber" %% "scala-chart" % "latest.integration",
"org.uncommons.watchmaker" % "watchmaker-framework" % "0.7.1",
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
"com.storm-enroute" %% "scalameter" % "0.7",
"org.uncommons" % "uncommons-maths" % "1.2",
"org.lwjgl.lwjgl" % "lwjgl_util" % "2.9.0"
)
// Scala compiler options.
// See: https://tpolecat.github.io/2014/04/11/scalac-flags.html
scalacOptions ++= Seq(
"-Xmax-classfile-name", "72",
"-encoding", "UTF-8",
"-deprecation",
"-unchecked",
"-feature",
//"-Xfatal-warnings",
"-Xfuture",
"-Xlint",
"-language:implicitConversions",
"-language:existentials",
"-language:higherKinds",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Ywarn-unused-import",
"-Ywarn-adapted-args",
"-Ywarn-dead-code"
)
// JVM Options.
// See: http://blog.sokolenko.me/2014/11/javavm-options-production.html
javaOptions ++= Seq(
"-server",
"-Xverify:none",
// Memory settings
"-XX:InitialHeapSize=1G",
"-XX:MaxHeapSize=1G",
"-XX:NewRatio=1",
"-XX:MetaspaceSize=32M",
"-XX:MaxMetaspaceSize=32M",
"-XX:SurvivorRatio=10",
"-XX:CompressedClassSpaceSize=16M",
"-XX:+UseCompressedOops",
"-XX:+UseCompressedClassPointers",
// Other settings
s"-Djava.library.path=${unmanagedBase.value}",
"-Dfile.encoding=UTF-8"
)
// Scaladoc configuration
target in (Compile, compile) in doc := baseDirectory.value / "docs"
// Native libraries extraction - LWJGL has some native libraries provided as JAR files that I have to extract
compile in Compile <<= (compile in Compile).dependsOn(Def.task {
val r = "^(\\w+).*".r
val r(os) = System.getProperty( "os.name" )
val jars = ( update in Compile ).value
.select( configurationFilter( "compile" ) )
.filter( _.name.contains( os.toLowerCase ) )
jars foreach { jar =>
println( s"[info] Processing '${jar.getName}' and saving to '${unmanagedBase.value}'" )
IO.unzip( jar, unmanagedBase.value )
}
Seq.empty[File]
})
// Scalameter
testFrameworks += new TestFramework( "org.scalameter.ScalaMeterFramework" )
logBuffered := false
parallelExecution in Test := false
// Code Style
/*
// UTF-8 support is broken?
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
compileScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Compile).toTask("").value
(compile in Compile) <<= (compile in Compile) dependsOn compileScalastyle
*/
scalastyleConfig := file( s"${sourceDirectory.value}/main/resources/scalastyle-config.xml" )
SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(SpaceInsideParentheses, true)
.setPreference(SpacesWithinPatternBinders, true)
.setPreference(SpacesAroundMultiImports, true)
.setPreference(DanglingCloseParenthesis, Force)
.setPreference(CompactControlReadability, true)
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
)
// Code Quality
wartremoverExcluded ++= (sourceDirectory.value ** "*old*" ** "*.scala").get
wartremoverErrors in (Compile, compile) ++= Seq(
Wart.Any2StringAdd,
Wart.AsInstanceOf,
Wart.EitherProjectionPartial,
Wart.IsInstanceOf,
Wart.ListOps,
Wart.Nothing,
Wart.Null,
Wart.OptionPartial,
Wart.Product,
Wart.Serializable
)
wartremoverWarnings in (Compile, compile) ++= Seq(
Wart.Any2StringAdd,
Wart.EitherProjectionPartial,
Wart.Enumeration,
Wart.FinalCaseClass,
Wart.JavaConversions,
Wart.MutableDataStructures,
Wart.Option2Iterable,
Wart.Serializable,
Wart.ToString,
Wart.TryPartial,
Wart.Var
)
coverageMinimum := 75
coverageFailOnMinimum := true
cpdSettings
com.markatta.sbttaglist.TagListPlugin.tagListSettings