build.sbt 4.6 KB
Newer Older
1
val tapascoVersion = "2018.2"
2
3
4
5
6
7
8

organization := "de.tu_darmstadt.esa.cs"

version := tapascoVersion

name := "Tapasco"

9
scalaVersion := "2.12.7"
10
11
12
13

libraryDependencies ++= Seq(
  "org.scala-lang" % "scala-compiler" % scalaVersion.value,
  "org.scala-lang" % "scala-reflect" % scalaVersion.value,
14
15
  "org.scala-lang.modules" % "scala-swing_2.12" % "2.0.1",
  "com.typesafe.play" %% "play-json" % "2.6.7" exclude ("ch.qos.logback", "logback-classic"),
16
  "org.jfree" % "jfreechart" % "1.0.19",
17
18
  "org.slf4j" % "slf4j-api" % "1.7.25",
  "ch.qos.logback" % "logback-classic" % "1.2.3",
19
20
21
22
23
  "net.sf.jung" % "jung-api" % "2.1.1",
  "net.sf.jung" % "jung-visualization" % "2.1.1",
  "net.sf.jung" % "jung-graph-impl" % "2.1.1",
  "com.google.guava" % "guava" % "19.0",
  "com.google.code.findbugs" % "jsr305" % "3.0.1",
24
  "org.scalatest" %% "scalatest" % "3.0.4" % "test",
25
  "org.scalacheck" %% "scalacheck" % "1.13.5" % "test",
26
  "com.lihaoyi" %% "fastparse" % "1.0.0"
27
28
29
30
31
32
33
34
35
36
37
38
)

scalacOptions ++= Seq(
  "-feature",
  "-language:postfixOps",
  "-language:reflectiveCalls",
  "-deprecation",
  "-Ywarn-unused-import",
  "-Ywarn-infer-any"
)

scalacOptions in Compile ++= Seq(
39
40
41
  "-opt:inline",
  "-opt:l:inline",
  "-opt-inline-from",
42
43
44
45
46
47
48
  "-opt:unreachable-code",
  "-opt:simplify-jumps",
  "-opt:compact-locals",
  "-opt:copy-propagation",
  "-opt:redundant-casts",
  "-opt:box-unbox",
  "-opt:nullness-tracking",
49
  "-opt:closure-invocations"/*,
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  "-Xelide-below", "3000",
  "-Xdisable-assertions"*/
)

scalacOptions in (Compile,doc) ++= Seq(
  "-diagrams",
  //"-implicits",
  "-implicits-hide:."
)

fork in run := true

val tapasco = inputKey[Unit]("Run Tapasco command.")

val itapasco = InputKey[Unit]("itapasco", "Run interactive Tapasco GUI.")

66
val logviewer = inputKey[Unit]("Run interactive DSE log viewer.")
67

68
val reportviewer = inputKey[Unit]("Run interactive report viewer.")
69

70
tapasco := (runMain in Compile).partialInput (" de.tu_darmstadt.cs.esa.tapasco.Tapasco ").evaluated
71

72
fullRunInputTask(itapasco, Compile, "de.tu_darmstadt.cs.esa.tapasco.Tapasco", "itapasco")
73
74
75
76
77
78
79

fullRunInputTask(logviewer, Compile, "de.tu_darmstadt.cs.esa.tapasco.itapasco.executables.LogViewer")

fullRunInputTask(reportviewer, Compile, "de.tu_darmstadt.cs.esa.tapasco.itapasco.executables.ReportViewer")

fork := true

80
fork in itapasco := true
81

82
fork in Test := false
83
84
85

parallelExecution in Test := false

86
87
88
89
90
91
92
93
94
javaOptions in itapasco += "-splash:icon/tapasco_icon.png"

javaOptions in logviewer += "-splash:icon/tapasco_icon.png"

javaOptions in reportviewer += "-splash:icon/tapasco_icon.png"

test in assembly := {}

assemblyJarName := "Tapasco-" + tapascoVersion + ".jar"
95
96
97

mainClass in assembly := Some("de.tu_darmstadt.cs.esa.tapasco.Tapasco")

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
def writeScripts(jar: String, base: String) {
  val N = scala.util.Properties.lineSeparator
  val basePath = java.nio.file.Paths.get(base)
  val binPath  = basePath.resolve("bin")
  val iconPath = basePath.resolve("icon").resolve("tapasco_icon.png")
  val tapasco  = binPath.resolve("tapasco")
  val itapasco = binPath.resolve("itapasco")
  val logviewer= binPath.resolve("tapasco-logviewer")
  val rptviewer= binPath.resolve("tapasco-reportviewer")

  var f = new java.io.FileWriter(tapasco.toString)
  f.append("#!/bin/bash").append(N)
   .append("java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -jar %s $*".format(jar)).append(N)
  f.close()
  tapasco.toFile.setExecutable(true)

  f = new java.io.FileWriter(itapasco.toString)
  f.append("#!/bin/bash").append(N)
   .append("java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled ")
   .append("-splash:%s ".format(iconPath.toString))
   .append("-jar %s ".format(jar))
   .append("itapasco $*").append(N)
  f.close()
  itapasco.toFile.setExecutable(true)

  f = new java.io.FileWriter(logviewer.toString)
  f.append("#!/bin/bash").append(N)
   .append("cd $TAPASCO_HOME && sbt logviewer $*")
  f.close()
  logviewer.toFile.setExecutable(true)

  f = new java.io.FileWriter(rptviewer.toString)
  f.append("#!/bin/bash").append(N)
   .append("cd $TAPASCO_HOME && sbt reportviewer $*")
  f.close()
  rptviewer.toFile.setExecutable(true)
}

cleanFiles ++= Seq(
  baseDirectory.value / "bin" / "tapasco",
  baseDirectory.value / "bin" / "itapasco",
  baseDirectory.value / "bin" / "tapasco-logviewer",
140
141
  baseDirectory.value / "bin" / "tapasco-reportviewer",
  baseDirectory.value / "tapasco-status-cache"
142
143
144
145
146
147
148
149
150
151
152
153
154
)

lazy val root = (project in file("."))
  .settings(
    assembly := (Def.taskDyn {
      val a = assembly.value
      val jar = target(_ / ("scala-" + scalaBinaryVersion.value) /  assemblyJarName.value)
      Def.task {
        writeScripts(jar.value.toString, baseDirectory.value.toString)
        a
      }
    }).value
  )