-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
179 lines (135 loc) · 6.43 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
import java.io.FileWriter
import scalariform.formatter.preferences._
import AssemblyKeys._
//import de.johoop.findbugs4sbt.FindBugs._
import com.typesafe.startscript.StartScriptPlugin
name := "LinqOnSteroids"
version := "0.3-SNAPSHOT"
//scalaVersion in ThisBuild := "2.9.2"
scalaVersion in ThisBuild := "2.10.3"
//resolvers in ThisBuild += Resolver.sonatypeRepo("snapshots")
//scalaVersion in ThisBuild := "2.10.0-SNAPSHOT"
////Alternative resolver setup:
////DefaultOptions.addResolvers
////resolvers in ThisBuild += ScalaToolsSnapshots
////resolvers in ThisBuild += "sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
parallelExecution in Test := false
libraryDependencies <+= scalaVersion (ver => "org.scala-lang" % "scala-compiler" % ver)
libraryDependencies <+= scalaVersion (ver => "org.scala-lang" % "scala-reflect" % ver)
libraryDependencies <+= scalaVersion (ver => "org.scala-lang" % "scala-actors" % ver)
libraryDependencies in ThisBuild += "junit" % "junit" % "4.8.2" % "test->default"
//We can't restrict this to "test" as long as FindBugsAnalysis is in main, including its "testing" part.
//libraryDependencies += "org.scalatest" %% "scalatest" % "1.7.1"// % "test"
//libraryDependencies <+= scalaVersion (ver => "org.scalatest" % ("scalatest_" + ver) % ("1.9-%s-B2" format ver))
//libraryDependencies += "org.scalatest" % "scalatest" % ("1.9-%s-B1" format "2.10.0-M7") cross CrossVersion.full
//libraryDependencies <+= scalaVersion (ver => "org.scalatest" % "scalatest" % ("1.9-%s-B1" format ver) cross CrossVersion.full)
libraryDependencies += "org.scalatest" %% "scalatest" % "2.0"
libraryDependencies += "com.google.guava" % "guava" % "13.0"
libraryDependencies += "com.github.scopt" %% "scopt" % "2.1.0"
libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.9"
//resolvers in ThisBuild += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
//libraryDependencies in ThisBuild += "de.tud.cs.st" %% "bat-core" % "1.0.0-SNAPSHOT"
//libraryDependencies in ThisBuild += "de.tud.cs.st" % "bat-core" % "1.0.0-SNAPSHOT" cross CrossVersion.full
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.0.0-M7"
scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation")
//scalacOptions ++= Seq("-Xprint:typer")
scalacOptions in ThisBuild ++= Seq("-feature", "-language:implicitConversions",
"-language:higherKinds", "-language:existentials")
scalacOptions in ThisBuild ++= Seq("-Ywarn-adapted-args", "-Ywarn-inaccessible",
"-Ywarn-nullary-override", "-Ywarn-nullary-unit", "-Ywarn-numeric-widen") //All -Ywarn except -Ywarn-dead-code, which gives tons
//of false positives, and -Ywarn-value-discard, which doesn't sound relevant.
//scalacOptions in ThisBuild += "-explaintypes"
//scalacOptions in ThisBuild += "-optimise"
//scalacOptions in ThisBuild += "-Yinline"
//addCompilerPlugin("org.scala-tools.sxr" %% "sxr" % "0.2.8-SNAPSHOT")
//scalacOptions in ThisBuild <+= scalaSource in Compile map { "-P:sxr:base-directory:" + _.getAbsolutePath }
//JUnit integration. It is disabled because our tests are both JUnit tests and
//ScalaTest ones, so it would run again the same tests.
//This integration would be useful if we ever used pure JUnit
//tests.
//libraryDependencies += "com.novocode" % "junit-interface" % "0.5" % "test->default"
// This enables test integration with Jenkins, following instructions from https://github.com/ijuma/junit_xml_listener#readme
testListeners <<= target.map(t => Seq(new eu.henkelmann.sbt.JUnitXmlTestsListener(t.getAbsolutePath)))
seq(defaultScalariformSettings: _*)
ScalariformKeys.preferences := FormattingPreferences().
setPreference(IndentWithTabs, false).
setPreference(DoubleIndentClassDeclaration, true).
setPreference(AlignSingleLineCaseStatements, true).
setPreference(MultilineScaladocCommentsStartOnFirstLine, true).
setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true).
setPreference(PreserveSpaceBeforeArguments, true).
setPreference(AlignParameters, true)
//Add support for FindBugs
//seq(findbugsSettings : _*)
// define the statements initially evaluated when entering 'console', 'console-quick', or 'console-project'
initialCommands := """
import System.{nanoTime => now}
def time[T](f: => T): T = {
val start = now
try { f } finally { println("Elapsed: " + (now - start)/(1000.0 * 1000.0) + " ms") }
}
"""
// set the initial commands when entering 'console' or 'console-quick', but not 'console-project'
initialCommands in console := """
import ivm._
import expressiontree._
import Lifting._
import optimization._
import squopt.imports._
import performancetests.Benchmarking
val bench = new Benchmarking { override val debugBench = false }
"""
//initialCommands in (Test, console) := """
// import ivm._
// import expressiontree._
// import Lifting._
// import optimization._
// import tests._
// import performancetests._
// import opaltests._
////
// import de.tud.cs.st.bat
// import bat.resolved._
// import bat.resolved.analyses._
////
// import reader.Java6Framework
//"""
//scalaVersion in GlobalScope <<= appConfiguration(_.provider.scalaProvider.version)
sourceGenerators in Compile <+= (sourceManaged in Compile, baseDirectory, appConfiguration) map { (dir, baseDir, appConfig ) =>
val gen = new Generator(scalaLibraryPath = appConfig.provider.scalaProvider.libraryJar)
dir.mkdirs()
if (!(dir.exists() && dir.isDirectory())) {
scala.Console.err.printf("Failure creating output directory %s\n", dir)
}
val verFile = dir / "version.scala"
val path = ""
val gitVersion = (path + "git describe --always --dirty --abbrev=40").!!
val writer = new FileWriter(verFile)
try {
writer write ("""package ivm
object GitVersion {
val version = "%s"
}
""" format gitVersion.trim)
} finally {
writer.close()
}
(for {
base <- Generator.templates
file = dir / (base + ".scala")
} yield {
if (!file.exists() || (baseDir / "src" / "main" / "resources" / (base + ".ssp") newerThan file)) {
printf("Generating %s\n", file)
gen.render(dir.absolutePath, base)
}
file
}) :+ verFile
}
//Generate start scripts
//seq(StartScriptPlugin.startScriptForClassesSettings: _*)
seq(StartScriptPlugin.startScriptForJarSettings: _*)
mainClass in Compile := Some("performancetests.opaltests.FindBugsAnalyses")
//generate fat JAR
assemblySettings
mainClass in assembly := Some("performancetests.opaltests.FindBugsAnalyses")
test in assembly := {}