-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sbt
452 lines (404 loc) · 15.5 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
import sbtassembly.AssemblyPlugin.autoImport._
import sbtunidoc.ScalaUnidocPlugin
name := "OPAL Library"
// SNAPSHOT
version in ThisBuild := "3.0.0-SNAPSHOT"
// RELEASED version in ThisBuild := "2.0.1" // October 10th, 2018
// RELEASED version in ThisBuild := "2.0.0" // October 2nd, 2018
// RELEASED version in ThisBuild := "1.0.0" // October 25th, 2017
// RELEASED version in ThisBuild := "0.8.15" // September 7th, 2017
// RELEASED version in ThisBuild := "0.8.14" // June 23rd, 2017
// RELEASED version in ThisBuild := "0.8.13" // MAY 19th, 2017
// RELEASED version in ThisBuild := "0.8.12" // April 28th, 2017
// RELEASED version in ThisBuild := "0.8.11" // April 14th, 2017
// RELEASED version in ThisBuild := "0.8.10"
// RELEASED version in ThisBuild := "0.8.9"
organization in ThisBuild := "de.opal-project"
homepage in ThisBuild := Some(url("https://www.opal-project.de"))
licenses in ThisBuild := Seq("BSD-2-Clause" -> url("https://opensource.org/licenses/BSD-2-Clause"))
scalaVersion in ThisBuild := "2.12.13"
ScalacConfiguration.globalScalacOptions
resolvers in ThisBuild += Resolver.jcenterRepo
resolvers in ThisBuild += "Typesafe Repo" at "https://repo.typesafe.com/typesafe/releases/"
// OPAL already parallelizes most tests/analyses internally!
parallelExecution in ThisBuild := false
parallelExecution in Global := false
logBuffered in ThisBuild := false
javacOptions in ThisBuild ++= Seq("-encoding", "utf8", "-source", "1.8")
testOptions in ThisBuild := {
baseDirectory
.map(bd ⇒ Seq(Tests.Argument("-u", bd.getAbsolutePath + "/shippable/testresults")))
.value
}
testOptions in ThisBuild += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2")
testOptions in ThisBuild += Tests.Argument("-o")
// Required to get relative links in the generated source code documentation.
scalacOptions in (ScalaUnidoc, unidoc) := {
baseDirectory.map(bd ⇒ Seq("-sourcepath", bd.getAbsolutePath)).value
}
scalacOptions in (ScalaUnidoc, unidoc) ++=
Opts.doc.sourceUrl(
"https://raw.githubusercontent.com/stg-tud/opal/" +
(if (isSnapshot.value) "develop" else "master") +
"/€{FILE_PATH}.scala"
)
scalacOptions in (ScalaUnidoc, unidoc) ++= Opts.doc.version(version.value)
scalacOptions in (ScalaUnidoc, unidoc) ++= Opts.doc.title("The OPAL Framework")
javaOptions in ThisBuild ++= Seq(
"-Xmx24G",
"-Xms4096m",
"-XX:ThreadStackSize=2048",
"-Xnoclassgc",
"-XX:NewRatio=1",
"-XX:SurvivorRatio=8",
"-XX:+UseParallelGC",
"-XX:+AggressiveOpts"
)
addCommandAlias(
"compileAll",
"; copyResources ; scalastyle ; " +
"test:compile ; test:scalastyle ; " +
"it:scalariformFormat ; it:scalastyle ; it:compile "
)
addCommandAlias("buildAll", "; compileAll ; unidoc ; publishLocal ")
addCommandAlias(
"cleanAll",
"; clean ; cleanCache ; cleanLocal ; test:clean ; it:clean ; cleanFiles"
)
addCommandAlias("cleanBuild", "; project OPAL ; cleanAll ; buildAll ")
lazy val IntegrationTest = config("it") extend Test
// Default settings without scoverage
lazy val buildSettings =
Defaults.coreDefaultSettings ++
scalariformSettings ++
PublishingOverwrite.onSnapshotOverwriteSettings ++
Seq(libraryDependencies ++= Dependencies.testlibs) ++
Seq(Defaults.itSettings: _*) ++
Seq(unmanagedSourceDirectories := (scalaSource in Compile).value :: Nil) ++
Seq(
unmanagedSourceDirectories in Test := (javaSource in Test).value :: (scalaSource in Test).value :: Nil
) ++
Seq(
unmanagedSourceDirectories in IntegrationTest := (javaSource in Test).value :: (scalaSource in IntegrationTest).value :: Nil
) ++
Seq(scalacOptions in (Compile, console) := Seq("-deprecation")) ++
// We don't want the build to be aborted by inter-project links that are reported by
// scaladoc as errors using the standard compiler setting. (This case is only true, when
// we publish the projects.)
Seq(scalacOptions in (Compile, doc) := Opts.doc.version(version.value)) ++
// Discard module-info files when assembling fat jars
// see https://github.com/sbt/sbt-assembly/issues/391
Seq(assemblyMergeStrategy in assembly := {
case "module-info.class" => MergeStrategy.discard
case other => (assemblyMergeStrategy in assembly).value(other)
})
lazy val scalariformSettings = scalariformItSettings ++
Seq(ScalariformKeys.preferences := baseDirectory(getScalariformPreferences).value)
def getScalariformPreferences(dir: File) = {
val formatterPreferencesFile = "Scalariform Formatter Preferences.properties"
PreferencesImporterExporter.loadPreferences(file(formatterPreferencesFile).getPath)
}
/*******************************************************************************
*
* THE ROOT PROJECT
*
******************************************************************************/
lazy val opal = `OPAL`
lazy val `OPAL` = (project in file("."))
// .configure(_.copy(id = "OPAL"))
.settings((Defaults.coreDefaultSettings ++ Seq(publishArtifact := false)): _*)
.enablePlugins(ScalaUnidocPlugin)
.settings(
unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(
hermes,
validate,
demos,
tools
)
)
.aggregate(
common,
si,
bi,
br,
da,
bc,
ba,
ai,
tac,
de,
av,
framework,
// bp, (just temporarily...)
tools,
hermes,
validate, // Not deployed to maven central
demos // Not deployed to maven central
)
/*******************************************************************************
*
* THE CORE PROJECTS WHICH CONSTITUTE OPAL
*
******************************************************************************/
lazy val common = `Common`
lazy val `Common` = (project in file("OPAL/common"))
.settings(buildSettings: _*)
.settings(
name := "Common",
scalacOptions in (Compile, doc) := Opts.doc.title("OPAL-Common"),
libraryDependencies ++= Dependencies.common(scalaVersion.value)
)
.configs(IntegrationTest)
lazy val si = `StaticAnalysisInfrastructure`
lazy val `StaticAnalysisInfrastructure` = (project in file("OPAL/si"))
.settings(buildSettings: _*)
.settings(
name := "Static Analysis Infrastructure",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Static Analysis Infrastructure"),
libraryDependencies ++= Dependencies.si
)
.configs(IntegrationTest)
.dependsOn(common % "it->test;test->test;compile->compile")
lazy val bi = `BytecodeInfrastructure`
lazy val `BytecodeInfrastructure` = (project in file("OPAL/bi"))
.settings(buildSettings: _*)
.settings(
name := "Bytecode Infrastructure",
libraryDependencies ++= Dependencies.bi,
scalacOptions in (Compile, doc) := Opts.doc.title("OPAL - Bytecode Infrastructure"),
/*
The following settings relate to the java-fixture-compiler plugin, which
compiles the java fixture projects in the BytecodeInfrastructure project for testing.
For information about the java fixtures, see: OPAL/bi/src/test/fixtures-java/Readme.md
The default settings for the fixture compilations are used.
For details on the plugin and how to change its settings, see:
DEVELOPING_OPAL/plugins/sbt-java-fixture-compiler/Readme.md
*/
inConfig(Test)(
JavaFixtureCompiler.baseJavaFixtureSettings ++
Seq(
unmanagedResourceDirectories ++= Seq(
(javaFixtureProjectsDir in javaFixtureDiscovery).value,
(javaFixtureSupportDir in javaFixtureDiscovery).value
),
resourceGenerators += Def.task {
(javaFixturePackage in Test).value.flatMap(_.generatedFiles)
}
)
)
)
.dependsOn(common % "it->test;test->test;compile->compile")
.configs(IntegrationTest)
.enablePlugins(JavaFixtureCompiler)
lazy val br = `BytecodeRepresentation`
lazy val `BytecodeRepresentation` = (project in file("OPAL/br"))
.settings(buildSettings: _*)
.settings(
name := "Bytecode Representation",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Bytecode Representation"),
libraryDependencies ++= Dependencies.br
)
.dependsOn(si % "it->it;it->test;test->test;compile->compile")
.dependsOn(bi % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val da = `BytecodeDisassembler`
lazy val `BytecodeDisassembler` = (project in file("OPAL/da"))
.settings(buildSettings: _*)
.settings(
name := "Bytecode Disassembler",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Bytecode Disassembler"),
//[currently we can only use an unversioned version] assemblyJarName
//in assembly := "OPALBytecodeDisassembler.jar-" + version.value
assemblyJarName in assembly := "OPALDisassembler.jar",
mainClass in assembly := Some("org.opalj.da.Disassembler")
)
.dependsOn(bi % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val bc = `BytecodeCreator`
lazy val `BytecodeCreator` = (project in file("OPAL/bc"))
.settings(buildSettings: _*)
.settings(
name := "Bytecode Creator",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Bytecode Creator")
)
.dependsOn(da % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val ai = `AbstractInterpretationFramework`
lazy val `AbstractInterpretationFramework` = (project in file("OPAL/ai"))
.settings(buildSettings: _*)
.settings(
name := "Abstract Interpretation Framework",
scalacOptions in (Compile, doc) := (Opts.doc
.title("OPAL - Abstract Interpretation Framework") ++ Seq("-groups", "-implicits")),
fork in run := true
)
.dependsOn(br % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val tac = `ThreeAddressCode`
lazy val `ThreeAddressCode` = (project in file("OPAL/tac"))
.settings(buildSettings: _*)
.settings(
name := "Three Address Code",
scalacOptions in (Compile, doc) := (Opts.doc
.title("OPAL - Three Address Code") ++ Seq("-groups", "-implicits")),
assemblyJarName in assembly := "OPALTACDisassembler.jar",
mainClass in assembly := Some("org.opalj.tac.TAC"),
fork in run := true
)
.dependsOn(ai % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val ba = `BytecodeAssembler`
lazy val `BytecodeAssembler` = (project in file("OPAL/ba"))
.settings(buildSettings: _*)
.settings(
name := "Bytecode Assembler",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Bytecode Assembler")
)
.dependsOn(
bc % "it->it;it->test;test->test;compile->compile",
ai % "it->it;it->test;test->test;compile->compile"
)
.configs(IntegrationTest)
// The project "DependenciesExtractionLibrary" depends on the abstract interpretation framework to
// be able to resolve calls using MethodHandle/MethodType/"invokedynamic"/...
lazy val de = `DependenciesExtractionLibrary`
lazy val `DependenciesExtractionLibrary` = (project in file("OPAL/de"))
.settings(buildSettings: _*)
.settings(
name := "Dependencies Extraction Library",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Dependencies Extraction Library")
)
.dependsOn(ai % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val av = `ArchitectureValidation`
lazy val `ArchitectureValidation` = (project in file("OPAL/av"))
.settings(buildSettings: _*)
.settings(
name := "Architecture Validation",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Architecture Validation")
)
.dependsOn(de % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val framework = `Framework`
lazy val `Framework` = (project in file("OPAL/framework"))
.settings(buildSettings: _*)
.settings(
name := "Framework",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Framework"),
fork in run := true
)
.dependsOn(
ba % "it->it;it->test;test->test;compile->compile",
av % "it->it;it->test;test->test;compile->compile",
tac % "it->it;it->test;test->test;compile->compile"
)
.configs(IntegrationTest)
/* TEMPORARILY DISABLED THE BUGPICKER UNTIL WE HAVE A CG ANALYSIS AGAIN!
lazy val bp = `BugPicker`
lazy val `BugPicker` = (project in file("TOOLS/bp"))
.settings(buildSettings: _*)
.settings(
name := "BugPicker",
scalacOptions in(Compile, doc) ++= Opts.doc.title("OPAL - BugPicker"),
fork := true
)
.dependsOn(framework % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
*/
lazy val hermes = `Hermes`
lazy val `Hermes` = (project in file("TOOLS/hermes"))
.settings(buildSettings: _*)
.settings(
name := "Hermes",
libraryDependencies ++= Dependencies.hermes,
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Hermes")
)
.dependsOn(framework % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
lazy val tools = `Tools`
lazy val `Tools` = (project in file("DEVELOPING_OPAL/tools"))
.settings(buildSettings: _*)
.settings(
name := "Tools",
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Developer Tools"),
scalacOptions in (Compile, console) := Seq("-deprecation"),
//library dependencies
libraryDependencies ++= Dependencies.tools,
assemblyJarName in assembly := "OPALInvokedynamicRectifier.jar",
mainClass in assembly := Some("org.opalj.support.tools.ProjectSerializer"),
// Required by Java/ScalaFX
fork := true
)
.dependsOn(framework % "it->it;it->test;test->test;compile->compile")
.configs(IntegrationTest)
/** ***************************************************************************
*
* PROJECTS BELONGING TO THE OPAL ECOSYSTEM
* (Not Deployed to Maven Central!)
*
*/
// This project validates OPAL's implemented architecture and
// contains overall integration tests; hence
// it is not a "project" in the classical sense!
lazy val validate = `Validate`
lazy val `Validate` = (project in file("DEVELOPING_OPAL/validate"))
.settings(buildSettings: _*)
.settings(
name := "Validate",
publishArtifact := false,
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Validate"),
compileOrder in Test := CompileOrder.Mixed
)
.dependsOn(
tools % "it->it;it->test;test->test;compile->compile",
hermes % "it->it;test->test;compile->compile"
)
.configs(IntegrationTest)
lazy val demos = `Demos`
lazy val `Demos` = (project in file("DEVELOPING_OPAL/demos"))
.settings(buildSettings: _*)
.settings(
name := "Demos",
publishArtifact := false,
scalacOptions in (Compile, doc) ++= Opts.doc.title("OPAL - Demos"),
unmanagedSourceDirectories in Compile := (javaSource in Compile).value :: (scalaSource in Compile).value :: Nil,
fork in run := true
)
.dependsOn(framework)
.configs(IntegrationTest)
/* ***************************************************************************
*
* TASKS, etc
*
*/
// To run the task: compile:generateSite
val generateSite = taskKey[File]("creates the OPAL website") in Compile
generateSite := {
lazy val disassemblerJar = (assembly in da).value
lazy val projectSerializerJar = (assembly in Tools).value
val runUnidoc = (unidoc in Compile).value
SiteGeneration.generateSite(
sourceDirectory.value,
resourceManaged.value,
streams.value,
disassemblerJar,
projectSerializerJar
)
}
compile := {
val r = (compile in Compile).value
(generateSite in Compile).value
r
}
//
//
// SETTINGS REQUIRED TO PUBLISH OPAL ON MAVEN CENTRAL
//
//
publishMavenStyle in ThisBuild := true
publishArtifact in Test := false
publishTo in ThisBuild := MavenPublishing.publishTo(isSnapshot.value)
pomExtra in ThisBuild := MavenPublishing.pomNodeSeq()