Skip to content

Commit

Permalink
Add setting for WIT file name
Browse files Browse the repository at this point in the history
  • Loading branch information
danieletorelli committed May 8, 2024
1 parent 680acf0 commit 4f6d3ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/main/scala/cloud/golem/WasmComponentPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ object WasmComponentPlugin extends AutoPlugin {
)
lazy val wasmComponentWitPath = SettingKey[File](
"wasmComponentWitPath",
"Path to the wit file",
"Path to the WIT directory",
KeyRanks.Invisible
)
lazy val wasmComponentWitName = SettingKey[String](
"wasmComponentWitName",
"WIT filename without extension",
KeyRanks.Invisible
)
lazy val wasmComponentPackageName = SettingKey[String](
Expand Down
9 changes: 4 additions & 5 deletions src/main/scala/cloud/golem/WasmComponentPluginInternal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ private[golem] object WasmComponentPluginInternal {
}

lazy val baseSettings: Seq[Setting[?]] = {
lazy val wasmComponentWitFullPath =
Def
.task(
wasmComponentWitPath.value / s"${wasmComponentPackageName.value}.wit"
)
lazy val wasmComponentWitFullPath = Def.task(
wasmComponentWitPath.value / s"${wasmComponentWitName.value}.wit"
)
Def.settings(
wasmComponentOutputDirectory := target.value / "dist",
wasmComponentWitPath := (ThisBuild / baseDirectory).value / "wit",
wasmComponentPackageName := moduleName.value,
wasmComponentWitName := wasmComponentPackageName.value,
wasmComponentWitBindgen := {
if (!wasmComponentWitFullPath.value.exists()) {
sys.error(s"""
Expand Down

0 comments on commit 4f6d3ab

Please sign in to comment.