Skip to content

Commit

Permalink
Generate pkg package for m1
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Sep 30, 2022
1 parent b2f7ee1 commit cfb062a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
14 changes: 10 additions & 4 deletions .github/scripts/generate-os-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ generate_rpm() {
}

generate_pkg() {
arch=$1
packager \
--pkg \
--version "$(version)" \
--source-app-path "$(launcher)" \
--output "$ARTIFACTS_DIR/scala-cli-x86_64-apple-darwin.pkg" \
--output "$ARTIFACTS_DIR/scala-cli-$arch-apple-darwin.pkg" \
--identifier "scala-cli" \
--launcher-app "scala-cli"
}
Expand Down Expand Up @@ -129,13 +130,18 @@ generate_sdk() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
generate_deb
generate_rpm
generate_sdk
elif [[ "$OSTYPE" == "darwin"* ]]; then
generate_pkg
if [ "$(uname -m)" == "aarch64" ]; then
generate_pkg "aarch64"
else
generate_pkg "x86_64"
generate_sdk
fi
elif [[ "$OSTYPE" == "msys" ]]; then
generate_msi
generate_sdk
else
echo "Unrecognized operating system: $OSTYPE" 1>&2
exit 1
fi

generate_sdk
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ jobs:
jvm: "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-darwin-aarch64-22.2.0.tar.gz"
- name: Generate native launcher
run: .github/scripts/generate-native-image.sh
# - run: ./mill -i ci.setShouldPublish
# - name: Build OS packages TODO generate os packages for M1
# if: env.SHOULD_PUBLISH == 'true'
# run: .github/scripts/generate-os-packages.sh
- run: ./mill -i ci.setShouldPublish
- name: Build OS packages TODO generate os packages for M1
if: env.SHOULD_PUBLISH == 'true'
run: .github/scripts/generate-os-packages.sh
- name: Copy artifacts
run: ./mill -i copyDefaultLauncher artifacts/
- uses: actions/upload-artifact@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class NativePackagerTests extends ScalaCliSuite {
val pkgAppPath = root / pkgAppFile
expect(os.isFile(pkgAppPath))

if (TestUtil.isCI && !TestUtil.isArmArchitecture) {
if (TestUtil.isCI) {
os.proc("installer", "-pkg", pkgAppFile, "-target", "CurrentUserHomeDirectory").call(
cwd = root,
stdin = os.Inherit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package scala.cli.integration
import os.{CommandResult, Path}

import java.io.File
import java.util.Locale
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.{ExecutorService, Executors, ScheduledExecutorService, ThreadFactory}

Expand All @@ -21,9 +20,6 @@ object TestUtil {
val detectCliPath = if (TestUtil.isNativeCli) TestUtil.cliPath else "scala-cli"
val cli: Seq[String] = cliCommand(cliPath)

lazy val isArmArchitecture: Boolean =
sys.props.getOrElse("os.arch", "").toLowerCase(Locale.ROOT) == "aarch64"

def cliCommand(cliPath: String): Seq[String] =
if (isNativeCli)
Seq(cliPath)
Expand Down

0 comments on commit cfb062a

Please sign in to comment.