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

Build plugins for Windows ARM64 #611

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions cmd/plugin/builder/command/cli_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,17 @@ var archMap = map[cli.Arch]targetBuilder{
},
}
},
cli.WinARM64: func(pluginName, outPath string) target {
return target{
env: []string{
"GOARCH=arm64",
"GOOS=windows",
},
args: []string{
"-o", filepath.Join(outPath, cli.MakeArtifactName(pluginName, cli.WinARM64)),
},
}
},
}

func (p *plugin) compile() error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PLUGIN_DEBUG=false
endif

# Add supported OS-ARCHITECTURE combinations here
PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 darwin-arm64 linux-arm64
PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 linux-arm64 darwin-arm64 windows-arm64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering we are adding the linux-arm64 as well, should we mention linux-arm64 in the PR description as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion, I just reordered the list so it was consistent: linux-arm64 was already there, just in a different order.


# Paths and Directory information
ROOT_DIR := $(shell git rev-parse --show-toplevel)
Expand Down
17 changes: 12 additions & 5 deletions pkg/cli/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ import (
)

var (
// MinOSArch defines minimum OS/ARCH combination for which plugin needs to be built
// MinOSArch defines the minimum OS/ARCH combinations for which plugins need to be built
MinOSArch = []Arch{LinuxAMD64, DarwinAMD64, WinAMD64}

// AllOSArch defines all OS/ARCH combination for which plugin can be built
AllOSArch = []Arch{LinuxAMD64, DarwinAMD64, WinAMD64, DarwinARM64, LinuxARM64}
// AllOSArch defines all OS/ARCH combinations for which plugins can be built
AllOSArch = []Arch{LinuxAMD64, DarwinAMD64, WinAMD64, LinuxARM64, DarwinARM64, WinARM64}

GOOS = runtime.GOOS
// GOOS is the current go os. Defaults to runtime.GOOS but could be overridden.
// The CLI code should always this variable instead of runtime.GOOS.
GOOS = runtime.GOOS
// GOARCH is the current go architecture. Defaults to runtime.GOARCH but is overridden
// for scenarios like installing AMD64 plugins on an ARM64 machine using emulation.
// The CLI code should always this variable instead of runtime.GOARCH.
GOARCH = runtime.GOARCH
)

Expand All @@ -35,7 +40,7 @@ func SetArch(a Arch) {

// IsWindows tells if an arch is windows.
func (a Arch) IsWindows() bool {
if a == Win386 || a == WinAMD64 {
if a == Win386 || a == WinAMD64 || a == WinARM64 {
return true
}
return false
Expand Down Expand Up @@ -79,4 +84,6 @@ const (
Win386 Arch = "windows_386"
// WinAMD64 arch.
WinAMD64 Arch = "windows_amd64"
// WinARM64 arch.
WinARM64 Arch = "windows_arm64"
)
2 changes: 1 addition & 1 deletion plugin-tooling.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PLUGIN_DEBUG=false
endif

# Add supported OS-ARCHITECTURE combinations here
PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 darwin-arm64 linux-arm64
PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 linux-arm64 darwin-arm64 windows-arm64

# Paths and Directory information
ROOT_DIR := $(shell git rev-parse --show-toplevel)
Expand Down
2 changes: 1 addition & 1 deletion test/sample-plugin/plugin-tooling.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PLUGIN_DEBUG=false
endif

# Add supported OS-ARCHITECTURE combinations here
PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 darwin-arm64 linux-arm64
PLUGIN_BUILD_OS_ARCH ?= linux-amd64 windows-amd64 darwin-amd64 linux-arm64 darwin-arm64 windows-arm64

# Paths and Directory information
SAMPLE_PLUGIN_ROOT_DIR := $(shell pwd)
Expand Down
Loading