-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
293 lines (250 loc) · 11.1 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
import java.io.ByteArrayOutputStream
import org.apache.commons.compress.archivers.tar.{ TarArchiveEntry, TarArchiveOutputStream }
import scalariform.formatter.preferences._
import sys.process._
val Version = "2.15.4"
lazy val commonSettings = Seq(
organization := "at.logic.gapt",
homepage := Some( url( "https://logic.at/gapt/" ) ),
organizationHomepage := homepage.value,
licenses += ( "GPL-3.0" -> url( "http://www.gnu.org/licenses/gpl-3.0.html" ) ),
startYear := Some( 2008 ),
version := Version,
autoAPIMappings := true,
publishMavenStyle := true,
publishTo := Some(
if ( isSnapshot.value )
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging ),
scmInfo := Some( ScmInfo(
browseUrl = url( "https://github.com/gapt/gapt" ),
connection = "scm:git:https://github.com/gapt/gapt.git",
devConnection = Some( "scm:git:git@github.com:gapt/gapt.git" ) ) ),
developers := List(
Developer(
id = "jvierling",
name = "Jannik Vierling",
email = "jannik.vierling@gmail.com",
url = url( "https://jvierling.github.io/" ) ),
Developer(
id = "shetzl",
name = "Stefan Hetzl",
email = "stefan.hetzl@tuwien.ac.at",
url = url( "http://dmg.tuwien.ac.at/hetzl/" ) ),
Developer(
id = "gebner",
name = "Gabriel Ebner",
email = "gebner@gebner.org",
url = url( "https://gebner.org/" ) ) ),
scalaVersion := "2.13.1",
scalacOptions in Compile ++= Seq(
"-deprecation",
"-language:postfixOps",
"-language:implicitConversions",
"-feature",
"-unchecked" ),
javaOptions ++= Seq( "-Xss40m", "-Xmx1g" ),
fork := true,
baseDirectory in run := file( "." ),
sourcesInBase := false // people like to keep scripts lying around
) ++ scalariformSettings
lazy val scalariformSettings =
Seq( scalariformPreferences := scalariformPreferences.value
.setPreference( AlignParameters, true )
.setPreference( AlignSingleLineCaseStatements, true )
.setPreference( DoubleIndentConstructorArguments, true )
.setPreference( SpaceInsideParentheses, true ) )
val specs2Version = "4.7.1"
lazy val testSettings = Seq(
testOptions in Test += Tests.Argument( TestFrameworks.Specs2, "junitxml", "console" ),
javaOptions in Test += "-Xmx2g",
libraryDependencies ++= Seq(
"org.specs2" %% "specs2-core" % specs2Version,
"org.specs2" %% "specs2-junit" % specs2Version, // needed for junitxml output
"org.specs2" %% "specs2-matcher" % specs2Version ) map ( _ % Test ) )
lazy val BuildSbtConfig = config( "buildsbt" ) extend Compile
lazy val root = project.in( file( "." ) ).
aggregate( core, examples, tests, userManual, cli, testing ).
dependsOn( core, examples, cli ).
settings( commonSettings: _* ).
enablePlugins( ScalaUnidocPlugin ).
settings(
fork in console := true,
initialCommands in console := IO.read( resourceDirectory.in( cli, Compile ).value / "gapt-cli-prelude.scala" ),
publish / skip := true,
packagedArtifacts := Map(),
inConfig( BuildSbtConfig )( SbtScalariform.configScalariformSettings ++ scalariformSettings ),
sourceDirectories in ( BuildSbtConfig, scalariformFormat ) := Seq( baseDirectory.value ),
includeFilter in ( BuildSbtConfig, scalariformFormat ) := ( "*.sbt": FileFilter ),
apiURL := Some( url( "https://logic.at/gapt/api/" ) ),
scalacOptions in ( ScalaUnidoc, unidoc ) ++= Seq(
"-doc-title", "gapt",
"-doc-version", version.value,
"-doc-source-url", s"https://github.com/gapt/gapt/blob/${"git rev-parse HEAD" !!}/€{FILE_PATH}.scala",
"-doc-root-content", ( baseDirectory.value / "doc" / "rootdoc.txt" ).getAbsolutePath,
"-sourcepath", baseDirectory.value.getAbsolutePath,
"-skip-packages", "ammonite:ammonite.ops",
"-diagrams",
"-implicits", "-implicits-show-all",
"-skip-packages", "scala" ),
scripts := {
val runJVMOptions = javaOptions.value ++ Seq( "-cp", Path.makeString(
Attributed.data( fullClasspath.in( cli, Compile ).value ++ fullClasspath.in( testing, Compile ).value distinct ) ) )
def mkScript( file: File, extraArgs: String* ) = {
IO.write(
file,
s"#!/bin/sh\njava ${( runJVMOptions ++ extraArgs ).mkString( " " )} ${"\"$@\""}\n" )
file.setExecutable( true )
}
(
mkScript( target.value / "run" ),
mkScript( target.value / "test-cut-intro", "gapt.testing.testCutIntro" ),
mkScript( target.value / "test-pi2-cut-intro", "gapt.testing.testPi2CutIntro" ),
mkScript( target.value / "test-induction", "gapt.testing.testInduction" ),
mkScript( target.value / "viper", "gapt.provers.viper.Viper" ),
mkScript( target.value / "escargot", "gapt.provers.escargot.Escargot" ),
mkScript( target.value / "slakje", "gapt.provers.slakje.Slakje" ),
mkScript( target.value / "cli", "gapt.cli.CLIMain" ) )
},
// Release stuff
mainClass in assembly := Some( "gapt.cli.CLIMain" ),
aggregate in assembly := false,
releaseDist := {
val baseDir = file( "." )
val version = Keys.version.value
val apidocs = doc.in( ScalaUnidoc, unidoc ).value
val archiveFile = file( "." ) / "target" / s"gapt-$version.tar.gz"
Process( List( "latexmk", "-pdf", "-silent", "user_manual.tex" ), baseDir / "doc" ) !
val filesToIncludeAsIs = List(
"COPYING", "gapt.sh", "slakje.sh", "escargot.sh", "viper.sh", "include.sh", "examples" )
val entries = List( ( assembly.value, s"gapt-$version.jar" ) ) ++
filesToIncludeAsIs.flatMap { fn => recursiveListFiles( baseDir / fn ) }
.map { f => ( f, baseDir.toPath.relativize( f.toPath ) ) } ++
List(
( baseDir / "doc/README.dist", "README" ),
( baseDir / "doc/user_manual.pdf", "user_manual.pdf" ) ) ++
recursiveListFiles( apidocs ).map { f => f -> s"apidocs/${apidocs.toPath.relativize( f.toPath )}" }
val archiveStem = s"gapt-$version"
IO.gzipFileOut( archiveFile ) { gzipOut =>
val tarOut = new TarArchiveOutputStream( gzipOut )
tarOut.setLongFileMode( TarArchiveOutputStream.LONGFILE_POSIX )
entries.foreach {
case ( file, pathInArchive ) =>
val tarEntry = new TarArchiveEntry( file, s"$archiveStem/$pathInArchive" )
if ( file.canExecute ) tarEntry.setMode( BigInt( "755", 8 ).toInt )
tarOut.putArchiveEntry( tarEntry )
IO.transfer( file, tarOut )
tarOut.closeArchiveEntry()
}
tarOut.close()
}
archiveFile
},
evalUserManual := {
val userManFn = "doc/user_manual.tex"
val out = new ByteArrayOutputStream
val exitVal = new Fork( "java", Some( "gapt.doc.evalCodeSnippets" ) ).fork(
ForkOptions(
javaHome = javaHome.value,
outputStrategy = Some( CustomOutput( out ) ),
bootJars = Vector(),
workingDirectory = Some( new java.io.File( "." ) ),
runJVMOptions = Vector() ++ javaOptions.value ++ Seq( "-cp", Path.makeString(
Attributed.data( fullClasspath.in( userManual, Compile ).value ) ) ),
connectInput = false,
envVars = envVars.value ),
Seq( userManFn ) ).exitValue()
if ( exitVal == 0 ) IO.write( file( userManFn ), out.toByteArray )
} )
lazy val core = project.in( file( "core" ) ).
settings( commonSettings: _* ).
settings(
name := "gapt",
description := "General Architecture for Proof Theory",
scalacOptions in Compile += "-Xfatal-warnings",
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0",
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.parboiled" %% "parboiled" % "2.1.8",
"com.lihaoyi" %% "fastparse" % "2.1.3",
"com.lihaoyi" %% "sourcecode" % "0.1.7",
"org.typelevel" %% "cats-free" % "2.1.0",
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
"org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0",
"org.apache.commons" % "commons-lang3" % "3.9",
"com.lihaoyi" %% "ammonite-ops" % "2.0.4",
"de.uni-freiburg.informatik.ultimate" % "smtinterpol" % "2.5",
"com.github.scopt" %% "scopt" % "3.7.1",
"org.ow2.sat4j" % "org.ow2.sat4j.core" % "2.3.5",
"org.ow2.sat4j" % "org.ow2.sat4j.maxsat" % "2.3.5" ),
// UI
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-swing" % "2.1.1",
"com.itextpdf" % "itextpdf" % "5.5.13.1",
"org.scilab.forge" % "jlatexmath" % "1.0.7" ),
// JSON serialization
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.7",
libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser",
"io.circe" %% "circe-generic-extras" ).map( _ % "0.12.1" ) )
lazy val examples = project.in( file( "examples" ) ).
dependsOn( core ).
settings( commonSettings: _* ).
settings(
name := "gapt-examples",
unmanagedSourceDirectories in Compile := Seq( baseDirectory.value ),
resourceDirectory in Compile := baseDirectory.value,
excludeFilter in ( Compile, unmanagedResources ) := {
val target = ( baseDirectory.value / "target" ).getCanonicalPath
new SimpleFileFilter( _.getCanonicalPath startsWith target )
} || "*.scala" )
lazy val tests = project.in( file( "tests" ) ).
dependsOn( core, examples ).
settings( commonSettings: _* ).
settings( testSettings: _* ).
disablePlugins( JUnitXmlReportPlugin ).
settings(
testForkedParallel := true,
publish / skip := true,
packagedArtifacts := Map() )
lazy val userManual = project.in( file( "doc" ) ).
dependsOn( cli ).
settings( commonSettings: _* ).
settings(
unmanagedSourceDirectories in Compile := Seq( baseDirectory.value ),
publish / skip := true,
packagedArtifacts := Map() )
lazy val cli = project.in( file( "cli" ) ).
dependsOn( core, examples ).
settings( commonSettings: _* ).
settings(
mainClass := Some( "gapt.cli.CLIMain" ),
scalacOptions in Compile += "-Xfatal-warnings",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value ),
publish / skip := true,
packagedArtifacts := Map() )
addCommandAlias( "format", "; scalariformFormat ; buildsbt:scalariformFormat" )
lazy val testing = project.in( file( "testing" ) ).
dependsOn( core, examples ).
settings( commonSettings: _* ).
settings(
name := "gapt-testing",
description := "gapt extended regression tests",
scalacOptions in Compile += "-Xfatal-warnings",
publish / skip := true,
packagedArtifacts := Map() )
lazy val releaseDist = TaskKey[File]( "release-dist", "Creates the release tar ball." )
lazy val evalUserManual = TaskKey[Unit]( "eval-user-manual", "Evaluates the snippets in the user manual." )
lazy val scripts = TaskKey[Unit]( "scripts", "Creates scripts in target/" )
def recursiveListFiles( f: File ): Seq[File] =
if ( f.getName == "target" )
Seq()
else if ( f.isDirectory )
IO.listFiles( f ).flatMap( recursiveListFiles )
else
Seq( f )