Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
BijenderKumar1 committed Aug 16, 2024
2 parents e630292 + ce8cca1 commit 156181f
Show file tree
Hide file tree
Showing 66 changed files with 1,467 additions and 677 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: CI

env:
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -Xmx6G -Xss4M -XX:+UseG1GC # JDK_JAVA_OPTIONS is _the_ env. variable to use for modern Java
JVM_OPTS: -XX:+PrintCommandLineFlags -Xmx6G -Xss4M -XX:+UseG1GC # for Java 8 only (sadly, it is not modern enough for JDK_JAVA_OPTIONS)
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -Xmx6G -Xss4M -XX:+UseG1GC
NODE_OPTIONS: --max_old_space_size=6144

on:
Expand Down Expand Up @@ -38,16 +37,16 @@ jobs:
strategy:
fail-fast: false
matrix:
java: ['adopt@1.11', 'openjdk@1.17']
java: ['temurin:17', 'temurin:21']
scala: ['2.12.18', '2.13.12', '3.3.1']
platform: ['JVM', 'Native', 'JS']
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
- uses: coursier/setup-action@v1
with:
java-version: ${{ matrix.java }}
jvm: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Install libuv
Expand All @@ -56,6 +55,12 @@ jobs:
- name: Run tests
run: sbt ++${{ matrix.scala }}! test${{ matrix.platform }}

ci:
runs-on: ubuntu-20.04
needs: [build,lint]
steps:
- run: echo "All checks passed"

publish:
runs-on: ubuntu-20.04
timeout-minutes: 45
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[ZIO Schema](https://github.com/zio/zio-schema) is a [ZIO](https://zio.dev)-based library for modeling the schema of data structures as first-class values.

[![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-schema/workflows/CI/badge.svg) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-schema_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-schema_2.13/) [![ZIO Schema](https://img.shields.io/github/stars/zio/zio-schema?style=social)](https://github.com/zio/zio-schema)
[![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-schema/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-schema_2.13.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-schema_2.13/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-schema_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-schema_2.13/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-schema-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-schema-docs_2.13) [![ZIO Schema](https://img.shields.io/github/stars/zio/zio-schema?style=social)](https://github.com/zio/zio-schema)

## Introduction

Expand Down Expand Up @@ -39,18 +39,17 @@ _ZIO Schema_ is used by a growing number of ZIO libraries, including [ZIO Flow](
In order to use this library, we need to add the following lines in our `build.sbt` file:

```scala

libraryDependencies += "dev.zio" %% "zio-schema" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-avro" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-bson" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-json" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-msg-pack" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-thrift" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-zio-test" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-avro" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-bson" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-json" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-msg-pack" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-thrift" % "1.3.0"
libraryDependencies += "dev.zio" %% "zio-schema-zio-test" % "1.3.0"

// Required for the automatic generic derivation of schemas
libraryDependencies += "dev.zio" %% "zio-schema-derivation" % "1.1.1"
libraryDependencies += "dev.zio" %% "zio-schema-derivation" % "1.3.0"
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
```

Expand Down
51 changes: 26 additions & 25 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import sbtcrossproject.CrossPlugin.autoImport._
import BuildHelper.{ crossProjectSettings, _ }
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._

Global / onChangedBuildSource := ReloadOnSourceChanges

inThisBuild(
List(
name := "zio-schema",
Expand Down Expand Up @@ -37,8 +39,7 @@ inThisBuild(
ThisBuild / publishTo := sonatypePublishToBundle.value
scalacOptions ++= Seq("-scalajs")

addCommandAlias("prepare", "fix; fmt")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll;fix")
addCommandAlias("fmtCheck", "all scalafmtSbtCheck scalafmtCheckAll")
addCommandAlias("fix", "scalafixAll")
addCommandAlias("fixCheck", "scalafixAll --check")
Expand Down Expand Up @@ -127,13 +128,13 @@ lazy val zioSchemaMacros = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.settings(testDeps)
Expand All @@ -157,13 +158,13 @@ lazy val zioSchema = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.settings(testDeps)
Expand Down Expand Up @@ -212,13 +213,13 @@ lazy val zioSchemaDerivation = crossProject(JSPlatform, JVMPlatform, NativePlatf
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.settings(testDeps)
Expand All @@ -241,13 +242,13 @@ lazy val zioSchemaJson = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.jsSettings(scalaJSLinkerConfig ~= { _.withOptimizer(false) })
Expand All @@ -268,13 +269,13 @@ lazy val zioSchemaProtobuf = crossProject(JSPlatform, JVMPlatform, NativePlatfor
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.settings(testDeps)
Expand All @@ -292,8 +293,8 @@ lazy val zioSchemaThrift = project
.settings(buildInfoSettings("zio.schema.thrift"))
.settings(
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % thriftVersion,
"javax.annotation" % "javax.annotation-api" % javaxAnnotationApiVersion
"org.apache.thrift" % "libthrift" % thriftVersion,
"jakarta.annotation" % "jakarta.annotation-api" % javaxAnnotationApiVersion
)
)
.settings(testDeps)
Expand Down Expand Up @@ -359,13 +360,13 @@ lazy val zioSchemaOptics = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.settings(testDeps)
Expand All @@ -389,13 +390,13 @@ lazy val zioSchemaExamples = crossProject(JSPlatform, JVMPlatform, NativePlatfor
.nativeSettings(Test / fork := false)
.nativeSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion
)
)
.settings(testDeps)
Expand Down
44 changes: 23 additions & 21 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import sbt._
import Keys._

import sbtcrossproject.CrossPlugin.autoImport._
import sbtbuildinfo._
import BuildInfoKeys._
import scalafix.sbt.ScalafixPlugin.autoImport._
import sbt.*
import Keys.*
import sbtcrossproject.CrossPlugin.autoImport.*
import sbtbuildinfo.*
import BuildInfoKeys.*
import scalafix.sbt.ScalafixPlugin.autoImport.*
import scalanativecrossproject.NativePlatform

import scala.scalanative.sbtplugin.ScalaNativePlugin.autoImport.nativeConfig

object BuildHelper {

private val versions: Map[String, String] = {
Expand All @@ -26,20 +27,20 @@ object BuildHelper {
val Scala213: String = versions("2.13")
val Scala3: String = versions("3.3")

val zioVersion = "2.0.19"
val zioJsonVersion = "0.6.2"
val zioPreludeVersion = "1.0.0-RC21"
val zioOpticsVersion = "0.2.1"
val zioBsonVersion = "1.0.5"
val silencerVersion = "1.7.14"
val zioVersion = "2.1.7"
val zioJsonVersion = "0.7.2"
val zioPreludeVersion = "1.0.0-RC28"
val zioOpticsVersion = "0.2.2"
val zioBsonVersion = "1.0.6"
val avroVersion = "1.11.3"
val bsonVersion = "4.11.1"
val zioConstraintlessVersion = "0.3.2"
val scalaCollectionCompatVersion = "2.10.0"
val msgpackVersion = "0.9.6"
val jacksonScalaVersion = "2.15.2"
val thriftVersion = "0.16.0"
val javaxAnnotationApiVersion = "1.3.2"
val bsonVersion = "4.11.3"
val zioConstraintlessVersion = "0.3.3"
val scalaCollectionCompatVersion = "2.12.0"
val msgpackVersion = "0.9.8"
val jacksonScalaVersion = "2.17.2"
val thriftVersion = "0.20.0"
val javaxAnnotationApiVersion = "1.3.5"
val scalaJavaTimeVersion = "2.6.0"

def macroDefinitionSettings = Seq(
scalacOptions += "-language:experimental.macros",
Expand Down Expand Up @@ -186,7 +187,8 @@ object BuildHelper {
"test",
baseDirectory.value
)
}
},
nativeConfig ~= { _.withMultithreading(false) }
)

def buildInfoSettings(packageName: String) = Seq(
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.5")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.3.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.4.0-alpha.22")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import zio.test.Gen

object PlatformSpecificGen {

val platformSpecificStandardTypes: Gen[Any, StandardType[_]] = Gen.fromIterable(
val platformSpecificStandardTypes: Gen[Any, StandardType[Any]] = Gen.fromIterable(
List.empty
)

def platformSpecificStandardTypeAndGen(standardTypeGen: StandardType[_]): StandardTypeAndGen[_] =
def platformSpecificStandardTypeAndGen(standardTypeGen: StandardType[Any]): StandardTypeAndGen[Any] =
standardTypeGen match {
case _ => StandardType.UnitType -> Gen.unit: StandardTypeAndGen[_]
case _ => StandardType.UnitType.asInstanceOf[StandardType[Any]] -> Gen.unit
}

val platformSpecificSchemasAndGens: List[SchemaTest[_]] = List.empty
val platformSpecificSchemasAndGens: List[SchemaTest[Any]] = List.empty
}
24 changes: 0 additions & 24 deletions tests/jvm/src/test/scala-2/zio/schema/PlatformSpecificGen.scala

This file was deleted.

24 changes: 24 additions & 0 deletions tests/jvm/src/test/scala/zio/schema/PlatformSpecificGen.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package zio.schema

import zio.schema.SchemaGen.SchemaTest
import zio.schema.StandardTypeGen.StandardTypeAndGen
import zio.test.Gen

object PlatformSpecificGen {

val platformSpecificStandardTypes: Gen[Any, StandardType[Any]] = Gen.fromIterable(
List(
StandardType.CurrencyType
).map(_.asInstanceOf[StandardType[Any]])
)

def platformSpecificStandardTypeAndGen(standardTypeGen: StandardType[Any]): StandardTypeAndGen[Any] =
standardTypeGen match {
case typ if typ.isInstanceOf[StandardType.CurrencyType.type] => typ -> Gen.currency
case _ => StandardType.UnitType.asInstanceOf[StandardType[Any]] -> Gen.unit
}

val platformSpecificSchemasAndGens: List[SchemaTest[Any]] = List(
SchemaTest("Currency", StandardType.CurrencyType.asInstanceOf[StandardType[Any]], Gen.currency)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import zio.test.Gen

object PlatformSpecificGen {

val platformSpecificStandardTypes: Gen[Any, StandardType[_]] = Gen.fromIterable(
val platformSpecificStandardTypes: Gen[Any, StandardType[Any]] = Gen.fromIterable(
List.empty
)

def platformSpecificStandardTypeAndGen(standardTypeGen: StandardType[_]): StandardTypeAndGen[_] =
def platformSpecificStandardTypeAndGen(standardTypeGen: StandardType[Any]): StandardTypeAndGen[Any] =
standardTypeGen match {
case _ => StandardType.UnitType -> Gen.unit: StandardTypeAndGen[_]
case _ => StandardType.UnitType.asInstanceOf[StandardType[Any]] -> Gen.unit
}

val platformSpecificSchemasAndGens: List[SchemaTest[_]] = List.empty
val platformSpecificSchemasAndGens: List[SchemaTest[Any]] = List.empty
}
Loading

0 comments on commit 156181f

Please sign in to comment.