Skip to content

Commit

Permalink
Merge pull request #25 from vigoo/js-native
Browse files Browse the repository at this point in the history
ScalaJS and ScalaNative builds
  • Loading branch information
vigoo authored Jan 31, 2022
2 parents f983e9d + c3b6f30 commit c3beb4d
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
matrix:
java: ['[email protected]', '[email protected]']
scala: ['2.12.15', '2.13.8', '3.1.0']
platform: ['JVM']
platform: ['JVM', 'JS', 'Native']
steps:
- name: Checkout current branch
uses: actions/[email protected]
Expand Down
38 changes: 30 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,24 @@ addCommandAlias("check", "; scalafmtSbtCheck; scalafmtCheckAll; compile:scalafix

addCommandAlias(
"testJVM",
";zioParser/test; calibanParser/test"
";zioParserJVM/test; calibanParser/test"
)
addCommandAlias(
"testJS",
";zioParserJS/test"
)
addCommandAlias(
"testNative",
";zioParserNative/test"
)

val zioVersion = "2.0.0-RC2"

lazy val root = (project in file("."))
.aggregate(
zioParser,
zioParserJVM,
zioParserJS,
zioParserNative,
calibanParser,
docs
)
Expand All @@ -47,8 +57,10 @@ lazy val root = (project in file("."))
publish / skip := true
)

lazy val zioParser = (project in file("zio-parser"))
lazy val zioParser = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("zio-parser"))
.settings(stdSettings("zio-parser"))
.settings(crossProjectSettings)
.settings(dottySettings)
.settings(buildInfoSettings("zio.parser"))
.settings(
Expand All @@ -70,10 +82,20 @@ lazy val zioParser = (project in file("zio-parser"))
)
.enablePlugins(BuildInfoPlugin)

lazy val calibanParser = (project in file("zio-parser-caliban"))
lazy val zioParserJVM = zioParser.jvm
lazy val zioParserJS = zioParser.js
.settings(libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion % Test)
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioParserNative = zioParser.native
.settings(nativeSettings)
.settings(libraryDependencies += "dev.zio" %%% "zio-test-sbt" % zioVersion % Test)

lazy val calibanParser = project
.in(file("zio-parser-caliban"))
.settings(stdSettings("zio-parser-caliban"))
.settings(dottySettings)
.dependsOn(zioParser)
.dependsOn(zioParserJVM)
.settings(
publish / skip := true,
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -103,7 +125,7 @@ lazy val benchmarks = (project in file("benchmarks"))
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.enablePlugins(JmhPlugin)
.dependsOn(zioParser)
.dependsOn(zioParserJVM)

lazy val docs = project
.in(file("zio-parser-docs"))
Expand All @@ -114,11 +136,11 @@ lazy val docs = project
moduleName := "zio-parser-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(zioParser),
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(zioParserJVM),
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
cleanFiles += (ScalaUnidoc / unidoc / target).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(Compile / unidoc).value
)
.dependsOn(zioParser)
.dependsOn(zioParserJVM)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ object Printer {
/** Printer that just prints the input string */
val anyString: Printer[Nothing, Char, String, String] =
unsafeRegex(Regex.anyChar.atLeast(0))
.transform(s => String.copyValueOf(s.toArray), (s: String) => Chunk.fromArray(s.toCharArray))
.transform(s => String.valueOf(s.toArray), (s: String) => Chunk.fromArray(s.toCharArray))

/** Prints a specific string 'str' and results in 'value' */
def string[Result](str: String, value: Result): Printer[Nothing, Char, Result, Result] =
Expand Down

0 comments on commit c3beb4d

Please sign in to comment.