-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Initial scala.js setup * JS HTTP fetch client (#2579)
- Loading branch information
Showing
349 changed files
with
707 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import sbt.Keys._ | ||
import sbt._ | ||
import scalafix.sbt.ScalafixPlugin.autoImport._ | ||
import xerial.sbt.Sonatype.autoImport._ | ||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{headerLicense, HeaderLicense} | ||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{HeaderLicense, headerLicense} | ||
import sbt.* | ||
import sbt.Keys.* | ||
import scalafix.sbt.ScalafixPlugin.autoImport.* | ||
import xerial.sbt.Sonatype.autoImport.* | ||
import sbtcrossproject.CrossPlugin.autoImport.crossProjectPlatform | ||
|
||
object BuildHelper extends ScalaSettings { | ||
val Scala212 = "2.12.18" | ||
|
@@ -71,7 +72,7 @@ object BuildHelper extends ScalaSettings { | |
name := s"$prjName$shadedSuffix", | ||
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, Scala3), | ||
ThisBuild / scalaVersion := Scala213, | ||
scalacOptions := stdOptions ++ extraOptions(scalaVersion.value), | ||
scalacOptions ++= stdOptions ++ extraOptions(scalaVersion.value), | ||
ThisBuild / scalafixDependencies ++= | ||
List( | ||
"com.github.vovapolu" %% "scaluzzi" % "0.1.23", | ||
|
@@ -120,17 +121,65 @@ object BuildHelper extends ScalaSettings { | |
), | ||
ThisBuild / developers := List( | ||
Developer( | ||
"tusharmath", | ||
"Tushar Mathur", | ||
"[email protected]", | ||
new URL("https://github.com/tusharmath"), | ||
"jdegoes", | ||
"John De Goes", | ||
"[email protected]", | ||
url("http://degoes.net"), | ||
), | ||
Developer( | ||
"amitksingh1490", | ||
"Amit Kumar Singh", | ||
"[email protected]", | ||
new URL("https://github.com/amitksingh1490"), | ||
"vigoo", | ||
"Daniel Vigovszky", | ||
"[email protected]", | ||
url("https://vigoo.github.io/"), | ||
), | ||
Developer( | ||
"987Nabil", | ||
"Nabil Abdel-Hafeez", | ||
"[email protected]", | ||
url("https://github.com/987Nabil"), | ||
), | ||
), | ||
) | ||
|
||
def platformSpecificSources(platform: String, conf: String, baseDirectory: File)(versions: String*): Seq[File] = | ||
for { | ||
platform <- List("shared", platform) | ||
version <- "scala" :: versions.toList.map("scala-" + _) | ||
result = baseDirectory.getParentFile / platform.toLowerCase / "src" / conf / version | ||
if result.exists | ||
} yield result | ||
|
||
def crossPlatformSources(scalaVer: String, platform: String, conf: String, baseDir: File): Seq[sbt.File] = { | ||
val versions = CrossVersion.partialVersion(scalaVer) match { | ||
case Some((2, 12)) => | ||
List("2.12", "2.12+", "2.12-2.13", "2.x") | ||
case Some((2, 13)) => | ||
List("2.13", "2.12+", "2.13+", "2.12-2.13", "2.x") | ||
case Some((3,_)) => | ||
List("3") | ||
case _ => | ||
List() | ||
} | ||
platformSpecificSources(platform, conf, baseDir)(versions: _*) | ||
} | ||
|
||
lazy val crossProjectSettings = Seq( | ||
Compile / unmanagedSourceDirectories ++= { | ||
crossPlatformSources( | ||
scalaVersion.value, | ||
crossProjectPlatform.value.identifier, | ||
"main", | ||
baseDirectory.value | ||
) | ||
}, | ||
Test / unmanagedSourceDirectories ++= { | ||
crossPlatformSources( | ||
scalaVersion.value, | ||
crossProjectPlatform.value.identifier, | ||
"test", | ||
baseDirectory.value | ||
) | ||
} | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0") | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") | ||
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") | ||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3") | ||
addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.22.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") | ||
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.10") | ||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") | ||
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") | ||
addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.3") | ||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0") | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") | ||
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") | ||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3") | ||
addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.22.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") | ||
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.10") | ||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") | ||
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") | ||
addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.3") | ||
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.3.1") | ||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") | ||
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
zio-http/js/src/main/scala/zio/http/DriverPlatformSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package zio.http | ||
|
||
import zio.ZLayer | ||
|
||
trait DriverPlatformSpecific { | ||
val default: ZLayer[Server.Config, Throwable, Driver] = | ||
throw new UnsupportedOperationException("Not implemented for Scala.js") | ||
} |
10 changes: 10 additions & 0 deletions
10
zio-http/js/src/main/scala/zio/http/HandlerPlatformSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package zio.http | ||
|
||
import zio.Trace | ||
|
||
trait HandlerPlatformSpecific { | ||
self: Handler.type => | ||
|
||
def fromResource(path: String)(implicit trace: Trace): Handler[Any, Throwable, Any, Response] = | ||
throw new UnsupportedOperationException("Not supported on Scala.js") | ||
} |
13 changes: 13 additions & 0 deletions
13
zio-http/js/src/main/scala/zio/http/ServerPlatformSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package zio.http | ||
|
||
import zio._ | ||
|
||
import zio.http.Server.Config | ||
|
||
trait ServerPlatformSpecific { | ||
val customized: ZLayer[Config, Throwable, Server] = | ||
throw new UnsupportedOperationException("Not implemented for Scala.js") | ||
|
||
val live: ZLayer[Config, Throwable, Server] = | ||
throw new UnsupportedOperationException("Not implemented for Scala.js") | ||
} |
7 changes: 7 additions & 0 deletions
7
zio-http/js/src/main/scala/zio/http/URLPlatformSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package zio.http | ||
|
||
import scala.util.Try | ||
|
||
trait URLPlatformSpecific { | ||
self: URL => | ||
} |
Oops, something went wrong.