diff --git a/v2/internal/system/system_darwin.go b/v2/internal/system/system_darwin.go index 6d524603312..ef75f8256da 100644 --- a/v2/internal/system/system_darwin.go +++ b/v2/internal/system/system_darwin.go @@ -4,11 +4,13 @@ package system import ( - "github.com/wailsapp/wails/v2/internal/system/packagemanager" + "fmt" "os/exec" "strings" "syscall" + "github.com/wailsapp/wails/v2/internal/system/packagemanager" + "github.com/wailsapp/wails/v2/internal/system/operatingsystem" ) @@ -31,6 +33,15 @@ func (i *Info) discover() error { } i.OS = osinfo + i.Dependencies = append(i.Dependencies, checkXCodeSelect()) + i.Dependencies = append(i.Dependencies, checkNPM()) + i.Dependencies = append(i.Dependencies, checkXCodeBuild()) + i.Dependencies = append(i.Dependencies, checkUPX()) + i.Dependencies = append(i.Dependencies, checkNSIS()) + return nil +} + +func checkXCodeSelect() *packagemanager.Dependency { // Check for xcode command line tools output, err := exec.Command("xcode-select", "-v").Output() installed := true @@ -42,8 +53,8 @@ func (i *Info) discover() error { version = strings.TrimSpace(version) version = strings.TrimSuffix(version, ".") } - xcodeDep := &packagemanager.Dependency{ - Name: "xcode command line tools ", + return &packagemanager.Dependency{ + Name: "Xcode command line tools ", PackageName: "N/A", Installed: installed, InstallCommand: "xcode-select --install", @@ -51,9 +62,30 @@ func (i *Info) discover() error { Optional: false, External: false, } - i.Dependencies = append(i.Dependencies, xcodeDep) - i.Dependencies = append(i.Dependencies, checkNPM()) - i.Dependencies = append(i.Dependencies, checkUPX()) - i.Dependencies = append(i.Dependencies, checkNSIS()) - return nil +} + +func checkXCodeBuild() *packagemanager.Dependency { + // Check for xcode + output, err := exec.Command("xcodebuild", "-version").Output() + installed := true + version := "" + if err != nil { + installed = false + } else if l := strings.Split(string(output), "\n"); len(l) >= 2 { + version = fmt.Sprintf("%s (%s)", + strings.TrimPrefix(l[0], "Xcode "), + strings.TrimPrefix(l[1], "Build version ")) + } else { + version = "N/A" + } + + return &packagemanager.Dependency{ + Name: "Xcode", + PackageName: "N/A", + Installed: installed, + InstallCommand: "Available at https://apps.apple.com/us/app/xcode/id497799835", + Version: version, + Optional: true, + External: false, + } } diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 725b77206f1..06ebdc850c3 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added `OpenInspectorOnStartup` to debug options to allow opening the WebInspector during startup of the application in debug mode. Added by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2080) +- On macOS `wails doctor` now also shows the version of Xcode installed. Added by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2087) ### Fixed - The `noreload` flag in wails dev wasn't applied. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2081)