diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b60b2de8..5a576251 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,9 @@ jobs: - java: 8 os: ubuntu-latest name: test_all + - java: 8 + os: ubuntu-latest + name: scala_3 - java: 8 os: windows-latest name: scala_2_13 # TODO enable scripted test @@ -49,6 +52,9 @@ jobs: "scala_2_13") sbt -v SetScala213 app/test lib/test ;; + "scala_3") + sbt -v '++ 3.x' app/test lib/test + ;; *) echo "unknown job" exit 1 diff --git a/build.sbt b/build.sbt index 46f0be12..60b32617 100644 --- a/build.sbt +++ b/build.sbt @@ -67,7 +67,7 @@ lazy val app = (project in file("app")) .settings( description := "Command line tool to apply templates defined on GitHub", name := "giter8", - crossScalaVersions := List(scala212, scala213), + crossScalaVersions := List(scala212, scala213, scala3), csRun / sourceDirectory := { (baseDirectory).value.getParentFile / "src" / "main" / "conscript" }, @@ -144,7 +144,7 @@ lazy val gitsupport = (project in file("cli-git")) .settings( description := "cli and git support library for Giter8", name := "giter8-cli-git", - crossScalaVersions := List(scala212, scala213), + crossScalaVersions := List(scala212, scala213, scala3), libraryDependencies ++= Seq( scopt, jgit, @@ -165,7 +165,7 @@ lazy val lib = (project in file("library")) .settings( name := "giter8-lib", description := "shared library for app and plugin", - crossScalaVersions := List(scala212, scala213), + crossScalaVersions := List(scala212, scala213, scala3), libraryDependencies ++= scalatest, libraryDependencies ++= Seq( stringTemplate, @@ -189,7 +189,7 @@ lazy val launcher = (project in file("launcher")) .settings( description := "Command line tool to apply templates defined on GitHub", name := "giter8-launcher", - crossScalaVersions := List(scala212, scala213), + crossScalaVersions := List(scala212, scala213, scala3), libraryDependencies ++= Seq( coursier, verify % Test, diff --git a/library/src/main/scala/g8.scala b/library/src/main/scala/g8.scala index 6daf1b30..763b7115 100644 --- a/library/src/main/scala/g8.scala +++ b/library/src/main/scala/g8.scala @@ -482,7 +482,7 @@ object G8 { .toMap } - final case object NullInputException extends Throwable + case object NullInputException extends Throwable private def relativize(in: File, from: File): String = from.toURI().relativize(in.toURI).getPath @@ -563,8 +563,8 @@ object G8 { def readProps(stm: InputStream): G8.OrderedProperties = { // Overrides java.util.Properties to return properties back in the order they were specified + val parameters = mutable.ListBuffer.empty[(String, String)] val properties = new Properties { - val parameters = mutable.ListBuffer.empty[(String, String)] override def put(key: Object, value: Object) = { val k = key.toString @@ -577,7 +577,7 @@ object G8 { try { properties.load(stm) - properties.parameters.toList + parameters.toList } finally { stm.close() } diff --git a/library/src/main/scala/maven.scala b/library/src/main/scala/maven.scala index 73d8eb1c..b7137495 100644 --- a/library/src/main/scala/maven.scala +++ b/library/src/main/scala/maven.scala @@ -26,7 +26,7 @@ object Maven extends JavaTokenParsers with MavenHelper { private val org, name, release = """[\w\-\.]+""".r private val spec = - "maven" ~> "(" ~> org ~ ("," ~> name) ~ (("," ~> release) ?) <~ ")" ^^ { case org ~ name ~ release => + "maven" ~> "(" ~> org ~ ("," ~> name) ~ (("," ~> release).?) <~ ")" ^^ { case org ~ name ~ release => (org, name, release) } diff --git a/library/src/test/scala/giter8/VersionNumberOrderingTest.scala b/library/src/test/scala/giter8/VersionNumberOrderingTest.scala index b7fba982..72e8bdad 100644 --- a/library/src/test/scala/giter8/VersionNumberOrderingTest.scala +++ b/library/src/test/scala/giter8/VersionNumberOrderingTest.scala @@ -32,7 +32,7 @@ final class VersionNumberOrderingTest extends Properties("StableVersion") { private def genVersionNumber: Gen[VersionNumber] = for { n <- Gen.choose(3, 4) - numbers <- Gen.listOfN(n, Gen.choose(0, 1000L)) + numbers <- Gen.listOfN(n, Gen.choose(0L, 1000L)) t <- Gen.choose(1, 3) o <- Gen.choose(1, 3) tags <- Gen.listOfN(t, defaultGenStr) @@ -47,32 +47,32 @@ final class VersionNumberOrderingTest extends Properties("StableVersion") { private def genSameMajorVersionNumbers: Gen[Seq[VersionNumber]] = for { - major <- Gen.choose(0, 1000L) + major <- Gen.choose(0L, 1000L) variations <- Gen.choose(1, 5) versionNumbers <- fixedPrefixVersionNumbers(major) } yield versionNumbers private def genSameMajorAndMinorVersionNumbers: Gen[Seq[VersionNumber]] = for { - major <- Gen.choose(0, 1000L) - minor <- Gen.choose(0, 1000L) + major <- Gen.choose(0L, 1000L) + minor <- Gen.choose(0L, 1000L) versionNumbers <- fixedPrefixVersionNumbers(major, minor) } yield versionNumbers private def genSameMajorAndMinorAndPatchVersionNumbers: Gen[Seq[VersionNumber]] = for { - major <- Gen.choose(0, 1000L) - minor <- Gen.choose(0, 1000L) - patch <- Gen.choose(0, 1000L) + major <- Gen.choose(0L, 1000L) + minor <- Gen.choose(0L, 1000L) + patch <- Gen.choose(0L, 1000L) versionNumbers <- fixedPrefixVersionNumbers(major, minor, patch) } yield versionNumbers private def genSameMajorAndMinorAndPatchAndOtherVersionNumbers: Gen[Seq[VersionNumber]] = for { - major <- Gen.choose(0, 1000L) - minor <- Gen.choose(0, 1000L) - patch <- Gen.choose(0, 1000L) - other <- Gen.choose(0, 1000L) + major <- Gen.choose(0L, 1000L) + minor <- Gen.choose(0L, 1000L) + patch <- Gen.choose(0L, 1000L) + other <- Gen.choose(0L, 1000L) versionNumbers <- fixedPrefixVersionNumbers(major, minor, patch, other) } yield versionNumbers diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 81740925..a6c57ccf 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -30,6 +30,7 @@ object Dependencies { val sbtIo = "org.scala-sbt" %% "io" % "1.10.0" val scala212 = "2.12.20" val scala213 = "2.13.15" + val scala3 = "3.3.4" val sbt1 = "1.2.8" val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "2.1.0" def parserCombinator(scalaVersion: String) = "org.scala-lang.modules" %% "scala-parser-combinators" % {