Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give some love to the project #150

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
21 changes: 14 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import BuildConfig._
import BuildConfig.*

val scala212 = "2.12.19"
val scala213 = "2.13.14"
val scala3 = "3.3.3"
Global / onChangedBuildSource := ReloadOnSourceChanges

val scala212 = "2.12.20"
val scala213 = "2.13.15"
val scala3 = "3.3.4"

val allScalaVersions = List(scala212, scala213, scala3)
val documentationScalaVersion = scala213
Expand All @@ -14,8 +16,8 @@ ThisBuild / projectStableVersion := {
else (ThisBuild / version).value
}

ThisBuild / organization := "dev.vhonta"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / organization := "dev.vhonta"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local"

Expand All @@ -39,7 +41,7 @@ val publishSettings = Seq(
id = "vitaliihonta",
name = "Vitalii Honta",
email = "[email protected]",
url = new URL("https://github.com/vitaliihonta")
url = url("https://github.com/vitaliihonta")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was emitting a deprecation warning

)
)
)
Expand All @@ -55,6 +57,8 @@ lazy val coverageSettings = Seq(
)

lazy val baseProjectSettings = Seq(
scalaVersion := scala213,
crossScalaVersions := allScalaVersions,
scalacOptions ++= {
Comment on lines +60 to +61

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this because the scala version used by default in each module was a bit chaotic.

You can see that by running sbt 'show scalaVersion'

val baseOptions = Seq(
"-language:implicitConversions",
Expand Down Expand Up @@ -92,6 +96,9 @@ val baseLibSettings = baseSettings ++ publishSettings
lazy val root = project
.in(file("."))
.settings(baseSettings, noPublishSettings, unidocSettings)
.settings(
crossScalaVersions := Nil
) // https://www.scala-sbt.org/1.x/docs/Cross-Build.html#Cross+building+a+project+statefully,
.settings(
name := "zio-temporal-root",
scalaVersion := scala213
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ trait ZSearchAttributeMetaEnumInstances {

/** Provides an attribute meta for old [[scala.Enumeration]]
*/
def enumeration(enum: Enumeration): ZSearchAttributeMeta.Of[enum.Value, ZSearchAttribute.Keyword, String] =
new ZSearchAttributeMeta.KeywordMeta[enum.Value](_.toString, raw => enum.withName(raw))
def enumeration(`enum`: Enumeration): ZSearchAttributeMeta.Of[`enum`.Value, ZSearchAttribute.Keyword, String] =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was emitting a warning telling that enum will be a reserved keyword in Scala3 and should be replaced with a backticked name

new ZSearchAttributeMeta.KeywordMeta[`enum`.Value](_.toString, raw => `enum`.withName(raw))
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import zio.temporal.{ZSearchAttribute, ZSearchAttributeMeta}
trait EnumSearchAttributes {

implicit def enumAttribute[E <: EnumEntry](
implicit enum: Enum[E]
implicit `enum`: Enum[E]
): ZSearchAttributeMeta.Of[E, ZSearchAttribute.Keyword, String] =
new ZSearchAttributeMeta.KeywordMeta[E](_.entryName, enum.withName)
new ZSearchAttributeMeta.KeywordMeta[E](_.entryName, `enum`.withName)

implicit def stringEnumAttribute[E <: StringEnumEntry](
implicit enum: StringEnum[E]
implicit `enum`: StringEnum[E]
): ZSearchAttributeMeta.Of[E, ZSearchAttribute.Keyword, String] =
new ZSearchAttributeMeta.KeywordMeta[E](_.value, enum.withValue)
new ZSearchAttributeMeta.KeywordMeta[E](_.value, `enum`.withValue)
}
10 changes: 5 additions & 5 deletions core/src/main/scala/zio/temporal/ZSearchAttributeMeta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,34 +156,34 @@ object ZSearchAttributeMeta extends ZSearchAttributeMetaCollectionInstances with
override def decode(value: A): A = value
}

private final object StringMeta extends SimplePlainMeta[String] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was emitting a warning saying that the final is redundant

private object StringMeta extends SimplePlainMeta[String] {
override def underlyingAttributeKey(name: String): SearchAttributeKey[String] = {
SearchAttributeKey.forText(name)
}
}

private final object BooleanMeta extends SimplePlainMeta[Boolean] {
private object BooleanMeta extends SimplePlainMeta[Boolean] {
override def underlyingAttributeKey(name: String): SearchAttributeKey[Boolean] = {
// safe to cast java.lang.Boolean to Boolean
SearchAttributeKey.forBoolean(name).asInstanceOf[SearchAttributeKey[Boolean]]
}
}

private final object LongMeta extends SimplePlainMeta[Long] {
private object LongMeta extends SimplePlainMeta[Long] {
override def underlyingAttributeKey(name: String): SearchAttributeKey[Long] = {
// safe to cast java.lang.Long to Long
SearchAttributeKey.forLong(name).asInstanceOf[SearchAttributeKey[Long]]
}
}

private final object DoubleMeta extends SimplePlainMeta[Double] {
private object DoubleMeta extends SimplePlainMeta[Double] {
override def underlyingAttributeKey(name: String): SearchAttributeKey[Double] = {
// safe to cast java.lang.Double to Double
SearchAttributeKey.forDouble(name).asInstanceOf[SearchAttributeKey[Double]]
}
}

private final object OffsetDateTimeMeta extends SimplePlainMeta[OffsetDateTime] {
private object OffsetDateTimeMeta extends SimplePlainMeta[OffsetDateTime] {
override def underlyingAttributeKey(name: String): SearchAttributeKey[OffsetDateTime] = {
SearchAttributeKey.forOffsetDateTime(name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ object ExtendsActivity extends ExtendsActivityImplicits {
def apply[A](implicit ev: ExtendsActivity[A]): ev.type = ev

@internalApi
final object __zio_temporal_ExtendsActivityInstance extends ExtendsActivity[Any]
object __zio_temporal_ExtendsActivityInstance extends ExtendsActivity[Any]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ object IsActivity extends IsActivityImplicits {
def apply[A](implicit ev: IsActivity[A]): ev.type = ev

@internalApi
final object __zio_temporal_IsActivityInstance extends IsActivity[Any]
object __zio_temporal_IsActivityInstance extends IsActivity[Any]
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ object ZScheduleSpec {
protected[temporal] def applyTo(builder: ScheduleSpec.Builder): Unit
}

final object Times {
object Times {
def fromJava(spec: ScheduleSpec): Times = {
def asCalendars = Option(spec.getCalendars)
.filterNot(_.isEmpty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ object ExtendsWorkflow extends ExtendsWorkflowImplicits {
def apply[A](implicit ev: ExtendsWorkflow[A]): ev.type = ev

@internalApi
final object __zio_temporal_ExtendsWorkflowInstance extends ExtendsWorkflow[Any]
object __zio_temporal_ExtendsWorkflowInstance extends ExtendsWorkflow[Any]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ object HasPublicNullaryConstructor extends HasPublicNullaryConstructorImplicits
def apply[A](implicit ev: HasPublicNullaryConstructor[A]): ev.type = ev

@internalApi
final object __zio_temporal_HasPublicNullaryConstructorInstance extends HasPublicNullaryConstructor[Any]
object __zio_temporal_HasPublicNullaryConstructorInstance extends HasPublicNullaryConstructor[Any]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ object IsConcreteClass extends IsConcreteClassImplicits {
def apply[A](implicit ev: IsConcreteClass[A]): ev.type = ev

@internalApi
final object __zio_temporal_IsConcreteClassInstance extends IsConcreteClass[Any]
object __zio_temporal_IsConcreteClassInstance extends IsConcreteClass[Any]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ object IsWorkflow extends IsWorkflowImplicits {
def apply[A](implicit ev: IsWorkflow[A]): ev.type = ev

@internalApi
final object __zio_temporal_IsWorkflowInstance extends IsWorkflow[Any]
object __zio_temporal_IsWorkflowInstance extends IsWorkflow[Any]
}
4 changes: 2 additions & 2 deletions core/src/main/scala/zio/temporal/workflow/ZAsync.scala
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ object ZAsync {
)(f: A => ZAsync[B]
)(implicit bf: BuildFrom[Collection[A], B, Collection[B]]
): ZAsync[Collection[B]] =
in.foldLeft[ZAsync[mutable.Builder[B, Collection[B]]]](succeed(bf(in)))((acc, a) => acc.zipWith(f(a))(_ += _))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder.apply is deprecated in favour of Builder.newBuilder

in.foldLeft[ZAsync[mutable.Builder[B, Collection[B]]]](succeed(bf.newBuilder(in)))((acc, a) => acc.zipWith(f(a))(_ += _))
.map(_.result())

/** Similar to [[zio.ZIO.foreachDiscard]] for collections
Expand Down Expand Up @@ -371,7 +371,7 @@ object ZAsync {
}
}

final object Result {
object Result {

final implicit class AllEffectsOps[A](private val self: Result[Cancel with Timeout, A]) extends AnyVal {

Expand Down
10 changes: 5 additions & 5 deletions core/src/main/scala/zio/temporal/workflow/ZSaga.scala
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,21 @@ object ZSaga {

def interpret[A0](saga: ZSaga[A0]): Either[Throwable, A0] =
saga match {
case succeed: Succeed[A0] => Right(succeed.value)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was emitting a warning as the program is not able to type check the A0 type as it's eliminated at runtime

case succeed: Succeed[_] => Right(succeed.value)
case failed: Failed => Left(failed.error)
case attempt: Attempt[A0] => Try(attempt.thunk()).toEither
case attempt: Attempt[_] => Try(attempt.thunk()).toEither

case compensation: Compensation[A0] =>
case compensation: Compensation[_] =>
temporalSaga.addCompensation((() => compensation.compensate()): Proc)
interpret(compensation.cont)

case cont: Bind[baseA, A0] =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was baseA? 🤔

case cont: Bind[_, _] =>
interpret(cont.base) match {
case left @ Left(_) => left.asInstanceOf[Either[Throwable, A0]]
case Right(value) => interpret(cont.cont(value))
}

case catchAll: CatchAll[A0] =>
case catchAll: CatchAll[_] =>
interpret(catchAll.base) match {
case right: Right[Throwable, A0] => right
case Left(error) => interpret(catchAll.handle(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class ZioLocalWorkflowImpl extends ZioLocalWorkflow {

override def complete(): Unit = {
logger.info("Completion received!")
state := ()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was emitting a warning saying that this syntax was deprecated

state := (())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ class ZioWorkflowImpl extends ZioWorkflow {

override def complete(): Unit = {
logger.info("Completion received!")
state := ()
state := (())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ class ZioWorkflowUntypedImpl extends ZioWorkflowUntyped {

override def complete(): Unit = {
logger.info("Completion received!")
state := ()
state := (())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ class ComplexWorkflowImpl extends ComplexWorkflow {
triple.snapshot

override def resume(): Unit = {
resumed := ()
resumed := (())
}
}
20 changes: 10 additions & 10 deletions project/BuildConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ object BuildConfig extends Dependencies {
trait Dependencies {

private object versions {
val temporal = "1.25.1"
val zio = "2.1.7"
val zioLogging = "2.3.0"
val enumeratum = "1.7.4"
val jackson = "2.17.2"
val otel = "1.40.0"
val temporal = "1.27.0"
val zio = "2.1.14"
val zioLogging = "2.4.0"
val enumeratum = "1.7.5"
val jackson = "2.18.2"
val otel = "1.45.0"
}

object org {
Expand Down Expand Up @@ -103,7 +103,7 @@ trait Dependencies {
val testFrameworks = Seq(new TestFramework("zio.test.sbt.ZTestFramework"))

// only for examples
val cli = org.zio %% "zio-cli" % "0.5.0"
val cli = org.zio %% "zio-cli" % "0.7.0"
}

object Enumeratum {
Expand All @@ -129,7 +129,7 @@ trait Dependencies {
object Logging {
val zio = org.zio %% "zio-logging" % versions.zioLogging
val zioSlf4j = org.zio %% "zio-logging-slf4j" % versions.zioLogging
val logback = "ch.qos.logback" % "logback-classic" % "1.2.11"
val logback = "ch.qos.logback" % "logback-classic" % "1.5.16"
}

object Testing {
Expand All @@ -141,10 +141,10 @@ trait Dependencies {
val otelExporterOtlp = "io.opentelemetry" % "opentelemetry-exporter-otlp" % versions.otel
val otelTracePropagators = "io.opentelemetry" % "opentelemetry-extension-trace-propagators" % versions.otel
val otelOpentracingShim = "io.opentelemetry" % "opentelemetry-opentracing-shim" % versions.otel
val otelSemvonc = "io.opentelemetry.semconv" % "opentelemetry-semconv" % "1.26.0-alpha"
val otelSemvonc = "io.opentelemetry.semconv" % "opentelemetry-semconv" % "1.29.0-alpha"

val otel = Seq(otelApi, otelExporterOtlp, otelTracePropagators, otelOpentracingShim, otelSemvonc)

val micrometerOtlp = "io.micrometer" % "micrometer-registry-otlp" % "1.13.2"
val micrometerOtlp = "io.micrometer" % "micrometer-registry-otlp" % "1.14.2"
}
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.10.1
sbt.version = 1.10.7
10 changes: 5 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.1.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.4")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.6.2")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ object EnumProtoType {
}

final class EnumeratumEnumException private[protobuf] (
enum: Enum[_],
`enum`: Enum[_],
entry: AnyRef,
companion: GeneratedEnumCompanion[_])
extends RuntimeException {

override def getMessage: String =
s"Unable to convert $entry (value of $enum) to $companion, expected one of ${companion.values.mkString("[", ", ", "]")}"
s"Unable to convert $entry (value of ${`enum`}) to $companion, expected one of ${companion.values.mkString("[", ", ", "]")}"
}

final class EnumProtoType[P <: GeneratedEnum, E <: EnumEntry] private[protobuf] (
companion: GeneratedEnumCompanion[P],
enum: Enum[E])
`enum`: Enum[E])
extends ProtoType[E] {

override type Repr = P
Expand All @@ -34,16 +34,16 @@ final class EnumProtoType[P <: GeneratedEnum, E <: EnumEntry] private[protobuf]
companion
.fromName(value.entryName)
.getOrElse(
throw new EnumeratumEnumException(enum, value, companion)
throw new EnumeratumEnumException(`enum`, value, companion)
)

override def fromRepr(repr: P): E =
enum.withNameInsensitive(repr.name)
`enum`.withNameInsensitive(repr.name)
}

final class EnumProtoTypePartiallyApplied[P <: GeneratedEnum](private val companion: GeneratedEnumCompanion[P])
extends AnyVal {

def to[E <: EnumEntry](enum: Enum[E]): ProtoType.Of[E, P] =
def to[E <: EnumEntry](`enum`: Enum[E]): ProtoType.Of[E, P] =
new EnumProtoType[P, E](companion, `enum`)
}
Loading
Loading