Permalink
Browse files

upgrade sbt

  • Loading branch information...
1 parent 7975af7 commit 9989d0cb1269ee53a6a18344298a36ede96730ee Ryan King committed Jul 11, 2012
Showing with 128 additions and 93 deletions.
  1. +2 −0 .gitignore
  2. +60 −0 project/Build.scala
  3. +0 −9 project/build.properties
  4. +0 −54 project/build/Snowflake.scala
  5. +24 −0 project/plugins.sbt
  6. +0 −20 project/plugins/Plugins.scala
  7. +0 −10 project/versions.properties
  8. +42 −0 sbt
View
@@ -11,3 +11,5 @@ lib_managed
project/boot
.DS_Store
src_managed
+sbt-launch.jar
+.classpath.txt
View
@@ -0,0 +1,60 @@
+import sbt._
+import Keys._
+import com.twitter.sbt._
+
+object Snowflake extends Build {
+ val utilVersion = "5.2.0"
+
+ val sharedSettings = Seq(
+ version := "5.1.1-SNAPSHOT",
+ organization := "com.twitter",
+ SubversionPublisher.subversionRepository := Some("https://svn.twitter.biz/maven-public"),
+ libraryDependencies ++= Seq(
+ "org.scala-tools.testing" %% "specs" % "1.6.9" % "test" withSources(),
+ "junit" % "junit" % "4.8.1" % "test" withSources(),
+ "org.mockito" % "mockito-all" % "1.8.5" % "test" withSources()
+ ),
+ resolvers += "twitter-repo" at "http://maven.twttr.com",
+
+ ivyXML :=
+ <dependencies>
+ <exclude org="com.sun.jmx" module="jmxri" />
+ <exclude org="com.sun.jdmk" module="jmxtools" />
+ <exclude org="javax.jms" module="jms" />
+ </dependencies>,
+
+ scalacOptions ++= Seq("-encoding", "utf8"),
+ scalacOptions += "-deprecation",
+
+ // This is bad news for things like com.twitter.util.Time
+ parallelExecution in Test := false,
+
+ // This effectively disables packageDoc, which craps out
+ // on generating docs for generated thrift due to the use
+ // of raw java types.
+ packageDoc in Compile := new java.io.File("nosuchjar"),
+
+ unmanagedResourceDirectories in Compile <+= baseDirectory{ _ / "config"}
+ )
+
+ lazy val finagleCore = Project(
+ id = "snowflake",
+ base = file("."),
+ settings = Project.defaultSettings ++
+ StandardProject.newSettings ++
+ CompileThrift.newSettings ++
+ sharedSettings
+ ).settings(
+ name := "snowflake",
+ libraryDependencies ++= Seq(
+ "commons-codec" % "commons-codec" % "1.4",
+ "org.slf4j" % "slf4j-api" % "1.5.8",
+ "org.slf4j" % "slf4j-nop" % "1.5.8",
+ "thrift" % "libthrift" % "0.5.0",
+ "com.twitter" % "ostrich" % "8.2.0",
+ "com.twitter" % "scala-zookeeper-client" % "3.0.6",
+ "com.twitter" % "util-logging" % "5.3.0",
+ "com.twitter" % "util-thrift" % "5.3.0"
+ )
+ )
+}
View
@@ -1,9 +0,0 @@
-#
-#Tue Mar 16 15:33:33 PDT 2010
-project.name=snowflake
-project.organization=com.twitter.service
-project.version=1.0.1-SNAPSHOT
-sbt.version=0.7.4
-def.scala.version=2.7.7
-build.scala.versions=2.8.1
-project.initialize=false
@@ -1,54 +0,0 @@
-import sbt._
-import com.twitter.sbt._
-import Process._
-
-class SnowflakeProject(info: ProjectInfo) extends StandardServiceProject(info)
- with DefaultRepos
- with CompileThriftJava
- with CompileThriftRuby
- with ProjectDependencies
- with NoisyDependencies {
- val slf4jApi = "org.slf4j" % "slf4j-api" % "1.5.8"
- val slf4jLog = "org.slf4j" % "slf4j-nop" % "1.5.8"
- val sp = "org.scala-tools.testing" % "specs_2.8.1" % "1.6.8"
- val thrift = "thrift" % "libthrift" % "0.5.0"
- val commonsCodec = "commons-codec" % "commons-codec" % "1.4"
-
- projectDependencies(
- "ostrich",
- "util" ~ "util-logging",
- "util" ~ "util-thrift",
- "scala-zookeeper-client"
- )
-
- override def ivyXML =
- <dependencies>
- <exclude module="jms"/>
- <exclude module="jmxtools"/>
- <exclude module="jmxri"/>
- <exclude org="apache-log4j"/>
- <override org="junit" rev="4.8.1"/>
- </dependencies>
-
- 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>
-
- // generate a jar of just the thrift classes.
- def clientPaths = (mainCompilePath ##) / "com" / "twitter" / "service" / "snowflake" / "gen" ** "*.class"
- def packageClientAction = packageTask(clientPaths, outputPath, "snowflake-" + version.toString + "-thrift.jar", packageOptions).dependsOn(compile)
- lazy val packageClient = packageClientAction
-
- override def packageAction = super.packageAction.dependsOn(packageClientAction)
- override def artifacts = Set(Artifact("snowflake", "thrift"))
-
- override def testResources =
- descendents(testResourcesPath ##, "*") +++
- descendents(info.projectPath / "config" ##, "*")
-
-}
View
@@ -0,0 +1,24 @@
+sbtResolver <<= (sbtResolver) { r =>
+ Option(System.getenv("SBT_PROXY_REPO")) map { x =>
+ Resolver.url("proxy repo for sbt", url(x))(Resolver.ivyStylePatterns)
+ } getOrElse r
+}
+
+resolvers <<= (resolvers) { r =>
+ (Option(System.getenv("SBT_PROXY_REPO")) map { url =>
+ Seq("proxy-repo" at url)
+ } getOrElse {
+ r ++ Seq(
+ "twitter.com" at "http://maven.twttr.com/",
+ "scala-tools" at "http://scala-tools.org/repo-releases/",
+ "maven" at "http://repo1.maven.org/maven2/",
+ "freemarker" at "http://freemarker.sourceforge.net/maven2/"
+ )
+ }) ++ Seq("local" at ("file:" + System.getProperty("user.home") + "/.m2/repo/"))
+}
+
+externalResolvers <<= (resolvers) map identity
+
+addSbtPlugin("com.twitter" % "sbt-package-dist" % "1.0.5")
+
+addSbtPlugin("com.twitter" % "sbt-thrift2" % "0.0.1")
@@ -1,20 +0,0 @@
-import sbt._
-
-class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
- import scala.collection.jcl
- val environment = jcl.Map(System.getenv())
- def isSBTOpenTwitter = environment.get("SBT_OPEN_TWITTER").isDefined
- def isSBTTwitter = environment.get("SBT_TWITTER").isDefined
-
- override def repositories = if (isSBTOpenTwitter) {
- Set("twitter.artifactory" at "http://artifactory.local.twitter.com/open-source/")
- } else if (isSBTTwitter) {
- Set("twitter.artifactory" at "http://artifactory.local.twitter.com/repo/")
- } else {
- super.repositories ++ Seq("twitter.com" at "http://maven.twttr.com/")
- }
- override def ivyRepositories = Seq(Resolver.defaultLocal(None)) ++ repositories
-
- val defaultProject = "com.twitter" % "standard-project" % "1.0.4"
- val sbtThrift = "com.twitter" % "sbt-thrift" % "2.0.1"
-}
@@ -1,10 +0,0 @@
-#Automatically generated by ProjectDependencies
-#Thu Apr 05 13:53:06 PDT 2012
-com.twitter/scala-zookeeper-client=3.0.4
-util|util-logging=com.twitter/util-logging
-ostrich|ostrich=com.twitter/ostrich
-com.twitter/ostrich=6.0.0
-scala-zookeeper-client|scala-zookeeper-client=com.twitter/scala-zookeeper-client
-com.twitter/util-logging=3.0.0
-util|util-thrift=com.twitter/util-thrift
-com.twitter/util-thrift=3.0.0
View
42 sbt
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+root=$(
+ cd $(dirname $(readlink $0 || echo $0))/..
+ /bin/pwd
+)
+
+sbtjar=sbt-launch.jar
+
+if [ ! -f $sbtjar ]; then
+ echo 'downloading '$sbtjar 1>&2
+ curl -O http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.2/$sbtjar
+fi
+
+test -f $sbtjar || exit 1
+
+sbtjar_md5=$(openssl md5 < $sbtjar|cut -f2 -d'='|awk '{print $1}')
+
+if [ "${sbtjar_md5}" != 2886cc391e38fa233b3e6c0ec9adfa1e ]; then
+ echo 'bad sbtjar!' 1>&2
+ exit 1
+fi
+
+test -f ~/.sbtconfig && . ~/.sbtconfig
+
+java -ea \
+ $SBT_OPTS \
+ $JAVA_OPTS \
+ -Djava.net.preferIPv4Stack=true \
+ -XX:+AggressiveOpts \
+ -XX:+UseParNewGC \
+ -XX:+UseConcMarkSweepGC \
+ -XX:+CMSParallelRemarkEnabled \
+ -XX:+CMSClassUnloadingEnabled \
+ -XX:MaxPermSize=1024m \
+ -XX:SurvivorRatio=128 \
+ -XX:MaxTenuringThreshold=0 \
+ -Xss8M \
+ -Xms512M \
+ -Xmx3G \
+ -server \
+ -jar $sbtjar "$@"

0 comments on commit 9989d0c

Please sign in to comment.