Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(binaries): support arm64 CLI & engine binaries #874

Merged
merged 5 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions binaries/binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const PrismaVersion = "4.15.0"
const EngineVersion = "70a9adfd11f836696eca398396544fe07a8d8edb"

// PrismaURL points to an S3 bucket URL where the CLI binaries are stored.
var PrismaURL = "https://packaged-cli.prisma.sh/%s-%s-%s-x64.gz"
var PrismaURL = "https://packaged-cli.prisma.sh/%s-%s-%s-%s.gz"

// EngineURL points to an S3 bucket URL where the Prisma engines are stored.
var EngineURL = "https://binaries.prisma.sh/all_commits/%s/%s/%s.gz"
Expand Down Expand Up @@ -54,7 +54,8 @@ func init() {
// PrismaCLIName returns the local file path of where the CLI lives
func PrismaCLIName() string {
variation := platform.Name()
return fmt.Sprintf("prisma-cli-%s-x64", variation)
arch := platform.Arch()
return fmt.Sprintf("prisma-cli-%s-%s", variation, arch)
}

var baseDirName = path.Join("prisma", "binaries")
Expand Down
11 changes: 11 additions & 0 deletions binaries/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ func Name() string {
return runtime.GOOS
}

func Arch() string {
// should be x86 or arm64
if runtime.GOARCH == "amd64" {
return "x64"
} else if runtime.GOARCH == "arm64" {
return "arm64"
} else {
panic(fmt.Errorf("unsupported arch: %s", runtime.GOARCH))
}
stillmatic marked this conversation as resolved.
Show resolved Hide resolved
}

// CheckForExtension adds a .exe extension on windows (e.g. .gz -> .exe.gz)
func CheckForExtension(platform, path string) string {
if platform == "windows" {
Expand Down
Loading