Migrate to sbt2 - #7
Merged
Merged
Conversation
Relocate comport.scala to src/main/scala/dev/capslock/comport/Main.scala, strip scala-cli directives, and add the package declaration. Anchor the `comport`/`Comport` .gitignore patterns to the repo root so they do not match the new source directory.
Introduce build.sbt, project/build.properties, and project/plugins.sbt to build comport with sbt 2.0.2 and sbt-scala-native 0.5.12 on Scala 3.8.2. The native config keeps the previous release-fast / full LTO / commix GC settings and appends whitespace-separated flags from the LINKFLAGS environment variable so the static-link path from the Alpine container build still works.
Replace the scala-cli invocation with `sbt nativeLink`; native config now lives in build.sbt, so build.sh just exports LINKFLAGS and copies the produced binary at target/scala-3.8.2/comport-out to ./comport for compatibility with existing callers (README, CI upload paths).
Swap `coursier launch scala-cli` for `coursier install sbt` in the Dockerfile so the container ships a sbt wrapper on PATH, and drop the SCALA_CLI_LAUNCH override from build-with-container.sh (build.sh now defaults to `sbt`). JDK 17 headless is already installed, which meets sbt 2's runtime requirement.
- Compile and macOS jobs: install Temurin 17 and sbt via actions/setup-java + sbt/setup-sbt, then run `sbt compile` / `./build.sh`. - Release Linux job: reuse `./build-with-container.sh` (Alpine + sbt image) instead of an inline `docker run` that installed scala-cli each time, matching the CI Linux path and removing the previous inline LTO=thin divergence (release now uses full LTO like build.sbt specifies).
sbt-scala-native 0.5.12 on sbt 2 puts the produced binary at `target/out/native0.5/scala-<binVer>/<name>/<name>`, not the sbt 1 `target/scala-<binVer>/<name>-out` layout that build.sh initially copied from. Verified locally that `./build.sh` now produces a working `./comport`.
Replace scala-cli instructions with `sbt run` for iteration and `./build.sh` for producing the native binary, matching the new build.
Add `target/`, `project/target/`, and `project/project/` to .gitignore so sbt's build outputs stop showing up in `git status`.
Repository policy requires all actions be pinned to a full-length commit SHA rather than a tag reference. Resolve each `@vN` tag through the GitHub API and pin the workflows accordingly. Tag comments are preserved alongside so the intended version stays visible.
sbt 2's default launcher runs the sbtn thin client, whose distributed binary is glibc-linked and does not execute on Alpine (musl); the extraction path also picks unzip on non-linux-gnu OSTYPE, which is not installed in the builder image. Pass `--server` in build.sh so the launcher sets use_sbtn=0 and skips sbtn entirely, matching sbt 1 behavior. SBT_NATIVE_CLIENT is not usable here because the launcher only consults it in the enabling direction.
sbt 2 injects bare top-level settings into all subprojects (including
the implicit root), which replaces the role ThisBuild used to play, and
bare `enablePlugins(...)` applies to the implicit root project as well
(pattern used by e.g. `sbt-app/src/sbt-test/nio/code-formatter/build.sbt`
in the sbt 2.0.2 source tree). Drop the explicit
`lazy val comport = project.in(file("."))` scaffolding and ThisBuild
scoping accordingly. Verified locally with `sbt --server nativeLink` and
`./build.sh`.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.