8000 Fix macOS Intel architecture detection by MSDarwish2000 · Pull Request #356 · gradle/native-platform · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix macOS Intel architecture detection #356

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public String getArchitectureName() {
// On macOS, the architecture field contains the CPU name, not the architecture
if (machineArchitecture.startsWith("Apple")) {
return "arm64";
}
if (machineArchitecture.startsWith("Intel")) {
} else if (machineArchitecture.contains("Intel") || machineArchitecture.startsWith("AMD")) {
return "x86_64";
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.rubygrapefruit.platform.internal

import net.rubygrapefruit.platform.NativePlatformSpec
import net.rubygrapefruit.platform.SystemInfo

class MutableSystemInfoTest extends NativePlatformSpec {

def "can get architecture on macOS"() {
given:
def systemInfo = new MutableSystemInfo()
systemInfo.osName = "Darwin"

when:
systemInfo.machineArchitecture = processor

then:
systemInfo.architecture == expectedArchitecture

where:
processor | expectedArchitecture
// Officially supported macOS processors
"Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz" | SystemInfo.Architecture.amd64
"Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz" | SystemInfo.Architecture.amd64
"Intel(R) Xeon(R) W-3223 CPU @ 3.50GHz" | SystemInfo.Architecture.amd64

// Newer Intel processors
"11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz" | SystemInfo.Architecture.amd64
"12th Gen Intel(R) Core(TM) i7-12650HX" | SystemInfo.Architecture.amd64
"13th Gen Intel(R) Core(TM) i5-13600K" | SystemInfo.Architecture.amd64
"Intel(R) Core(TM) Ultra 7 255H" | SystemInfo.Architecture.amd64

// AMD processors
"AMD Ryzen 5 2600 Six-Core Processor" | SystemInfo.Architecture.amd64
"AMD Athlon(tm) II X2 215 Processor" 57AC | SystemInfo.Architecture.amd64

// Apple processors
"Apple M1" | SystemInfo.Architecture.aarch64
"Apple M1 Pro" | SystemInfo.Architecture.aarch64
"Apple M2" | SystemInfo.Architecture.aarch64
"Apple M3" | SystemInfo.Architecture.aarch64
"Apple M4" | SystemInfo.Architecture.aarch64
}
}
Loading
0