Skip to content

Commit

Permalink
add Scala 3 build settings
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 7, 2024
1 parent 2555434 commit c045ba4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/scala/g8.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -577,7 +577,7 @@ object G8 {

try {
properties.load(stm)
properties.parameters.toList
parameters.toList
} finally {
stm.close()
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/scala/maven.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
22 changes: 11 additions & 11 deletions library/src/test/scala/giter8/VersionNumberOrderingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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" % {
Expand Down

0 comments on commit c045ba4

Please sign in to comment.