Skip to content

Instantly share code, notes, and snippets.

@mccv
Created October 4, 2010 04:03
Show Gist options
  • Save mccv/609240 to your computer and use it in GitHub Desktop.
Save mccv/609240 to your computer and use it in GitHub Desktop.
import sbt._
import com.twitter.sbt._
class OstrichProject(info: ProjectInfo) extends StandardProject(info) with TartifactoryPublisher with TartifactoryRepos {
val specs = "org.scala-tools.testing" % "specs" % "1.6.2.1"
val vscaladoc = "org.scala-tools" % "vscaladoc" % "1.1-md-3"
val twitterJson = "com.twitter" % "json" % "1.1.2"
// we declare a dependencies source location by adding an extra attribute
val configgy = "net.lag" % "configgy" % "1.5.5" extra(("source", "../configgy"))
val commonsLogging = "commons-logging" % "commons-logging" % "1.1"
val commonsLang = "commons-lang" % "commons-lang" % "2.2"
val mockito = "org.mockito" % "mockito-core" % "1.8.1"
val hamcrest = "org.hamcrest" % "hamcrest-all" % "1.1"
val xrayspecs = "com.twitter" % "xrayspecs" % "1.0.7"
val cglib = "cglib" % "cglib" % "2.1_3"
val asm = "asm" % "asm" % "1.5.3"
val objenesis = "org.objenesis" % "objenesis" % "1.1"
val netty = "org.jboss.netty" % "netty" % "3.1.5.GA"
override def pomExtra =
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
def sourcePathFromModule(moduleId: ModuleID): Option[String] = {
// apparently sbt-defined extra attributes are namespaced with e:?
moduleId.extraAttributes.find(_._1 == "e:source") match {
case Some((attr, value)) => Some(value)
case _ => None
}
}
lazy val updateFromSourceAction = task {
import Process._
libraryDependencies.foreach(dep => {
sourcePathFromModule(dep).foreach(path => {
log.info("updating %s from sources".format(path))
// note the awesome error checking here
( (new java.lang.ProcessBuilder("sbt", "update publish-local")) directory new java.io.File(path) )!
})
})
None
}
lazy val updateFromSource = updateFromSourceAction describedAs("Update dependencies from their sources")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment