Skip to content
Browse files

Using sbt 0.13

Changed build configuration (now accepts the cmd-line-arg `guavaVersion`)
Changed travis-ci configuration to build against different versions of guava
  • Loading branch information...
1 parent 3859924 commit 00caead13fd724deb9a100c03e5da4e071312e65 @mschneiderwng mschneiderwng committed
Showing with 151 additions and 129 deletions.
  1. +1 −0 .gitignore
  2. +6 −0 .travis.yml
  3. +0 −108 build.sbt
  4. +86 −0 project/Build.scala
  5. +28 −0 project/Dependencies.scala
  6. +23 −0 project/Shell.scala
  7. +1 −0 project/build.properties
  8. +0 −21 project/plugins.sbt
  9. +2 −0 project/sbteclipse.sbt
  10. +4 −0 project/sbtpgp.sbt
View
1 .gitignore
@@ -6,3 +6,4 @@ project/boot/
.cache
.worksheet
.settings
+.history
View
6 .travis.yml
@@ -3,3 +3,9 @@ scala:
- "2.10.0"
- "2.10.1"
- "2.10.2"
+jdk:
+ - openjdk7
+ - oraclejdk7
+env:
+ - GUAVA_VERSION=14.0
+ - GUAVA_VERSION=14.0.1
View
108 build.sbt
@@ -1,108 +0,0 @@
-//
-// Copyright (C) 2013 The Mango Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-name := "mango"
-
-organization := "org.feijoas"
-
-version := "0.8"
-
-scalaVersion := "2.10.2"
-
-sbtVersion := "0.12"
-
-// resolvers
-resolvers += Classpaths.typesafeSnapshots
-
-resolvers ++= Seq(
- "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
- "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases"
-)
-
-// compile dependencies
-libraryDependencies += "com.google.guava" % "guava" % "14.0.1"
-
-libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+"
-
-// test dependencies
-libraryDependencies += "com.google.guava" % "guava-testlib" % "14.0.1" % "test"
-
-libraryDependencies += "junit" % "junit" % "4.11" % "test"
-
-libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.0.M5b" % "test"
-
-libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" % "test"
-
-libraryDependencies += "org.scalamock" %% "scalamock-scalatest-support" % "3.0.1" % "test"
-
-libraryDependencies += "org.mockito" % "mockito-core" % "1.9.5" % "test"
-
-// Scala compiler options
-scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-language:implicitConversions,reflectiveCalls,postfixOps,higherKinds,existentials")
-
-// Scaladoc title
-scalacOptions in (Compile, doc) ++= Opts.doc.title("Mango")
-
-// Scaladoc title page
-scalacOptions in (Compile, doc) ++= Seq("-doc-root-content", "rootdoc.txt")
-
-// Show durations for tests
-testOptions in Test += Tests.Argument("-oD")
-
-// Disable parallel execution of tests
-parallelExecution in Test := false
-
-// Using the Scala version in output paths and artifacts
-crossPaths := true
-
-// publish test jar, sources, and docs
-publishArtifact in Test := false
-
-// Publish Maven style
-publishMavenStyle := true
-
-// Remove the repositories for optional dependencies
-pomIncludeRepository := { _ => false }
-
-// SNAPSHOT versions go to the /snapshot repository while other versions go to the /releases repository
-publishTo <<= version { (v: String) =>
- val nexus = "https://oss.sonatype.org/"
- if (v.trim.endsWith("SNAPSHOT"))
- Some("snapshots" at nexus + "content/repositories/snapshots")
- else
- Some("releases" at nexus + "service/local/staging/deploy/maven2")
-}
-
-// POM metadata that isn't generated by SBT
-pomExtra := (
- <url>mango.feijoas.org</url>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <url>https://github.com/feijoas/mango.git</url>
- <connection>https://github.com/feijoas/mango.git</connection>
- </scm>
- <developers>
- <developer>
- <id>mschneiderwng</id>
- <name>Markus Schneider</name>
- </developer>
- </developers>)
View
86 project/Build.scala
@@ -0,0 +1,86 @@
+import sbt._
+import Keys._
+import Dependencies._
+
+object BuildSettings {
+
+ val buildOrganization = "org.feijoas"
+ val buildVersion = "0.9"
+ val buildScalaVersion = "2.10.2"
+ val gitHeadCommitSha = Process("git rev-parse HEAD").lines.head
+
+ val buildSettings = Defaults.defaultSettings ++ Seq (
+ organization := buildOrganization,
+ version := buildVersion + "-" + gitHeadCommitSha,
+ scalaVersion := buildScalaVersion,
+ shellPrompt := ShellPrompt.buildShellPrompt,
+ // Scala compiler options
+ scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-feature","-language:implicitConversions,reflectiveCalls,postfixOps,higherKinds,existentials"),
+ // Scaladoc title
+ scalacOptions in (Compile, doc) ++= Opts.doc.title("Mango"),
+ // Scaladoc title page
+ scalacOptions in (Compile, doc) ++= Seq("-doc-root-content", "rootdoc.txt"),
+ // Show durations for tests
+ testOptions in Test += Tests.Argument("-oD"),
+ // Disable parallel execution of tests
+ parallelExecution in Test := false,
+ // Using the Scala version in output paths and artifacts
+ crossPaths := true,
+ // publish test jar, sources, and docs
+ publishArtifact in Test := false,
+ // Publish Maven style,
+ publishMavenStyle := true,
+ // Remove the repositories for optional dependencies
+ pomIncludeRepository := { _ => false },
+ // POM metadata that isn't generated by SBT
+ pomExtra := (
+ <url>mango.feijoas.org</url>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <url>https://github.com/feijoas/mango.git</url>
+ <connection>https://github.com/feijoas/mango.git</connection>
+ </scm>
+ <developers>
+ <developer>
+ <id>mschneiderwng</id>
+ <name>Markus Schneider</name>
+ </developer>
+ </developers>),
+ // SNAPSHOT versions go to the /snapshot repository while other versions go to the /releases repository
+ publishTo <<= version { (v: String) =>
+ val nexus = "https://oss.sonatype.org/"
+ if (v.trim.endsWith("SNAPSHOT"))
+ Some("snapshots" at nexus + "content/repositories/snapshots")
+ else
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
+ }
+ )
+}
+
+object Resolvers {
+ val sonatypeSnapshot = "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots"
+ val sonatypeRelease = "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases"
+ val sonatypeResolvers = Seq (sonatypeRelease, sonatypeSnapshot)
+}
+
+object MangoBuild extends Build {
+
+ import Resolvers._
+ import Dependencies._
+ import BuildSettings._
+
+ lazy val mango = Project(
+ "mango",
+ file("."),
+ settings = buildSettings ++ Seq (
+ resolvers ++= sonatypeResolvers,
+ libraryDependencies ++= deps
+ )
+ )
+}
View
28 project/Dependencies.scala
@@ -0,0 +1,28 @@
+import sbt._
+import Keys._
+
+object Dependencies {
+ // this version of guava is used if no cmd-arg is given
+ val guavaDefaulVersion = "14.0.1"
+
+ // set guava version by cmd-arg or default
+ val guavaVersion = {
+ val arg = System.getenv("GUAVA_VERSION")
+ if(arg != null) arg
+ else guavaDefaulVersion
+ }
+
+ // compile dependencies
+ val guava = "com.google.guava" % "guava" % guavaVersion
+ val findbugs = "com.google.code.findbugs" % "jsr305" % "1.3.+"
+
+ // test dependencies
+ val guavaTestlib = "com.google.guava" % "guava-testlib" % "14.0.1" % "test"
+ val junit = "junit" % "junit" % "4.11" % "test"
+ val scalatest = "org.scalatest" % "scalatest_2.10" % "2.0.M5b" % "test"
+ val scalacheck = "org.scalacheck" %% "scalacheck" % "1.10.0" % "test"
+ val scalamock = "org.scalamock" %% "scalamock-scalatest-support" % "3.0.1" % "test"
+ val mockito = "org.mockito" % "mockito-core" % "1.9.5" % "test"
+
+ val deps = Seq(guava, findbugs, guavaTestlib, junit, scalatest, scalacheck, scalamock, mockito)
+}
View
23 project/Shell.scala
@@ -0,0 +1,23 @@
+import sbt._
+import Keys._
+
+// Shell prompt which show the current project,
+// git branch and build version
+object ShellPrompt {
+ object devnull extends ProcessLogger {
+ def info (s: => String) {}
+ def error (s: => String) { }
+ def buffer[T] (f: => T): T = f
+ }
+ def currBranch = (
+ ("git status -sb" lines_! devnull headOption)
+ getOrElse "-" stripPrefix "## "
+ )
+
+ val buildShellPrompt = {
+ (state: State) => {
+ val currProject = Project.extract (state).currentProject.id
+ "%s:%s:%s> ".format (currProject, currBranch, BuildSettings.buildVersion)
+ }
+ }
+}
View
1 project/build.properties
@@ -0,0 +1 @@
+sbt.version=0.13.0
View
21 project/plugins.sbt
@@ -1,21 +0,0 @@
-//
-// Copyright (C) 2013 The Mango Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// Eclipse support
-addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.2")
-
-// Sign artifacts
-addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
View
2 project/sbteclipse.sbt
@@ -0,0 +1,2 @@
+// Eclipse support
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.3.0")
View
4 project/sbtpgp.sbt
@@ -0,0 +1,4 @@
+// Sign artifacts
+resolvers += Classpaths.typesafeSnapshots
+
+addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")

0 comments on commit 00caead

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