Skip to content

Commit

Permalink
Add SBT-Crossproject
Browse files Browse the repository at this point in the history
  • Loading branch information
vbergeron-ledger committed Nov 22, 2023
1 parent c7fe4d7 commit b2b6aa9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
run: sbt scalafmtCheck

- name: Build and test with SBT
run: sbt test
run: sbt sailJVM/test

4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
${{ runner.os }}-sbt-
- name: Build Scala Native artifacts
run: sbt nativeLink
run: sbt sailNative/nativeLink

- name: Create release
id: create_release
Expand All @@ -48,6 +48,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/scala-3.3.1/sail-out
asset_path: ./.native/target/scala-3.3.1/sail-out
asset_name: sail
asset_content_type: application/octet-stream
27 changes: 16 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
enablePlugins(ScalaNativePlugin)
import scala.scalanative.build._
lazy val sharedSettings = Seq(
name := "sail",
scalaVersion := "3.3.1"
)

nativeConfig ~= {
_.withLTO(LTO.thin)
.withMode(Mode.releaseFast)
.withGC(GC.none)
}

val sail = (project in file("."))
val sail = crossProject(JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("."))
.settings(sharedSettings)
.settings(
name := "sail",
scalaVersion := "3.3.1",
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "1.0.0-M8" % Test,
"com.lihaoyi" %%% "fastparse" % "3.0.2",
"com.monovore" %%% "decline" % "2.4.1"
)
)
.nativeSettings {
import scala.scalanative.build._
nativeConfig ~= { nc =>
nc.withLTO(LTO.thin)
.withGC(GC.none)
.withMode(Mode.releaseFull)
}
}
1 change: 1 addition & 0 deletions native/src/main/scala/SailNative.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
object SailNative extends sail.Sail
7 changes: 5 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
4 changes: 3 additions & 1 deletion src/main/scala/sail/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ final case class Args(
source: String
)

object Sail
class Sail
extends CommandApp(
name = "sail",
header = "A Functional, Declarative Dockerfile generator",
Expand Down Expand Up @@ -288,3 +288,5 @@ object Sail
.map(run)
}
)

object SailJVM extends Sail

0 comments on commit b2b6aa9

Please sign in to comment.