-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(engine-binary): adapt build tag generation (#1125)
- Loading branch information
Showing
3 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package platform | ||
|
||
import "strings" | ||
|
||
type Info struct { | ||
Platform string | ||
Arch string | ||
} | ||
|
||
func MapBinaryTarget(name string) Info { | ||
return Info{ | ||
Platform: mapBinaryTargetToPlatform(name), | ||
Arch: mapBinaryTargetToArch(name), | ||
} | ||
} | ||
|
||
func mapBinaryTargetToPlatform(name string) string { | ||
switch { | ||
case strings.Contains(name, "linux") || | ||
strings.Contains(name, "debian") || | ||
strings.Contains(name, "rhel") || | ||
strings.Contains(name, "musl"): | ||
return "linux" | ||
case strings.Contains(name, "darwin"): | ||
return "darwin" | ||
case strings.Contains(name, "windows"): | ||
return "windows" | ||
default: | ||
return "linux" | ||
} | ||
} | ||
|
||
func mapBinaryTargetToArch(name string) string { | ||
switch { | ||
case strings.Contains(name, "arm64"): | ||
return "arm64" | ||
default: | ||
return "!arm64" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters