fixed sbt build
This commit is contained in:
47
build.sbt
47
build.sbt
@@ -1,3 +1,5 @@
|
|||||||
|
import java.nio.file.{Files, StandardCopyOption}
|
||||||
|
|
||||||
import xsbti.compile.CompileAnalysis
|
import xsbti.compile.CompileAnalysis
|
||||||
|
|
||||||
name := "jpacrepo"
|
name := "jpacrepo"
|
||||||
@@ -40,31 +42,47 @@ libraryDependencies += "org.jboss.resteasy" % "resteasy-jaxb-provider" % "3.0.11
|
|||||||
|
|
||||||
enablePlugins(WarPlugin)
|
enablePlugins(WarPlugin)
|
||||||
|
|
||||||
artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
|
artifactName :=
|
||||||
|
{ (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
|
||||||
artifact.name + "-" + module.revision + "." + artifact.extension
|
artifact.name + "-" + module.revision + "." + artifact.extension
|
||||||
}
|
}
|
||||||
|
|
||||||
//javacOptions += "-g"
|
//javacOptions += "-g"
|
||||||
|
|
||||||
val compileNim = TaskKey[File]("compileNim", "Compile nim code of web interface", KeyRanks.ATask)
|
val compileNim = TaskKey[File]("compileNim", "Compile nim code of web interface", KeyRanks.ATask)
|
||||||
compileNim := {
|
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"
|
val result = new File("nim/nimcache/jpacrepo.js")
|
||||||
|
val cmd = s"nim js -d:release -d:serverURL= nim/jpacrepo.nim"
|
||||||
println(cmd)
|
println(cmd)
|
||||||
sys.process.stringToProcess(cmd).! match
|
sys.process.stringToProcess(cmd).! match
|
||||||
{
|
{
|
||||||
case 0 =>
|
case 0 =>
|
||||||
case _ => throw new RuntimeException("Error occurred during deploy")
|
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`) := {
|
webappPostProcess :=
|
||||||
val res = (packagedArtifact in(Compile, Keys.`package`)).value
|
{
|
||||||
val res2 = compileNim.value
|
val baseDir = baseDirectory.value / "nim" / "static"
|
||||||
res
|
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 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")
|
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)
|
val deploy2Wildfly = TaskKey[Unit]("deploy2Wildfly", "Deploy to a wildfly server instance", KeyRanks.ATask)
|
||||||
|
|
||||||
deploy2Wildfly := {
|
deploy2Wildfly :=
|
||||||
|
{
|
||||||
val cmd = s"/opt/wildfly/bin/jboss-cli.sh " +
|
val cmd = s"/opt/wildfly/bin/jboss-cli.sh " +
|
||||||
s"--controller='${wildflyURL.value}' " +
|
s"--controller='${wildflyURL.value}' " +
|
||||||
s"--connect --user='${wildflyUsername.value}' " +
|
s"--connect --user='${wildflyUsername.value}' " +
|
||||||
@@ -88,4 +107,4 @@ deploy2Wildfly := {
|
|||||||
case 0 =>
|
case 0 =>
|
||||||
case _ => throw new RuntimeException("Error occurred during deploy")
|
case _ => throw new RuntimeException("Error occurred during deploy")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user