Skip to content

Commit 103403d

Browse files
committed
Updates and readme
1 parent dc3511d commit 103403d

7 files changed

Lines changed: 57 additions & 29 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ docs/mdoc-invocation.txt
2121
local-bindgen
2222
worktree-main
2323
out
24+
.mcp.json

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"name": "Debug",
88
"program": "${workspaceRoot}/out/debug/app",
99
"cwd": "${workspaceRoot}",
10-
"preLaunchTask": "buildBinary",
10+
"preLaunchTask": "buildBinaryDebug",
1111
"args": [
1212
"5000",
1313
"1000"
1414
]
1515
}
1616
]
17-
}
17+
}

.vscode/tasks.json

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"label": "buildBinary",
6-
"command": "sbtn",
7-
"args": [
8-
"buildBinary",
9-
],
10-
"type": "shell"
11-
}
12-
]
13-
}
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build debug binary in ./out/debug",
6+
"command": "sbtn",
7+
"args": ["buildBinaryDebug"],
8+
"type": "shell",
9+
},
10+
{
11+
"label": "Build platform (name includes platform information) debug binary in ./out/debug",
12+
"command": "sbtn",
13+
"args": ["buildBinaryPlatformDebug"],
14+
"type": "shell",
15+
},
16+
{
17+
"label": "Build release binary in ./out/release",
18+
"command": "sbtn",
19+
"args": ["buildBinaryRelease"],
20+
"type": "shell",
21+
},
22+
{
23+
"label": "Build release platform (name includes platform information) binary in ./out/release",
24+
"command": "sbtn",
25+
"args": ["buildBinaryPlatformRelease"],
26+
"type": "shell",
27+
},
28+
],
29+
}

.zed/debug.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"label": "Build & Debug",
88
"build": {
99
"command": "sbtn",
10-
"args": ["buildBinary"]
10+
"args": ["buildBinaryDebug"],
1111
},
12-
"program": "$ZED_WORKTREE_ROOT/out/debug/app",
12+
"program": "./out/debug/app",
1313
"args": ["100", "50"],
1414
"request": "launch",
15-
"adapter": "CodeLLDB" // GDB is available on non arm macs as well as linux
16-
}
15+
"adapter": "CodeLLDB", // GDB is available on non arm macs as well as linux
16+
},
1717
]

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ MacOS (arm64, amd64).
77
Binaries are given descriptive platform-specific names, and upon creating a Github release
88
for a tag starting with `v`, binaries for all platforms are uploaded to release artifacts.
99

10+
SBT Commands to build the binary:
11+
- `buildBinaryDebug` – produces `./out/debug/app`
12+
- `buildBinaryRelease` – produces `./out/release/app`
13+
- `buildBinaryPlatformDebug` - produces `./out/debug/app-...` with platform specific information encoded in the name (e.g. `./out/debug/app-aarch64-apple-darwin`)
14+
- `buildBinaryPlatformRelease` - produces `./out/release/app-...` with platform specific information encoded in the name (e.g. `./out/release/app-aarch64-apple-darwin`)
15+
16+
Github workflows:
17+
- Main branch merges and PRs: CI ([ci.yml](./.github/workflows/ci.yml)) – just makes sure that `buildBinaryDebug` succeeds on all platforms
18+
- Tags: release ([release.yml](./.github/workflows/release.yml)) – builds platform specific binary using `buildBinaryPlatformRelease` and uploads all
19+
binaries as Github release assets
20+
1021
The project itself
1122

1223
- Uses latest Scala 3
@@ -24,7 +35,7 @@ Naming conventions loosely follow Coursier's practices.
2435

2536
This template includes very basic setup for debugging with VS Code and [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb).
2637

27-
You should have a `Debug` configuration available, which will automatically build a binary by invoking `sbtn buildBinary` command -
38+
You should have a `Debug` configuration available, which will automatically build a binary by invoking `sbtn buildBinaryDebug` command -
2839
so make sure you have sbtn installed (run `sbt installSbtn`).
2940

3041
Please note that debugging information in Scala Native is very experimental, so don't expect a rich debugging experience you can

build.sbt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import com.indoorvivants.detective.Platform
22

3-
lazy val common = Seq(
4-
scalaVersion := "3.8.3",
5-
nativeConfig ~= { c =>
6-
import scala.scalanative.build.*
7-
c.withSourceLevelDebuggingConfig(SourceLevelDebuggingConfig.enabled)
8-
}
9-
)
10-
113
lazy val root = project.in(file(".")).aggregate(lib, bin)
124

135
lazy val lib =
@@ -22,6 +14,14 @@ lazy val bin = project
2214
.dependsOn(lib)
2315
.settings(common)
2416
.settings(
25-
buildBinaryConfig ~= {_.withName("app")}
17+
buildBinaryConfig ~= { _.withName("app") }
2618
)
2719

20+
lazy val common = Seq(
21+
scalaVersion := "3.8.3",
22+
nativeConfig ~= { c =>
23+
import scala.scalanative.build.*
24+
c.withSourceLevelDebuggingConfig(SourceLevelDebuggingConfig.enabled)
25+
.withIncrementalCompilation(true)
26+
}
27+
)

mod/bin/src/main/scala/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package sn_test.bin
33
import sn_test.lib.Lib
44

55
@main def hello(x: Int, y: Int) =
6-
val z = x + y
6+
val z = x + y + 2
77
println(Lib.addition(x, y))

0 commit comments

Comments
 (0)