Skip to content

Commit

Permalink
Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Dec 2, 2024
1 parent 292c19a commit b68b76f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
- name: Compile and test
run: |
sbt test
sbt "+ test"
shell: bash
- name: Format check
if: ${{ runner.os == 'Linux' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PluginFrontendSpec
actual("a" * 256) must be(expected("a" * 256))
actual("\u3714\u3715" * 256) must be(expected("\u3714\u3715" * 256))
actual("abc" * 1000) must be(expected("abc" * 1000))
forAll(MinSuccessful(1000)) { s: String =>
forAll(MinSuccessful(1000)) { (s: String) =>
actual(s) must be(expected(s))
}

Expand Down
28 changes: 24 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import com.typesafe.tools.mima.core._
inThisBuild(
List(
scalaVersion := "2.12.20",
crossScalaVersions := Seq("2.12.20", "2.13.15"),
crossScalaVersions := Seq("2.12.20", "2.13.15", "3.3.4"),
scalacOptions ++= List("-release", "8"),
javacOptions ++= List("-target", "8", "-source", "8"),
organization := "com.thesamet.scalapb"
Expand All @@ -28,9 +28,15 @@ lazy val bridge: Project = project
"org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0" % "test",
"org.scalatest" %% "scalatest" % "3.2.19" % "test",
"org.scalacheck" %% "scalacheck" % "1.18.1" % "test",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0" % "test",
"io.get-coursier" %% "coursier" % coursierVersion % "test"
"io.get-coursier" %% "coursier" % coursierVersion % "test" cross CrossVersion.for3Use2_13
),
conflictWarning := {
if (scalaBinaryVersion.value == "3") {
ConflictWarning("warn", Level.Warn, false)
} else {
conflictWarning.value
}
},
scalacOptions ++= (if (scalaVersion.value.startsWith("2.13."))
Seq("-Wconf:origin=.*JavaConverters.*:s")
else Nil),
Expand All @@ -51,8 +57,15 @@ lazy val protocCacheCoursier = project
.dependsOn(bridge)
.settings(
name := "protoc-cache-coursier",
conflictWarning := {
if (scalaBinaryVersion.value == "3") {
ConflictWarning("warn", Level.Warn, false)
} else {
conflictWarning.value
}
},
libraryDependencies ++= Seq(
"io.get-coursier" %% "coursier" % coursierVersion
"io.get-coursier" %% "coursier" % coursierVersion cross CrossVersion.for3Use2_13
)
)

Expand All @@ -61,6 +74,13 @@ lazy val protocGen = project
.dependsOn(bridge % "compile->compile;test->test")
.settings(
name := "protoc-gen",
conflictWarning := {
if (scalaBinaryVersion.value == "3") {
ConflictWarning("warn", Level.Warn, false)
} else {
conflictWarning.value
}
},
libraryDependencies ++= Seq(
protobufJava % "provided"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ object CoursierProtocCache {
}

private[this] def protocDep(version: String): Dependency =
dep"com.google.protobuf:protoc"
.withVersion(version)
coursier.core
.Dependency(
coursier.core
.Module(
coursier.core.Organization("com.google.protobuf"),
coursier.core.ModuleName("protoc"),
Map.empty
),
version
)
.withPublication(
"protoc",
Type("jar"),
Expand Down

0 comments on commit b68b76f

Please sign in to comment.