Permalink
Browse files

Cut compatibility with Scala 2.8.x; added cross-build for 2.9.1.RC2

  • Loading branch information...
1 parent 2af88a7 commit 84b6e69f6f3810a4e20df85122636e7b6944cc58 @djspiewak committed Aug 16, 2011
Showing with 21 additions and 44 deletions.
  1. +8 −9 README.rst
  2. +9 −31 build.sbt
  3. +4 −4 src/main/scala/com/codecommit/antixml/Zipper.scala
View
@@ -73,16 +73,15 @@ Supported Versions of Scala
Anti-XML is cross-built_ for the following Scala versions:
-* **2.9.0-1** (0.3-SNAPSHOT release only)
+* **2.9.1.RC2**
+* **2.9.0-1**
* **2.9.0**
-* **2.8.1**
-
-While it is theoretically possible to add support for 2.8.0, we have no plans to
-do so at this time. The reason being that Specs2_ – the testing framework used
-by Anti-XML – has not been cross-built for 2.8.0. Additionally, ScalaCheck_ has
-not updated its 2.8.0 cross-build in several months. All that combined with the
-fact that 2.8.1 is a nearly-completely backwards compatible update with 2.8.0 has
-led to the conclusion that cross-building for 2.8.0 just isn't worth the effort.
+
+Support for the 2.8.x stream is being dropped in version 0.3. It is believed
+that 2.9.x has had sufficient time to mature and there is very little reason to
+continue to work with 2.8.1. However, if there is demand for a 2.8.1 (or 2.8.0)
+compatible release, open an issue and I will manually build a JAR for the appropriate
+version.
.. _cross-built: http://code.google.com/p/simple-build-tool/wiki/CrossBuild
.. _Specs2: http://etorreborre.github.com/specs2/
View
@@ -4,41 +4,18 @@ organization := "com.codecommit"
version := "0.3-SNAPSHOT"
-crossScalaVersions := Seq("2.9.0-1", "2.9.0", "2.8.1")
-
-scalaVersion := "2.9.0-1"
-
-sourceGenerators in Compile <+= (sourceManaged in Compile, scalaVersion, streams) map {
- (dir: File, v, s) =>
- val log = s.log
- log.info("Generating compatibility trait for Scala version %s".format(v))
- val body = if (v startsWith "2.9") {
- """type CompatTraversable[A] = scala.collection.GenTraversableOnce[A]"""
- } else {
- """type CompatTraversable[A] = Traversable[A]"""
- }
- val fullSource =
- """package com.codecommit.antixml {
- | private[antixml] trait ScalaCompat {%s}
- |}
- """.format(body).stripMargin
- val file = dir / "CompatTraversable.scala"
- IO.write(file, fullSource)
- Seq(file)
-}
+crossScalaVersions := Seq("2.9.1.RC2", "2.9.0-1", "2.9.0")
+
+scalaVersion := "2.9.1.RC2"
-libraryDependencies <++= (scalaVersion) { (v) =>
- val scalaVersionString = v match {
- case "2.9.0-1" => "2.9.0"
- case _ => v
- }
+libraryDependencies <++= (scalaVersion) { v =>
Seq(
- "org.scala-tools.testing" % ("scalacheck_" + scalaVersionString) % "1.8" % "test" withSources,
- "org.specs2" %% "specs2" % "1.3" % "test" withSources,
- "com.github.dmlap" %% "sizeof" % "0.1" % "test" from "http://cloud.github.com/downloads/dmlap/jvm-sizeof/jvm-sizeof-0.1.jar"
- )
+ "org.scala-tools.testing" %% "scalacheck" % "1.9" % "test" withSources,
+ "org.specs2" %% "specs2" % "1.5" % "test" withSources,
+ "com.github.dmlap" %% "sizeof" % "0.1" % "test" from "http://cloud.github.com/downloads/dmlap/jvm-sizeof/jvm-sizeof-0.1.jar")
}
+
initialCommands in console := """import com.codecommit.antixml._
|val bookstore = <bookstore><book><title>For Whom the Bell Tolls</title><author>Hemmingway</author></book><book><title>I, Robot</title><author>Isaac Asimov</author></book><book><title>Programming Scala</title><author>Dean Wampler</author><author>Alex Payne</author></book></bookstore>.convert
|val books = bookstore \ "book" """.stripMargin
@@ -91,3 +68,4 @@ publishTo <<= version { (v: String) =>
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
resolvers += ScalaToolsSnapshots
+
@@ -31,10 +31,10 @@ package antixml
import util._
-import scala.collection.IndexedSeqLike
+import scala.collection.{GenTraversable, GenTraversableOnce, IndexedSeqLike}
import scala.collection.generic.{CanBuildFrom, FilterMonadic}
-trait Zipper[+A <: Node] extends Group[A] with IndexedSeqLike[A, Zipper[A]] with ScalaCompat { self =>
+trait Zipper[+A <: Node] extends Group[A] with IndexedSeqLike[A, Zipper[A]] { self =>
// TODO dependently-typed HList, maybe?
protected def map: Vector[Option[ZContext]]
@@ -91,7 +91,7 @@ trait Zipper[+A <: Node] extends Group[A] with IndexedSeqLike[A, Zipper[A]] with
case _ => super.map(f)(cbf)
}
- override def flatMap[B, That](f: A => CompatTraversable[B])(implicit cbf: CanBuildFrom[Zipper[A], B, That]): That = cbf match {
+ override def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit cbf: CanBuildFrom[Zipper[A], B, That]): That = cbf match {
case cbf: CanProduceZipper[Zipper[A], B, That] => {
implicit val cbfwz = cbf.lift
@@ -160,7 +160,7 @@ trait Zipper[+A <: Node] extends Group[A] with IndexedSeqLike[A, Zipper[A]] with
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Zipper[A], B, That]) =
self filter { a => filters forall { _(a) } } map f
- def flatMap[B, That](f: A => CompatTraversable[B])(implicit bf: CanBuildFrom[Zipper[A], B, That]) =
+ def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Zipper[A], B, That]) =
self filter { a => filters forall { _(a) } } flatMap f
def foreach[B](f: A => B) = self foreach f

0 comments on commit 84b6e69

Please sign in to comment.