Skip to content

Commit cf5bb1b

Browse files
authored
Update 7-graal-native-executables.adoc
1 parent c2ff65b commit cf5bb1b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

blog/modules/ROOT/pages/7-graal-native-executables.adoc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ portable get published only once across all platforms, while the native CPU-spec
561561
gets published once per platform
562562

563563
Each job overrides `artifactName` based on `os.name` and `os.arch` such that it publishes to a
564-
different artifact on Maven Central:
564+
different artifact on Maven Central, and we override the default `publishArtifacts` to replace
565+
the default `.jar` artifact with our native image:
565566

566567
```scala
567568
def artifactOsSuffix = Task {
@@ -578,7 +579,11 @@ def artifactCpuSuffix = Task {
578579
}
579580
}
580581

581-
def artifactName = s"${super.artifactName()}-${artifactOsSuffix()}-${artifactCpuSuffix()}"
582+
override def artifactName = s"${super.artifactName()}-${artifactOsSuffix()}-${artifactCpuSuffix()}"
583+
584+
override def publishArtifacts = Task {
585+
super.publishArtifacts().copy(payload = Seq(nativeImage() -> artifactName()))
586+
}
582587
```
583588

584589
This results in the following artifacts being published:
@@ -598,6 +603,12 @@ These artifacts can be seen online:
598603

599604
- https://central.sonatype.com/search?q=mill-dist[Central Sonatype Search]
600605

606+
And downloaded via
607+
608+
```bash
609+
curl https://repo1.maven.org/maven2/com/lihaoyi/mill-dist-native-mac-aarch64/0.12.6/mill-dist-native-mac-aarch64-0.12.6.jar -o mill-dist-native.jar
610+
```
611+
601612
Any application using these binaries can similarly look at the OS/CPU they are running
602613
on and resolve the appropriate executable for them to use.
603614

0 commit comments

Comments
 (0)