Move to sbt 1.0

This commit is contained in:
Naoki Takezoe
2017-09-20 15:05:44 +09:00
parent 4d3756ac0a
commit 1a9982446f
5 changed files with 18 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ val GitBucketVersion = "4.17.0-SNAPSHOT"
val ScalatraVersion = "2.5.0"
val JettyVersion = "9.3.19.v20170502"
lazy val root = (project in file(".")).enablePlugins(SbtTwirl, JettyPlugin)
lazy val root = (project in file(".")).enablePlugins(SbtTwirl, ScalatraPlugin, JRebelPlugin)
sourcesInBase := false
organization := Organization
@@ -87,17 +87,17 @@ assemblyMergeStrategy in assembly := {
}
// JRebel
Seq(jrebelSettings: _*)
//Seq(jrebelSettings: _*)
jrebel.webLinks += (target in webappPrepare).value
jrebel.enabled := System.getenv().get("JREBEL") != null
//jrebel.webLinks += (target in webappPrepare).value
//jrebel.enabled := System.getenv().get("JREBEL") != null
javaOptions in Jetty ++= Option(System.getenv().get("JREBEL")).toSeq.flatMap { path =>
Seq("-noverify", "-XX:+UseConcMarkSweepGC", "-XX:+CMSClassUnloadingEnabled", s"-javaagent:${path}")
Seq("-noverify", "-XX:+UseConcMarkSweepGC", "-XX:+CMSClassUnloadingEnabled", s"-javaagent:${path}")
}
// Create executable war file
val executableConfig = config("executable").hide
Keys.ivyConfigurations += executableConfig
val ExecutableConfig = config("executable-config").hide
Keys.ivyConfigurations += ExecutableConfig
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-security" % JettyVersion % "executable",
"org.eclipse.jetty" % "jetty-webapp" % JettyVersion % "executable",
@@ -126,7 +126,7 @@ executableKey := {
IO delete temp
// include jetty classes
val jettyJars = Keys.update.value select configurationFilter(name = executableConfig.name)
val jettyJars = Keys.update.value select configurationFilter(name = ExecutableConfig.name)
jettyJars foreach { jar =>
IO unzip (jar, temp, (name:String) =>
(name startsWith "javax/") ||
@@ -158,17 +158,17 @@ executableKey := {
s"https://github.com/gitbucket/${plugin}/releases/download/${version}/${plugin}_${scalaBinaryVersion.value}-${version}.jar"
}
log info s"Download: ${url}"
IO download(new java.net.URL(url), pluginsDir / s"${plugin}_${scalaBinaryVersion.value}-${version}.jar")
IO transfer(new java.net.URL(url).openStream, pluginsDir / s"${plugin}_${scalaBinaryVersion.value}-${version}.jar")
}
// zip it up
IO delete (temp / "META-INF" / "MANIFEST.MF")
val contentMappings = (temp.*** --- PathFinder(temp)).get pair relativeTo(temp)
val contentMappings = (temp.allPaths --- PathFinder(temp)).get pair { file => IO.relativizeFile(temp, file) }
val manifest = new JarManifest
manifest.getMainAttributes put (AttrName.MANIFEST_VERSION, "1.0")
manifest.getMainAttributes put (AttrName.MAIN_CLASS, "JettyLauncher")
val outputFile = workDir / warName
IO jar (contentMappings, outputFile, manifest)
IO jar (contentMappings.map { case (file, path) => (file, path.toString) } , outputFile, manifest)
// generate checksums
Seq(

View File

@@ -1,12 +1,13 @@
import java.security.MessageDigest
import scala.annotation._
import sbt._
import io._
object Checksums {
private val bufferSize = 2048
def generate(source:File, target:File, algorithm:String):Unit =
IO write (target, compute(source, algorithm))
sbt.IO write (target, compute(source, algorithm))
def compute(file:File, algorithm:String):String =
hex(raw(file, algorithm))

View File

@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=1.0.2

View File

@@ -2,7 +2,8 @@ scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.3.7")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.0.0")
addSbtPlugin("fi.gekkio.sbtplugins" % "sbt-jrebel-plugin" % "0.10.0")
//addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.0.0")
//addSbtPlugin("fi.gekkio.sbtplugins" % "sbt-jrebel-plugin" % "0.10.0")
addSbtPlugin("org.scalatra.sbt" % "sbt-scalatra" % "1.0.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC11")

View File

@@ -1 +1 @@
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M15")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC11")