Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade to Scala 2.10.2

  • Loading branch information...
commit 7838dfc0d71150cca46bb191d7febd6333574910 1 parent e75d1a3
@xerial xerial authored
View
2  .gitignore
@@ -13,7 +13,7 @@ gwt-unitCache
.settings
# sbt specific
-bin/.lib
+.lib
dist/*
target/
lib_managed/
View
BIN  .lib/0.13.0/sbt-launch.jar
Binary file not shown
View
45 project/Build.scala
@@ -1,6 +1,4 @@
-import com.github.siasia.Container
-import com.github.siasia.Container
-import com.github.siasia.PluginKeys._
+
import java.net.InetAddress
import sbt._
import sbt.ExclusionRule
@@ -8,10 +6,12 @@ import sbt.Keys._
import scala.Some
import xerial.sbt.Pack._
import net.thunderklaus.GwtPlugin._
+import com.earldouglas.xsbtwebplugin.PluginKeys._
+import com.earldouglas.xsbtwebplugin.Container
object Build extends sbt.Build {
- val SCALA_VERSION = "2.10.0"
+ val SCALA_VERSION = "2.10.2"
private def profile = System.getProperty("profile", "default")
@@ -91,13 +91,22 @@ object Build extends sbt.Build {
object Dependency {
- private val jettyVer = "6.1.22"
- val jetty = Seq(
- "org.mortbay.jetty" % "jetty" % jettyVer % "container",
- "org.mortbay.jetty" % "jsp-2.0" % jettyVer % "container",
- "org.mortbay.jetty" % "jetty-naming" % jettyVer % "container",
- "org.mortbay.jetty" % "jetty-plus" % jettyVer % "container"
- )
+ val JETTY_VERSION = "7.0.2.v20100331"
+ val jetty = "org.mortbay.jetty" % "jetty-runner" % JETTY_VERSION excludeAll (
+ // Exclude JSP modules if necessary
+ ExclusionRule(organization="org.mortbay.jetty", name="jsp-2.1-glassfish"),
+ ExclusionRule(organization="org.eclipse.jdtj"),
+ ExclusionRule(organization = "org.slf4j")
+ )
+
+
+ val GWT_VERSION = "2.5.1"
+
+ // We need to use an older version of jetty because newer version of jetty embeds ASM3 library,
+ // which conflicts with ASM4 used in ClosureSerializer
+ val jettyContainer = Seq("org.mortbay.jetty" % "jetty-runner" % JETTY_VERSION % "container" )
+
+
val servletLib = Seq("javax.servlet" % "servlet-api" % "2.5" % "provided")
val gwtVer = "2.5.0"
@@ -138,7 +147,7 @@ object Build extends sbt.Build {
packExclude := Seq("utgb"),
publish := {},
publishLocal := {},
- libraryDependencies ++= jetty
+ libraryDependencies ++= jettyContainer
) ++ container.deploy(
"/" -> web.project
)
@@ -157,13 +166,13 @@ object Build extends sbt.Build {
// Add dependent jars here
"org.xerial.java" % "xerial-lens" % "2.1",
"org.xerial.java" % "xerial-storage" % "2.1",
- "org.xerial" % "xerial-lens" % "3.1",
+ "org.xerial" % "xerial-lens" % "3.2.1",
"junit" % "junit" % "4.8.1" % "test",
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
- "org.xerial.snappy" % "snappy-java" % "1.0.5-M3",
+ "org.xerial.snappy" % "snappy-java" % "1.1.0-M4",
"org.apache.velocity" % "velocity" % "1.7",
"org.codehaus.plexus" % "plexus-utils" % "2.0.6" force(),
- "org.utgenome.thirdparty" % "picard" % "1.86p",
+ "org.utgenome.thirdparty" % "picard" % "1.86.0",
"org.xerial" % "sqlite-jdbc" % "3.7.2",
"log4j" % "log4j" % "1.2.17",
"jfree" % "jfreechart" % "1.0.12",
@@ -194,7 +203,7 @@ object Build extends sbt.Build {
lazy val web = Project(
id = "utgb-web",
base = file("utgb-web"),
- settings = buildSettings ++ com.github.siasia.WebappPlugin.webappSettings ++ gwtSettings ++ Seq(
+ settings = buildSettings ++ gwtSettings ++ Seq(
description := "Pre-compiled UTGB war",
gwtVersion := gwtVer,
gwtModules := List("org.utgenome.gwt.utgb.UTGBEntry"),
@@ -203,7 +212,7 @@ object Build extends sbt.Build {
if(sys.props.contains("gwt.expose")) Some(InetAddress.getLocalHost.getHostAddress) else None
},
gwtTemporaryPath <<= (target) { (target) => target / "gwt" },
- com.github.siasia.PluginKeys.webappResources in Compile <+= (target) { (target) => target / "gwt" / "utgb" },
+ webappResources in Compile <+= (target) { (target) => target / "gwt" / "utgb" },
packageBin in Compile <<= (packageBin in Compile).dependsOn(gwtCompile),
javaOptions in Gwt in Compile ++= Seq(
"-localWorkers", cpuToUse.toString, "-strict", "-Xmx3g"
@@ -211,7 +220,7 @@ object Build extends sbt.Build {
javaOptions in Gwt ++= Seq(
"-Xmx1g", "-Dloglevel=debug", "-Dgwt-hosted-mode=true"
),
- libraryDependencies ++= jetty
+ libraryDependencies ++= jettyContainer
)
) dependsOn(core % dependentScope)
View
138 project/GwtPlugin.scala
@@ -3,18 +3,19 @@ package net.thunderklaus
import sbt._
import sbt.Keys._
import java.io.File
-import com.github.siasia.WebPlugin._
-import com.github.siasia.PluginKeys._
+import com.earldouglas.xsbtwebplugin.PluginKeys._
+import com.earldouglas.xsbtwebplugin.Container
+
object GwtPlugin extends Plugin {
lazy val Gwt = config("gwt") extend (Compile)
val gwtModules = TaskKey[Seq[String]]("gwt-modules")
- val gwtCompile = TaskKey[Unit]("gwt-compile", "Runs the GWT compiler")
+ val gwtCompile = TaskKey[Int]("gwt-compile", "Runs the GWT compiler")
val gwtForceCompile = TaskKey[Boolean]("gwt-force-compile", "Always recompile gwt modules")
val gwtDevMode = TaskKey[Unit]("gwt-devmode", "Runs the GWT devmode shell")
- val gwtSuperDevMode = TaskKey[Unit]("gwt-super-devmode", "Runs the GWT super devmode code server")
+ val gwtSuperDevMode = TaskKey[Int]("gwt-superdev", "Runs the GWT super devmode code server")
val gwtVersion = SettingKey[String]("gwt-version")
val gwtTemporaryPath = SettingKey[File]("gwt-temporary-path")
val gwtDevTemporaryPath = SettingKey[File]("gwt-dev-temporary-path")
@@ -23,28 +24,33 @@ object GwtPlugin extends Plugin {
val gwtBindAddress = SettingKey[Option[String]]("gwt-bind-address")
var gwtModule: Option[String] = None
- val gwtSetModule = Command.single("gwt-set-module") { (state, arg) =>
- Project.evaluateTask(gwtModules, state) match {
- case Some(Value(mods)) => {
- gwtModule = mods.find(_.toLowerCase.contains(arg.toLowerCase))
- gwtModule match {
- case Some(m) => println("gwt-devmode will run: " + m)
- case None => println("No match for '" + arg + "' in " + mods.mkString(", "))
- }
- }
- case _ => None
- }
- state
- }
-
- lazy val gwtSettings: Seq[Setting[_]] = webSettings ++ gwtOnlySettings
+// val gwtSetModule = Command.single("gwt-set-module") { (state, arg) =>
+// Project.runTask(gwtModules, state) match {
+// case Some(Value(mods)) => {
+// gwtModule = mods.find(_.toLowerCase.contains(arg.toLowerCase))
+// gwtModule match {
+// case Some(m) => println("gwt-devmode will run: " + m)
+// case None => println("No match for '" + arg + "' in " + mods.mkString(", "))
+// }
+// }
+// case _ => None
+// }
+// state
+// }
+
+ lazy val gwtSettings: Seq[Setting[_]] = com.earldouglas.xsbtwebplugin.WebPlugin.webSettings ++ gwtOnlySettings
lazy val gwtOnlySettings: Seq[Setting[_]] = inConfig(Gwt)(Defaults.configSettings) ++ Seq(
+
managedClasspath in Gwt <<= (managedClasspath in Compile, update) map {
(cp, up) => cp ++ Classpaths.managedJars(Provided, Set("src"), up)
},
- unmanagedClasspath in Gwt <<= (unmanagedClasspath in Compile).identity,
- gwtTemporaryPath <<= (target) { (target) => target / "gwt" },
+ unmanagedClasspath in Gwt := { (unmanagedClasspath in Compile).value },
+ gwtTemporaryPath <<= (target) { (target) =>
+ val t = target / "gwt"
+ t.mkdirs()
+ t
+ },
gwtDevTemporaryPath <<= (target) { (target) =>
val t = target / "gwt-dev"
t.mkdirs()
@@ -52,7 +58,7 @@ object GwtPlugin extends Plugin {
},
gwtBindAddress := None,
gwtWebappPath <<= (baseDirectory) { (bd) => bd / "war" },
- gwtVersion := "2.3.0",
+ gwtVersion := "2.5.1",
gwtForceCompile := false,
gaeSdkPath := None,
libraryDependencies <++= gwtVersion{ v =>
@@ -77,8 +83,8 @@ object GwtPlugin extends Plugin {
gwtModules, gaeSdkPath, gwtWebappPath, streams) map {
(dependencyClasspath, thisProject, pstate, javaSource, javaOpts, gwtModules, gaeSdkPath, warPath, s) => {
def gaeFile (path :String*) = gaeSdkPath.map(_ +: path mkString(File.separator))
- val module = gwtModule.getOrElse(gwtModules.headOption.getOrElse(error("Found no .gwt.xml files.")))
- val cp = dependencyClasspath.map(_.data.absolutePath) ++ getDepSources(thisProject.dependencies, pstate) ++
+ val module = gwtModule.getOrElse(gwtModules.headOption.getOrElse{s.log.error("Found no .gwt.xml files."); ""})
+ val cp = reorderClasspath(dependencyClasspath) ++ getDepSources(thisProject.dependencies, pstate) ++
gaeFile("lib", "appengine-tools-api.jar").toList :+ javaSource.absolutePath
val javaArgs = javaOpts ++ (gaeFile("lib", "agent", "appengine-agent.jar") match {
case None => Nil
@@ -93,24 +99,33 @@ object GwtPlugin extends Plugin {
cp, javaArgs, "com.google.gwt.dev.DevMode", warPath, gwtArgs, module)
s.log.info("Running GWT devmode on: " + module)
s.log.debug("Running GWT devmode command: " + command)
- command !
+ command.!
}
},
- gwtSuperDevMode <<= (dependencyClasspath in Gwt, thisProject in Gwt, state in Gwt, javaSource in Compile, javaOptions in Gwt,
- gwtModules, gaeSdkPath, gwtWebappPath, streams, gwtDevTemporaryPath, gwtBindAddress) map {
- (dependencyClasspath, thisProject, pstate, javaSource, javaOpts, gwtModules, gaeSdkPath, warPath, s, gwtTmp, bindAddress) => {
+ gwtSuperDevMode := {
+// <<= (baseDirectory, dependencyClasspath in Gwt, thisProject in Gwt, state in Gwt, javaSource in Compile, javaOptions in Gwt,
+// gwtModules, gaeSdkPath, gwtWebappPath, streams, gwtDevTemporaryPath, gwtBindAddress) map {
+// (bd, dependencyClasspath, thisProject, pstate, javaSource, javaOpts, gwtModules, gaeSdkPath, warPath, s, gwtTmp, bindAddress) => {
+
+ val bd = baseDirectory.value
+ val depClasspath = (dependencyClasspath in Gwt).value
+ val pstate = (state in Gwt).value
+ val s = streams.value
+ val project = thisProject.value
+ val jSource = (javaSource in Compile).value
val srcDirs =
- for(d <- (Seq(javaSource.absolutePath, "utgb-web/src/main/webapp") ++ getDepSources(thisProject.dependencies, pstate)) map(new File(_)) if d.isDirectory)
+ for(d <- (Seq(jSource.absolutePath) ++ getDepSources(project.dependencies, pstate)) map(new File(_)) if d.isDirectory)
yield d.getAbsolutePath
s.log.info("src dirs:" + srcDirs.mkString(", "))
- def gaeFile (path :String*) = gaeSdkPath.map(_ +: path mkString(File.separator))
- val module = gwtModule.getOrElse(gwtModules.headOption.getOrElse(error("Found no .gwt.xml files.")))
- val srcs = getDepSources(thisProject.dependencies, pstate)
- val cp = dependencyClasspath.map(_.data.absolutePath) ++ srcs ++
- gaeFile("lib", "appengine-tools-api.jar").toList :+ javaSource.absolutePath
- val javaArgs = javaOpts ++ (gaeFile("lib", "agent", "appengine-agent.jar") match {
+ def gaeFile (path :String*) = gaeSdkPath.value.map(_ +: path mkString(File.separator))
+ val module = gwtModule.getOrElse(gwtModules.value.headOption.getOrElse{s.log.error("Found no .gwt.xml files."); "nomodule"})
+ val srcs = getDepSources(project.dependencies, pstate)
+
+ val cp = reorderClasspath(depClasspath) ++ srcs ++
+ gaeFile("lib", "appengine-tools-api.jar").toList :+ jSource.absolutePath
+ val javaArgs = (javaOptions in Gwt).value ++ (gaeFile("lib", "agent", "appengine-agent.jar") match {
case None => Nil
case Some(path) => List("-javaagent:" + path)
})
@@ -121,27 +136,36 @@ object GwtPlugin extends Plugin {
b ++= Seq("-cp", cp.mkString(File.pathSeparator))
b ++= javaArgs
b += "com.google.gwt.dev.codeserver.CodeServer"
- bindAddress map(b ++= Seq("-bindAddress", _))
+ (gwtBindAddress.value) map (b ++= Seq("-bindAddress", _))
b ++= srcDirs.flatMap(Seq("-src", _))
- b ++= Seq("-workDir", gwtTmp.getAbsolutePath)
+ b ++= Seq("-workDir", gwtDevTemporaryPath.value.getAbsolutePath)
b += module
b.result.mkString(" ")
}
val command = mkGwtSuperDevCmd
- s.log.info("Running GWT super dev mode: " + command)
- command !
- }
+ s.log.debug("gwt superdev cmd:\n" + command)
+ s.log.info("Start GWT super dev mode")
+ command.!
},
- gwtCompile <<= (classDirectory in Compile, dependencyClasspath in Gwt, thisProject in Gwt, state in Gwt, javaSource in Compile, javaOptions in Gwt,
- gwtModules, gwtTemporaryPath, streams, gwtForceCompile) map {
+ gwtCompile <<= ((classDirectory in Compile,
+ dependencyClasspath in Gwt,
+ thisProject in Gwt,
+ state in Gwt,
+ javaSource in Compile,
+ javaOptions in Gwt,
+ gwtModules,
+ gwtTemporaryPath,
+ streams,
+ gwtForceCompile) map {
(classDirectory, dependencyClasspath, thisProject, pstate, javaSource, javaOpts, gwtModules, warPath, s, force) => {
val srcDirs = Seq(javaSource.absolutePath) ++ getDepSources(thisProject.dependencies, pstate)
- val cp = Seq(classDirectory.absolutePath) ++
- dependencyClasspath.map(_.data.absolutePath) ++
- srcDirs
+
+ val cp = Seq(classDirectory.absolutePath) ++ reorderClasspath(dependencyClasspath) ++ srcDirs
+
+ s.log.info("GWT output path: " + warPath.absolutePath)
val needToCompile : Boolean = {
s.log.info("Checking GWT module updates: " + gwtModules.mkString(", "))
@@ -157,26 +181,34 @@ object GwtPlugin extends Plugin {
gwtSrcs.find(lastCompiled < _.lastModified).isDefined
}
}
-
if(force || needToCompile) {
+ IO.createDirectory(new File(warPath.absolutePath))
val command = mkGwtCommand(
cp, javaOpts, "com.google.gwt.dev.Compiler", warPath, Nil, gwtModules.mkString(" "))
s.log.info("Compiling GWT modules: " + gwtModules.mkString(","))
s.log.debug("Running GWT compiler command: " + command)
- command !
+ command.!
}
- else
+ else {
s.log.info("GWT modules are up to date")
+ 0
+ }
}
- },
+ }).dependsOn(compile in Compile, copyResources in Compile),
+ unmanagedResourceDirectories in Compile <+= (javaSource in Compile) { (js:File) => js },
+ excludeFilter in Compile in unmanagedResources := "*.java",
webappResources in Compile <+= (gwtTemporaryPath) { (t: File) => t },
+ packageBin in Compile <<= (packageBin in Compile).dependsOn(gwtCompile),
+ packageWar in Compile <<= (packageWar in Compile).dependsOn(gwtCompile)
- packageWar in Compile <<= (packageWar in Compile).dependsOn(gwtCompile),
-
- commands ++= Seq(gwtSetModule)
+ //commands ++= Seq(gwtSetModule)
)
+ def reorderClasspath(cp:Id[Keys.Classpath]) = {
+ val (gwtLibs, others) = cp.map(_.data.absolutePath).partition(_.contains("gwt-"))
+ gwtLibs ++ others
+ }
def getDepSources(deps : Seq[ClasspathDep[ProjectRef]], state : State) : Set[String] = {
@@ -191,7 +223,7 @@ object GwtPlugin extends Plugin {
sources
}
- def setting[T](structure: Load.BuildStructure)(ref: ProjectRef, key: SettingKey[T], configuration: Configuration): Option[T] = key in (ref, configuration) get structure.data
+ def setting[T](structure: BuildStructure)(ref: ProjectRef, key: SettingKey[T], configuration: Configuration): Option[T] = key in (ref, configuration) get structure.data
private def mkGwtCommand(cp: Seq[String], javaArgs: Seq[String], clazz: String, warPath: File,
gwtArgs: Seq[String], modules: String) =
View
15 project/plugins.sbt
@@ -1,16 +1,13 @@
-addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.1.7")
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")
-addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
+addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.7.1")
-addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.6")
+addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.3.1")
+addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.4.1")
-resolvers += "GWT plugin repo" at "http://thunderklaus.github.com/maven"
+addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
-//addSbtPlugin("net.thunderklaus" % "sbt-gwt-plugin" % "1.1-SNAPSHOT")
+scalacOptions ++= Seq("-deprecation", "-feature")
-libraryDependencies += "com.github.siasia" % "xsbt-web-plugin_2.9.2" % "0.12.0-0.2.11.1"
-
-
-addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.0")

0 comments on commit 7838dfc

Please sign in to comment.
Something went wrong with that request. Please try again.