Skip to content
Merged

sbt 2 #516

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
java:
- 11
- 17
- 25
steps:
- uses: actions/checkout@v6
Expand Down
50 changes: 30 additions & 20 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ val tagOrHash = Def.setting {
}

def gitHash(): String =
sys.process.Process("git rev-parse HEAD").lineStream_!.head
sys.process.Process("git rev-parse HEAD").lazyLines_!.head

val unusedWarnings = Seq(
"-Ywarn-unused",
)

val jsNativeCommon = Def.settings(
libraryDependencies ++= Seq(
"com.github.xuwei-k" %%% "msgpack4z-native" % msgpack4zNativeVersion,
"com.github.xuwei-k" %% "msgpack4z-native" % msgpack4zNativeVersion,
)
)

Expand Down Expand Up @@ -195,14 +195,14 @@ lazy val msgpack4zCore = projectMatrix
name := msgpack4zCoreName,
Test / sourceDirectories ~= (_.distinct),
libraryDependencies ++= Seq(
"org.scalaz" %%% "scalaz-core" % ScalazVersion,
"com.github.scalaprops" %%% "scalaprops" % scalapropsVersion % "test",
"com.github.scalaprops" %%% "scalaprops-scalaz" % scalapropsVersion % "test",
"com.github.xuwei-k" %% "zeroapply-scalaz" % "0.5.1" % "provided",
"org.scalaz" %% "scalaz-core" % ScalazVersion,
"com.github.scalaprops" %% "scalaprops" % scalapropsVersion % "test",
"com.github.scalaprops" %% "scalaprops-scalaz" % scalapropsVersion % "test",
("com.github.xuwei-k" %% "zeroapply-scalaz" % "0.5.1" % "provided").platform(Platform.jvm),
),
libraryDependencies ++= {
if (CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 2)) {
Seq("com.chuusai" %%% "shapeless" % "2.3.13" % "test")
Seq("com.chuusai" %% "shapeless" % "2.3.13" % "test")
} else {
Nil
}
Expand Down Expand Up @@ -257,19 +257,29 @@ lazy val noPublish = Seq(
Test / publishArtifact := false
)

TaskKey[Unit]("testSequential") := Def
.sequential(
List(
msgpack4zCore.allProjects(),
testJavaLatest.allProjects(),
).flatten.map(_._1).sortBy(_.id).map(_ / Test / test)
)
.value
commonSettings
noPublish
Compile / scalaSource := (ThisBuild / baseDirectory).value / "dummy"
Test / scalaSource := (ThisBuild / baseDirectory).value / "dummy"
autoScalaLibrary := false
val msgpack4zCoreRoot = rootProject.autoAggregate.settings(
TaskKey[Unit]("testSequential") := Def
.sequential(
List(
msgpack4zCore.allProjects(),
testJavaLatest.allProjects(),
).flatten
.map(_._1)
.sortBy(_.id)
.flatMap(p =>
Seq[Def.Initialize[Task[Unit]]](
Def.task(streams.value.log.info(s"start ${p.id} test")),
(p / Test / testFull).map(_ => ())
)
)
)
.value,
commonSettings,
noPublish,
Compile / scalaSource := (ThisBuild / baseDirectory).value / "dummy",
Test / scalaSource := (ThisBuild / baseDirectory).value / "dummy",
autoScalaLibrary := false,
)

lazy val testJavaLatest = projectMatrix
.in(file("test-java-latest"))
Expand Down
6 changes: 3 additions & 3 deletions project/AnyValCodec.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import java.util.Locale

object AnyValCodec {
private[this] val types = "Boolean Byte Short Int Long Float Double".split(' ').toList
private val types = "Boolean Byte Short Int Long Float Double".split(' ').toList

private[this] val defdef = types.map { tpe => s" implicit def ${tpe.toLowerCase(Locale.ENGLISH)}Codec: MsgpackCodec[$tpe]" }.mkString("\n")
private val defdef = types.map { tpe => s" implicit def ${tpe.toLowerCase(Locale.ENGLISH)}Codec: MsgpackCodec[$tpe]" }.mkString("\n")

private[this] val impl = types.map { tpe =>
private val impl = types.map { tpe =>
s"""
override final def ${tpe.toLowerCase(Locale.ENGLISH)}Codec: MsgpackCodec[$tpe] =
MsgpackCodec.tryConst(_.pack$tpe(_), _.unpack$tpe())"""
Expand Down
4 changes: 2 additions & 2 deletions project/CaseCodec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object CaseCodec {
private final val extract = "extract"
private final val Z = "Z"

private[this] val f: Int => String = { i =>
private val f: Int => String = { i =>
val tparams = tparamList(i)
val tparams1 = tparams.mkString(", ")
val implicitParams = tparams.map(x => x + ": MsgpackCodec[" + x + "]").mkString(", ")
Expand Down Expand Up @@ -46,7 +46,7 @@ object CaseCodec {
"""
}

private[this] def one = {
private def one = {
val codec1 = "codec1"
val A1 = "A1"
def methodDef(name: String) =
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.12.13
sbt.version=2.0.0
3 changes: 0 additions & 3 deletions project/plugin.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
addSbtPlugin("com.github.scalaprops" % "sbt-scalaprops" % "0.5.3")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.6")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.22.0")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1")

scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-Yno-adapted-args",
)

fullResolvers ~= { _.filterNot(_.name == "jcenter") }