Skip to content

Commit c9a45dc

Browse files
committed
Switch from generating scala.collection.Seq to immutable.Seq
This seems like the most reasonable choice and works better with the default scala.Seq in 2.13.
1 parent a7ff9d3 commit c9a45dc

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

src/main/scala/sbtbuildinfo/ScalaRenderer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ abstract class ScalaRenderer extends BuildInfoRenderer {
2727

2828
case TypeExpression("scala.Option", Seq(arg)) =>
2929
tpeToReturnType(arg) map { x => s"scala.Option[$x]" }
30-
case TypeExpression("scala.collection.Seq", Seq(arg)) =>
31-
tpeToReturnType(arg) map { x => s"scala.collection.Seq[$x]" }
30+
case TypeExpression("scala.collection.immutable.Seq", Seq(arg)) =>
31+
tpeToReturnType(arg) map { x => s"scala.collection.immutable.Seq[$x]" }
3232
case TypeExpression("scala.collection.immutable.Map", Seq(arg0, arg1)) =>
3333
for {
3434
x0 <- tpeToReturnType(arg0)
@@ -50,7 +50,7 @@ abstract class ScalaRenderer extends BuildInfoRenderer {
5050
case node: scala.xml.NodeSeq if node.toString().trim.nonEmpty => node.toString()
5151
case (k, _v) => "(%s -> %s)" format(quote(k), quote(_v))
5252
case mp: Map[_, _] => mp.toList.map(quote(_)).mkString("Map(", ", ", ")")
53-
case seq: Seq[_] => seq.map(quote).mkString("scala.collection.Seq(", ", ", ")")
53+
case seq: Seq[_] => seq.map(quote).mkString("scala.collection.immutable.Seq(", ", ", ")")
5454
case op: Option[_] => op map { x => "scala.Some(" + quote(x) + ")" } getOrElse {"scala.None"}
5555
case url: java.net.URL => "new java.net.URL(%s)" format quote(url.toString)
5656
case file: java.io.File => "new java.io.File(%s)" format quote(file.toString)

src/main/scala/sbtbuildinfo/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ package object sbtbuildinfo {
7777
}
7878

7979
@deprecated("No longer used", "0.9.0")
80-
def ofNImpl(xs: Tree*): Tree = q"_root_.scala.Seq(..${xs map ofImpl})"
80+
def ofNImpl(xs: Tree*): Tree = q"_root_.scala.collection.immutable.Seq(..${xs map ofImpl})"
8181

8282
}
8383
}

src/sbt-test/sbt-buildinfo/append/build.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ lazy val root = (project in file(".")).
3434
""" val sbtVersion: String = "1.2.8"""" ::
3535
""" /** The value is "com.eed3si9n". */""" ::
3636
""" val organization: String = "com.eed3si9n"""" ::
37-
""" /** The value is scala.collection.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch"). */""" ::
38-
""" val libraryDependencies: scala.collection.Seq[String] = scala.collection.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch")""" ::
39-
""" /** The value is scala.collection.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch"). */""" ::
40-
""" val test_libraryDependencies: scala.collection.Seq[String] = scala.collection.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch")""" ::
41-
""" /** The value is scala.collection.Seq("Sonatype Public: https://oss.sonatype.org/content/groups/public"). */""" ::
42-
""" val resolvers: scala.collection.Seq[String] = scala.collection.Seq("Sonatype Public: https://oss.sonatype.org/content/groups/public")""" ::
37+
""" /** The value is scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch"). */""" ::
38+
""" val libraryDependencies: scala.collection.immutable.Seq[String] = scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch")""" ::
39+
""" /** The value is scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch"). */""" ::
40+
""" val test_libraryDependencies: scala.collection.immutable.Seq[String] = scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.7", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch")""" ::
41+
""" /** The value is scala.collection.immutable.Seq("Sonatype Public: https://oss.sonatype.org/content/groups/public"). */""" ::
42+
""" val resolvers: scala.collection.immutable.Seq[String] = scala.collection.immutable.Seq("Sonatype Public: https://oss.sonatype.org/content/groups/public")""" ::
4343
""" override val toString: String = {""" ::
4444
""" "name: %s, version: %s, scalaVersion: %s, sbtVersion: %s, organization: %s, libraryDependencies: %s, test_libraryDependencies: %s, resolvers: %s".format(""" ::
4545
""" name, version, scalaVersion, sbtVersion, organization, libraryDependencies, test_libraryDependencies, resolvers""" ::

src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ lazy val root = (project in file(".")).
4444
""" scalaVersion: String,""" ::
4545
""" ivyXML: scala.xml.NodeSeq,""" ::
4646
""" homepage: scala.Option[java.net.URL],""" ::
47-
""" licenses: scala.collection.Seq[(String, java.net.URL)],""" ::
47+
""" licenses: scala.collection.immutable.Seq[(String, java.net.URL)],""" ::
4848
""" apiMappings: Map[java.io.File, java.net.URL],""" ::
4949
""" isSnapshot: scala.Boolean,""" ::
5050
""" year: scala.Int,""" ::
@@ -60,9 +60,9 @@ lazy val root = (project in file(".")).
6060
""" name = "helloworld",""" ::
6161
""" projectVersion = 0.1,""" ::
6262
""" scalaVersion = "2.11.12",""" ::
63-
""" ivyXML = scala.collection.Seq(),""" ::
63+
""" ivyXML = scala.collection.immutable.Seq(),""" ::
6464
""" homepage = scala.Some(new java.net.URL("http://example.com")),""" ::
65-
""" licenses = scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))),""" ::
65+
""" licenses = scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))),""" ::
6666
""" apiMappings = Map(),""" ::
6767
""" isSnapshot = false,""" ::
6868
""" year = 2012,""" ::

src/sbt-test/sbt-buildinfo/finalcaseobjectrenderer/build.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ lazy val root = (project in file(".")).
4646
""" final val projectVersion = 0.1""" ::
4747
""" /** The value is "2.12.7". */""" ::
4848
""" final val scalaVersion: String = "2.12.7"""" ::
49-
""" /** The value is scala.collection.Seq(). */""" ::
50-
""" final val ivyXML: scala.xml.NodeSeq = scala.collection.Seq()""" ::
49+
""" /** The value is scala.collection.immutable.Seq(). */""" ::
50+
""" final val ivyXML: scala.xml.NodeSeq = scala.collection.immutable.Seq()""" ::
5151
""" /** The value is scala.Some(new java.net.URL("http://example.com")). */""" ::
5252
""" final val homepage: scala.Option[java.net.URL] = scala.Some(new java.net.URL("http://example.com"))""" ::
53-
""" /** The value is scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))). */""" ::
54-
""" final val licenses: scala.collection.Seq[(String, java.net.URL)] = scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))""" ::
53+
""" /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))). */""" ::
54+
""" final val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))""" ::
5555
""" /** The value is Map(). */""" ::
5656
""" final val apiMappings: Map[java.io.File, java.net.URL] = Map()""" ::
5757
""" /** The value is false. */""" ::
@@ -62,8 +62,8 @@ lazy val root = (project in file(".")).
6262
""" final val sym: scala.Symbol = 'Foo""" ::
6363
""" /** The value is 1234L. */""" ::
6464
""" final val buildTime: scala.Long = 1234L""" ::
65-
""" /** The value is scala.collection.Seq(new java.io.File("/tmp/f.txt")). */""" ::
66-
""" final val someCp: scala.collection.Seq[java.io.File] = scala.collection.Seq(new java.io.File("/tmp/f.txt"))""" ::
65+
""" /** The value is scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt")). */""" ::
66+
""" final val someCp: scala.collection.immutable.Seq[java.io.File] = scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt"))""" ::
6767
targetInfoComment ::
6868
targetInfo :: // """
6969
""" override val toString: String = {""" ::

src/sbt-test/sbt-buildinfo/simple/build.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ lazy val root = (project in file(".")).
4343
""" val projectVersion = 0.1""" ::
4444
""" /** The value is "2.12.7". */""" ::
4545
""" val scalaVersion: String = "2.12.7"""" ::
46-
""" /** The value is scala.collection.Seq(). */""" ::
47-
""" val ivyXML: scala.xml.NodeSeq = scala.collection.Seq()""" ::
46+
""" /** The value is scala.collection.immutable.Seq(). */""" ::
47+
""" val ivyXML: scala.xml.NodeSeq = scala.collection.immutable.Seq()""" ::
4848
""" /** The value is scala.Some(new java.net.URL("http://example.com")). */""" ::
4949
""" val homepage: scala.Option[java.net.URL] = scala.Some(new java.net.URL("http://example.com"))""" ::
50-
""" /** The value is scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))). */""" ::
51-
""" val licenses: scala.collection.Seq[(String, java.net.URL)] = scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))""" ::
50+
""" /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))). */""" ::
51+
""" val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))""" ::
5252
""" /** The value is Map(). */""" ::
5353
""" val apiMappings: Map[java.io.File, java.net.URL] = Map()""" ::
5454
""" /** The value is false. */""" ::
@@ -59,8 +59,8 @@ lazy val root = (project in file(".")).
5959
""" val sym: scala.Symbol = 'Foo""" ::
6060
""" /** The value is 1234L. */""" ::
6161
""" val buildTime: scala.Long = 1234L""" ::
62-
""" /** The value is scala.collection.Seq(new java.io.File("/tmp/f.txt")). */""" ::
63-
""" val someCp: scala.collection.Seq[java.io.File] = scala.collection.Seq(new java.io.File("/tmp/f.txt"))""" ::
62+
""" /** The value is scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt")). */""" ::
63+
""" val someCp: scala.collection.immutable.Seq[java.io.File] = scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt"))""" ::
6464
targetInfoComment ::
6565
targetInfo :: // """
6666
""" override val toString: String = {""" ::

src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ lazy val root = (project in file(".")).
4141
""" val projectVersion = 0.1""" ::
4242
""" /** The value is "2.12.7". */""" ::
4343
""" val scalaVersion: String = "2.12.7"""" ::
44-
""" /** The value is scala.collection.Seq(). */""" ::
45-
""" val ivyXML: scala.xml.NodeSeq = scala.collection.Seq()""" ::
44+
""" /** The value is scala.collection.immutable.Seq(). */""" ::
45+
""" val ivyXML: scala.xml.NodeSeq = scala.collection.immutable.Seq()""" ::
4646
""" /** The value is scala.Some(new java.net.URL("http://example.com")). */""" ::
4747
""" val homepage: scala.Option[java.net.URL] = scala.Some(new java.net.URL("http://example.com"))""" ::
48-
""" /** The value is scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))). */""" ::
49-
""" val licenses: scala.collection.Seq[(String, java.net.URL)] = scala.collection.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))""" ::
48+
""" /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))). */""" ::
49+
""" val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URL("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))""" ::
5050
""" /** The value is Map(). */""" ::
5151
""" val apiMappings: Map[java.io.File, java.net.URL] = Map()""" ::
5252
""" /** The value is false. */""" ::

0 commit comments

Comments
 (0)