Skip to content

Commit 9320cd1

Browse files
Support for Scala 2.10 to 2.12
1 parent 61fb705 commit 9320cd1

File tree

7 files changed

+60
-42
lines changed

7 files changed

+60
-42
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: scala
2+
jdk: oraclejdk8
3+
script:
4+
- sbt +test

build.sbt

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@ name := "ascii-graphs"
22

33
organization := "com.github.mdr"
44

5-
version := "0.0.6"
5+
version := "0.0.7-SNAPSHOT"
66

7-
scalaVersion := "2.12.1"
7+
scalaVersion := "2.12.3"
88

9-
crossScalaVersions := Seq("2.9.1", "2.9.2", "2.10.1")
9+
crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.3")
1010

11-
scalacOptions ++= Seq("-deprecation")
11+
scalacOptions ++= Seq(
12+
"-deprecation",
13+
"-encoding",
14+
"UTF-8",
15+
"-feature",
16+
"-unchecked"
17+
)
1218

13-
javacOptions ++= Seq("-source", "1.6", "-target", "1.6")
1419

15-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
16-
17-
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
20+
libraryDependencies ++= Seq(
21+
"org.scalatest" %% "scalatest" % "3.0.1" % Test,
22+
"org.scalacheck" %% "scalacheck" % "1.13.4" % Test
23+
)
1824

1925
// Screen-sized dependency graph:
2026
// libraryDependencies += "org.vert-x" % "vertx-core" % "1.3.1.final"
@@ -27,39 +33,44 @@ EclipseKeys.eclipseOutput := Some("bin")
2733

2834
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
2935

30-
ScalariformKeys.preferences <<= baseDirectory.apply { dir =>
36+
ScalariformKeys.preferences := {
37+
val dir = baseDirectory.value
3138
scalariform.formatter.preferences.PreferencesImporterExporter.loadPreferences((dir / "formatterPreferences.properties").getPath)
3239
}
3340

3441
publishMavenStyle := true
3542

3643
publishArtifact in Test := false
3744

38-
publishTo <<= isSnapshot(
39-
if (_) Some("snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/")
40-
else Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2/"))
41-
42-
pomExtra := {
43-
<inceptionYear>2012</inceptionYear>
44-
<url>http://github.com/mdr/ascii-graphs</url>
45-
<licenses>
46-
<license>
47-
<name>MIT License</name>
48-
<url>http://www.opensource.org/licenses/mit-license.php</url>
49-
<distribution>repo</distribution>
50-
</license>
51-
</licenses>
52-
<scm>
53-
<url>git@github.com:mdr/ascii-graphs.git</url>
54-
<connection>scm:git:git@github.com:mdr/ascii-graphs</connection>
55-
</scm>
56-
<developers>
57-
<developer>
58-
<id>mdr</id>
59-
<name>Matt Russell</name>
60-
<url>https://github.com/mdr/</url>
61-
</developer>
62-
</developers>
45+
publishTo := {
46+
val nexus = "https://oss.sonatype.org/"
47+
if (version.value.trim.endsWith("SNAPSHOT")) {
48+
Some("snapshots" at nexus + "content/repositories/snapshots")
49+
}
50+
else {
51+
Some("releases" at nexus + "service/local/staging/deploy/maven2")
6352
}
53+
}
54+
55+
startYear := Some(2012)
56+
57+
homepage := Some(url("http://github.com/mdr/ascii-graphs"))
58+
59+
scmInfo := Some(
60+
ScmInfo(
61+
url("https://github.com/mdr/ascii-graphs"),
62+
"scm:git:[email protected]:mdr/ascii-graphs.git"
63+
)
64+
)
65+
66+
developers +=
67+
Developer(
68+
"mdr",
69+
"Matt Russell",
70+
71+
url("https://github.com/mdr/")
72+
)
73+
74+
licenses := Seq("MIT License" -> url("http://www.opensource.org/licenses/mit-license.php"))
6475

6576
// scalacOptions in (Compile, doc) += "-diagrams"

project/build.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
sbt.version=0.13.13
2-
1+
sbt.version=0.13.16

src/main/scala/com/github/mdr/ascii/common/Region.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ case class Region(topLeft: Point, bottomRight: Point) extends Translatable[Regio
5757

5858
def points: List[Point] =
5959
for {
60-
row (topRow to bottomRow toList)
60+
row (topRow to bottomRow).toList
6161
column leftColumn to rightColumn
6262
} yield Point(row, column)
6363

src/main/scala/com/github/mdr/ascii/diagram/parser/DiagramImplementation.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ trait DiagramImplementation { self: DiagramParser ⇒
3030
val row = start.row
3131

3232
def points: List[Point] =
33-
for (column start.column to end.column toList)
33+
for (column (start.column to end.column).toList)
3434
yield Point(row, column)
3535

3636
val text: String = {
@@ -62,10 +62,10 @@ trait DiagramImplementation { self: DiagramParser ⇒
6262

6363
def contentsRegion: Region = Region(topLeft.right.down, bottomRight.up.left)
6464

65-
val leftBoundary: List[Point] = for (row topLeft.row to bottomRight.row toList) yield Point(row, topLeft.column)
66-
val rightBoundary: List[Point] = for (row topLeft.row to bottomRight.row toList) yield Point(row, bottomRight.column)
67-
val topBoundary: List[Point] = for (column topLeft.column to bottomRight.column toList) yield Point(topLeft.row, column)
68-
val bottomBoundary: List[Point] = for (column topLeft.column to bottomRight.column toList) yield Point(bottomRight.row, column)
65+
val leftBoundary: List[Point] = for (row (topLeft.row to bottomRight.row).toList) yield Point(row, topLeft.column)
66+
val rightBoundary: List[Point] = for (row (topLeft.row to bottomRight.row).toList) yield Point(row, bottomRight.column)
67+
val topBoundary: List[Point] = for (column (topLeft.column to bottomRight.column).toList) yield Point(topLeft.row, column)
68+
val bottomBoundary: List[Point] = for (column (topLeft.column to bottomRight.column).toList) yield Point(bottomRight.row, column)
6969

7070
val boundaryPoints: Set[Point] = leftBoundary.toSet ++ rightBoundary.toSet ++ topBoundary.toSet ++ bottomBoundary.toSet
7171

src/test/scala/com/github/mdr/ascii/layout/cycles/GraphReflowTest.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import org.scalatest.{FlatSpec, Matchers}
44
import com.github.mdr.ascii.graph.Graph
55
import com.github.mdr.ascii.util.Utils
66

7+
import scala.language.reflectiveCalls
8+
79
class GraphReflowTest extends FlatSpec with Matchers {
810

911
reflowingGraph("""

src/test/scala/com/github/mdr/ascii/layout/layering/LongestDistanceToSinkTest.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.github.mdr.ascii.layout.layering
33
import org.scalatest.{FlatSpec, Matchers}
44
import com.github.mdr.ascii.graph.Graph
55

6+
import scala.language.reflectiveCalls
7+
68
class LongestDistanceToSinkTest extends FlatSpec with Matchers {
79

810
distancesToSinks("""

0 commit comments

Comments
 (0)