[darwin] Show Xcode version in wails doctor (#2089)

This commit is contained in:
stffabi
2022-11-14 20:11:07 +11:00
committed by GitHub
parent 236570909c
commit efd209b7c5
2 changed files with 41 additions and 8 deletions
+40 -8
View File
@@ -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,
}
}
+1
View File
@@ -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/2089)
### Fixed
- The `noreload` flag in wails dev wasn't applied. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2081)