-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
51 lines (38 loc) · 1.39 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
name := "sclera-example-scala-jdbc"
description := "Sclera JDBC Example and Template - Scala version"
version := "4.0-SNAPSHOT"
homepage := Some(url("https://github.com/scleradb/sclera-example-scala-jdbc"))
scalaVersion := "2.13.1"
licenses := Seq("MIT License" -> url("https://opensource.org/licenses/MIT"))
libraryDependencies ++= Seq(
"com.scleradb" %% "sclera-config" % "4.0",
"com.scleradb" %% "sclera-core" % "4.0",
"com.scleradb" %% "sclera-jdbc" % "4.0"
)
scalacOptions ++= Seq(
"-Werror", "-feature", "-deprecation", "-unchecked"
)
val mkscript = taskKey[File]("Create executable script")
mkscript := {
val cp = (fullClasspath in Test).value
val mainClassStr = (mainClass in Runtime).value getOrElse sys.error(
"main class not found"
)
val (template, scriptName) =
if( System.getProperty("os.name").startsWith("Windows") ) (
"""|@ECHO OFF
|java -Xmx512m -classpath "%%CLASSPATH%%:%s" %s %%*
|""".stripMargin,
"scleraexample.cmd"
) else (
"""|#!/bin/sh
|java -Xmx512m -classpath "$CLASSPATH:%s" %s $@
|""".stripMargin,
"scleraexample"
)
val contents = template.format(cp.files.absString, mainClassStr)
val out = baseDirectory.value / "bin" / scriptName
IO.write(out, contents)
out.setExecutable(true)
out
}