Skip to content

Commit

Permalink
Native: use 22.3.0, switch to setup-graalvm
Browse files Browse the repository at this point in the history
The older version no longer handles the regular glibc case correctly,
resulting in linker errors, hence the need for an upgrade.

The newer version doesn't support the `-H:UseMuslC` option, hence the
need to upgrade to setup-graalvm action which supports musl toolchain
directly, requiring simply a flag.
  • Loading branch information
kitbellew committed Dec 11, 2022
1 parent 1d711d4 commit a68d118
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ jobs:
artifact: scalafmt-linux-musl
env:
NATIVE_IMAGE_STATIC: true
NATIVE_IMAGE_MUSL: /home/runner/work/scalafmt/scalafmt/bundle
NATIVE_IMAGE_MUSL: true
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: [email protected]
- if: matrix.libc == 'musl'
name: Install musl bundle
run: |
wget https://github.com/gradinac/musl-bundle-example/releases/download/v1.0/musl.tar.gz
tar xvf musl.tar.gz
version: '22.3.0'
java-version: '11'
components: 'native-image'
native-image-musl: ${{ matrix.libc == 'musl' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: bin/build-native-image.sh
env:
CI: true
Expand Down
19 changes: 8 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,15 @@ lazy val cli = project
),
scalacOptions ++= scalacJvmOptions.value,
Compile / mainClass := Some("org.scalafmt.cli.Cli"),
nativeImageVersion := "20.1.0",
nativeImageVersion := "22.3.0",
nativeImageInstalled := isCI,
nativeImageOptions ++= {
sys.env
.get("NATIVE_IMAGE_MUSL")
.map(path => s"-H:UseMuslC=$path")
.toSeq ++
sys.env
.get("NATIVE_IMAGE_STATIC")
.map(_.toBoolean)
.filter(identity)
.map(_ => "--static")
.toSeq
val isMusl = sys.env.get("NATIVE_IMAGE_MUSL").exists(_.toBoolean)
if (isMusl) Seq("--libc=musl") else Nil
},
nativeImageOptions ++= {
val isStatic = sys.env.get("NATIVE_IMAGE_STATIC").exists(_.toBoolean)
if (isStatic) Seq("--static") else Nil
}
)
.dependsOn(coreJVM, dynamic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ Args=--no-server \
--no-fallback \
--enable-http \
--enable-https \
--enable-all-security-services \
--install-exit-handlers \
--initialize-at-build-time \
--initialize-at-run-time=org.scalafmt.util.AbsoluteFile \
--report-unsupported-elements-at-runtime \
--verbose \
-H:EnableURLProtocols=http,https \
-H:+RemoveSaturatedTypeFlows \
-H:+ReportExceptionStackTraces

0 comments on commit a68d118

Please sign in to comment.