Skip to content

Commit

Permalink
Add Scala Native support to core and examples
Browse files Browse the repository at this point in the history
Dependencies are installed using Vcpkg
  • Loading branch information
keynmol committed Jul 16, 2024
1 parent f251fde commit c3ad95a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xmx2G
32 changes: 25 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ ThisBuild / scalaVersion := Scala3 // the default Scala
testFrameworks += new TestFramework("munit.Framework")

val smithyVersion = "1.47.0"
val smithy4sVersion = "0.18.16"
val smithy4sVersion = "0.18.23"
val alloyVersion = "0.3.7"

lazy val root = tlCrossRootProject.aggregate(core, examples, plugin, pluginBundle, tests)

lazy val core = crossProject(JVMPlatform, JSPlatform)
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("modules/core"))
.settings(
name := "smithy4s-deriving",
Expand Down Expand Up @@ -89,16 +89,21 @@ lazy val tests = crossProject(JVMPlatform)
)
)

lazy val examples = crossProject(JVMPlatform, JSPlatform)
lazy val examples = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("modules/examples"))
.dependsOn(core)
.enablePlugins(NoPublishPlugin)
.settings(
libraryDependencies ++= Seq(
"com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion,
"com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion,
"org.http4s" %% "http4s-ember-client" % "0.23.26",
"org.http4s" %% "http4s-ember-server" % "0.23.26"
"com.disneystreaming.smithy4s" %%% "smithy4s-http4s" % smithy4sVersion,
"com.disneystreaming.smithy4s" %%% "smithy4s-dynamic" % smithy4sVersion,
"org.http4s" %%% "http4s-ember-client" % "0.23.26",
"org.http4s" %%% "http4s-ember-server" % "0.23.26",
// This particular version of fs2-io performs evictions of core CE and
// fs2 libraries so that networking with Ember works out of the box
// It still requires all necessary native dependencies (openssl, s2n, zlib)
// to be installed globally
"co.fs2" %%% "fs2-io" % "3.10-365636d"
),
autoCompilerPlugins := true,
Compile / fork := true,
Expand All @@ -113,6 +118,19 @@ lazy val examples = crossProject(JVMPlatform, JSPlatform)
"software.amazon.smithy" % "smithy-model" % smithyVersion
)
)
.nativeEnablePlugins(VcpkgNativePlugin)
.nativeSettings(
vcpkgDependencies := VcpkgDependencies(
"curl",
"s2n",
"openssl"
),
vcpkgNativeConfig ~= {
_.withRenamedLibraries(
Map("curl" -> "libcurl")
)
}
)
.jsSettings(
Test / fork := false
)
2 changes: 1 addition & 1 deletion modules/examples/shared/src/main/scala/server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object server extends IOApp.Simple {
EmberServerBuilder
.default[IO]
.withHttpApp(_)
.withPort(port"8080")
.withPort(port"9777")
.withHost(host"localhost")
.build
)
Expand Down
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.7")
// Set me up for CI release, but don't touch my scalacOptions!
addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.6.7")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")
addSbtPlugin("com.indoorvivants.vcpkg" % "sbt-vcpkg-native" % "0.0.20")

0 comments on commit c3ad95a

Please sign in to comment.