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

Scala.js support #376

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
81 changes: 56 additions & 25 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,20 @@ lazy val commonSettings = ScalaVer.settings ++ Seq(
ReleaseStep(action = Command.process("sonatypeReleaseAll", _), enableCrossBuild = true),
pushChanges
),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % Test
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.19" % Test
)

lazy val core = { project in file("core") }.settings(
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(
commonSettings,
name := "scala-jsonschema-core"
)

lazy val macros = { project in file("macros") }
lazy val macros = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("macros"))
.dependsOn(core)
.settings(
commonSettings,
Expand All @@ -92,14 +97,18 @@ lazy val macros = { project in file("macros") }
)
)

lazy val api = { project in file("api") }
lazy val api = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("api"))
.dependsOn(core, macros)
.settings(
commonSettings,
name := "scala-jsonschema"
)

lazy val `play-json` = { project in file("modules/play-json") }
lazy val `play-json` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/play-json"))
.dependsOn(core, api % "compile->compile;test->test")
.settings(
commonSettings,
Expand All @@ -114,15 +123,19 @@ lazy val `play-json` = { project in file("modules/play-json") }
}
)

lazy val `spray-json` = { project in file("modules/spray-json") }
lazy val `spray-json` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/spray-json"))
.dependsOn(core, api % "compile->compile;test->test")
.settings(
commonSettings,
name := "scala-jsonschema-spray-json",
libraryDependencies += "io.spray" %% "spray-json" % "1.3.6"
)

lazy val `circe-json` = { project in file("modules/circe-json") }
lazy val `circe-json` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/circe-json"))
.dependsOn(core, api % "compile->compile;test->test")
.settings(
commonSettings,
Expand All @@ -141,7 +154,9 @@ lazy val `circe-json` = { project in file("modules/circe-json") }
}
)

lazy val `json4s-json` = { project in file("modules/json4s-json") }
lazy val `json4s-json` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/json4s-json"))
.dependsOn(core, api % "compile->compile;test->test")
.settings(
commonSettings,
Expand All @@ -162,7 +177,9 @@ lazy val `json4s-json` = { project in file("modules/json4s-json") }
libraryDependencies ++= Seq("org.json4s" %% "json4s-core" % "4.0.6", "org.json4s" %% "json4s-native" % "4.0.6" % Test)
)

lazy val `u-json` = { project in file("modules/u-json") }
lazy val `u-json` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/u-json"))
.dependsOn(core, api % "compile->compile;test->test")
.settings(
commonSettings,
Expand All @@ -173,20 +190,24 @@ lazy val `u-json` = { project in file("modules/u-json") }
case _ => "3.1.0"
}

Seq("com.lihaoyi" %% "ujson" % uV, "com.lihaoyi" %% "upickle" % uV)
Seq("com.lihaoyi" %%% "ujson" % uV, "com.lihaoyi" %%% "upickle" % uV)

}
)

lazy val `joda-time` = { project in file("modules/joda-time") }
lazy val `joda-time` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/joda-time"))
.dependsOn(core, api)
.settings(
commonSettings,
name := "scala-jsonschema-joda-time",
libraryDependencies += "joda-time" % "joda-time" % "2.13.0"
)

lazy val `cats` = { project in file("modules/cats") }
lazy val `cats` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/cats"))
.dependsOn(core, api)
.settings(
commonSettings,
Expand All @@ -197,11 +218,13 @@ lazy val `cats` = { project in file("modules/cats") }
case _ => "2.9.0"
}

"org.typelevel" %% "cats-core" % catsV
"org.typelevel" %%% "cats-core" % catsV
}
)

lazy val `refined` = { project in file("modules/refined") }
lazy val `refined` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/refined"))
.dependsOn(core, api)
.settings(
commonSettings,
Expand Down Expand Up @@ -229,22 +252,28 @@ lazy val `refined` = { project in file("modules/refined") }
}
)

lazy val parser = { project in file("modules/parser") }
lazy val parser = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/parser"))
.dependsOn(core % "compile->compile;test->test", api)
.settings(
commonSettings,
name := "scala-jsonschema-parser"
)

lazy val enumeratum = { project in file("modules/enumeratum") }
lazy val enumeratum = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/enumeratum"))
.dependsOn(core, api)
.settings(
commonSettings,
name := "scala-jsonschema-enumeratum",
libraryDependencies += "com.beachape" %% "enumeratum" % "1.7.2"
libraryDependencies += "com.beachape" %%% "enumeratum" % "1.7.2"
)

lazy val derived = { project in file("modules/derived") }
lazy val derived = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("modules/derived"))
.dependsOn(core, api, macros)
.settings(
commonSettings,
Expand Down Expand Up @@ -334,21 +363,23 @@ lazy val docs = { project in file("documentation") }
// // #copyright
)

lazy val root = { project in file(".") }
lazy val root = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("."))
.aggregate(
core,
macros,
derived,
api,
parser,
// parser,
refined,
enumeratum,
// enumeratum,
`joda-time`,
`cats`,
`play-json`,
`circe-json`,
`spray-json`,
`json4s-json`,
// `play-json`,
// `circe-json`,
// `spray-json`,
// `json4s-json`,
`u-json`
)
.settings(
Expand Down
5 changes: 5 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Build
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")

// Publishing
addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "2.0.12")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.3")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
Expand Down