fixed sbt build

This commit is contained in:
2017-09-30 11:00:04 +02:00
parent 38d3022be0
commit 1a8219712a

View File

@@ -1,3 +1,5 @@
import java.nio.file.{Files, StandardCopyOption}
import xsbti.compile.CompileAnalysis
name := "jpacrepo"
@@ -40,31 +42,47 @@ libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxb-provider" % "3.0.11
enablePlugins(WarPlugin)
artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
artifact.name + "-" + module.revision + "." + artifact.extension
}
artifactName :=
{ (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
artifact.name + "-" + module.revision + "." + artifact.extension
}
//javacOptions += "-g"
val compileNim = TaskKey[File]("compileNim", "Compile nim code of web interface", KeyRanks.ATask)
compileNim := {
val result = new File("src/main/webapp/jpacrepo.js")
val cmd = s"nim js -d:release -d:serverURL= -o:${result.getPath} nim/jpacrepo.nim"
println(cmd)
sys.process.stringToProcess(cmd).! match
compileNim :=
{
case 0 =>
case _ => throw new RuntimeException("Error occurred during deploy")
val result = new File("nim/nimcache/jpacrepo.js")
val cmd = s"nim js -d:release -d:serverURL= nim/jpacrepo.nim"
println(cmd)
sys.process.stringToProcess(cmd).! match
{
case 0 =>
case _ => throw new RuntimeException("Error occurred during deploy")
}
// val outfile = (baseDirectory.value / "nim" / "nimcache" / "jpacrepo.min.js").toString
// val closureCmd = s"closure-compiler --strict_mode_input=false -O ADVANCED --language_in ECMASCRIPT5 --language_out ECMASCRIPT5 --js_output_file=${outfile} ${result.getAbsolutePath}"
// println(closureCmd)
// sys.process.stringToProcess(closureCmd).! match
// {
// case 0 =>
// case _ => throw new RuntimeException("Error occurred during deploy")
// }
result
}
result
}
//compile in Compile <+= compileNim
packagedArtifact in(Compile, Keys.`package`) := {
val res = (packagedArtifact in(Compile, Keys.`package`)).value
val res2 = compileNim.value
res
}
webappPostProcess :=
{
val baseDir = baseDirectory.value / "nim" / "static"
val nimOutput = compileNim.value
webappDir: File =>
{
IO.copyFile(baseDir / "index.html", webappDir / "index.html")
IO.copyFile(baseDir / "jpacrepo.css", webappDir / "jpacrepo.css")
IO.copyFile(nimOutput, webappDir / "jpacrepo.js")
}
}
val wildflyUsername = SettingKey[String]("wildfly-username", "The account username to use to connect to wildfly with jboss-cli.sh")
val wildflyPassword = SettingKey[String]("wildfly-password", "The account password to use to connect to wildfly with jboss-cli.sh")
@@ -76,7 +94,8 @@ wildflyURL := "localhost:1234"
val deploy2Wildfly = TaskKey[Unit]("deploy2Wildfly", "Deploy to a wildfly server instance", KeyRanks.ATask)
deploy2Wildfly := {
deploy2Wildfly :=
{
val cmd = s"/opt/wildfly/bin/jboss-cli.sh " +
s"--controller='${wildflyURL.value}' " +
s"--connect --user='${wildflyUsername.value}' " +
@@ -88,4 +107,4 @@ deploy2Wildfly := {
case 0 =>
case _ => throw new RuntimeException("Error occurred during deploy")
}
}
}