forked from KarolS/millfork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
97 lines (81 loc) · 3.47 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
name := "millfork"
version := "0.3.31-SNAPSHOT"
// keep it at 2.12.11 for GraalVM native image compatibility!
scalaVersion := "2.12.11"
resolvers += Resolver.mavenLocal
libraryDependencies += "com.lihaoyi" %% "fastparse" % "1.0.0"
libraryDependencies += "org.apache.commons" % "commons-configuration2" % "2.2"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % "test"
val testDependencies = Seq(
"com.codingrodent.microprocessor" % "Z80Processor" % "2.0.2" % "test",
// see: https://github.com/NeatMonster/Intel8086
"NeatMonster" % "Intel8086" % "1.0" % "test" from "https://github.com/NeatMonster/Intel8086/raw/master/IBMPC.jar",
// these three are not in Maven Central or any other public repo
// get them from the following links or just build millfork without tests:
// https://github.com/sethm/symon/tree/71905fdb1998ee4f142260879504bc46cf27648f
// https://github.com/andrew-hoffman/halfnes/tree/061
// https://github.com/trekawek/coffee-gb/tree/coffee-gb-1.0.0
// https://github.com/sorenroug/osnine-java/tree/b77349a6c314e1362e69b7158c385ac6f89b7ab8
"com.loomcom.symon" % "symon" % "1.3.0-SNAPSHOT" % "test",
"com.grapeshot" % "halfnes" % "061" % "test",
"eu.rekawek.coffeegb" % "coffee-gb" % "1.0.0" % "test",
"roug.org.osnine" % "osnine-core" % "2.0-SNAPSHOT" % "test",
"org.graalvm.sdk" % "graal-sdk" % "20.2.0" % "test",
"org.graalvm.js" % "js" % "20.2.0" % "test",
"org.graalvm.js" % "js-scriptengine" % "20.2.0" % "test"
)
val includesTests = System.getProperty("skipTests") == null
libraryDependencies ++=(
if (includesTests) {
println("Including test dependencies")
testDependencies
} else {
Seq[ModuleID]()
}
)
(if (!includesTests) {
// Disable assembling tests
sbt.internals.DslEntry.fromSettingsDef(test in assembly := {})
} else {
sbt.internals.DslEntry.fromSettingsDef(Seq[sbt.Def.Setting[_]]())
})
mainClass in Compile := Some("millfork.Main")
assemblyJarName := "millfork.jar"
lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "millfork.buildinfo"
)
import sbtassembly.AssemblyKeys
val releaseDist = TaskKey[File]("release-dist", "Creates a distributable zip file.")
releaseDist := {
val jar = AssemblyKeys.assembly.value
val base = Keys.baseDirectory.value
val target = Keys.target.value
val name = Keys.name.value
val version = Keys.version.value
val distDir = target / (name + "-" + version)
val releasesDir = base / "releases"
val zipFile = releasesDir / (name + "-" + version + ".zip")
IO.delete(zipFile)
IO.delete(distDir)
IO.createDirectory(releasesDir)
IO.createDirectory(distDir)
IO.copyFile(jar, distDir / jar.name)
IO.copyFile(base / "LICENSE", distDir / "LICENSE")
IO.copyFile(base / "src/3rd-party-licenses.txt", distDir / "3rd-party-licenses.txt")
IO.copyFile(base / "CHANGELOG.md", distDir / "CHANGELOG.md")
IO.copyFile(base / "README.md", distDir / "README.md")
IO.copyFile(base / "COMPILING.md", distDir / "COMPILING.md")
def copyDir(name: String): Unit = {
IO.createDirectory(distDir / name)
IO.copyDirectory(base / name, distDir / name)
}
copyDir("include")
copyDir("docs")
def entries(f: File): List[File] = f :: (if (f.isDirectory) IO.listFiles(f).toList.flatMap(entries) else Nil)
IO.zip(entries(distDir).map(d => (d, d.getAbsolutePath.substring(distDir.getParent.length + 1))), zipFile)
IO.delete(distDir)
zipFile
}