build-tools
build-tools copied to clipboard
Updating `depot_tools` requires Xcode but doesn't ensure that Xcode exists
Operating System
macOS 13.5.1, arm64
To Reproduce
- If you already have everything installed, remove
~/.electron_build_tools/third_party/Xcode
. - Set up your local Electron environment.
-
Install
build-tools
. - In the
electron
directory, rune init --root=~/electron depot-tools-testing
.
Expected Behavior
Everything to work correctly.
Actual Behavior
The following was logged:
Checking for build-tools updates
Running "git pull --rebase --autostash" in /Users/ntautges/.electron_build_tools
build-tools is up-to-date
Creating /Users/ntautges/electron
Cloning "depot_tools" into /Users/ntautges/.electron_build_tools/third_party/depot_tools
Updating /Users/ntautges/.electron_build_tools/third_party/depot_tools
Running "/Users/ntautges/.electron_build_tools/third_party/depot_tools/update_depot_tools"
Updating depot_tools...
xcrun: error: missing DEVELOPER_DIR path: /Users/ntautges/.electron_build_tools/third_party/Xcode/Xcode.app
depot_tools update failed. Couldn't fetch main branch.
Retry later or reclone depot_tools
xcrun: error: missing DEVELOPER_DIR path: /Users/ntautges/.electron_build_tools/third_party/Xcode/Xcode.app
ERROR Error: Command failed: /Users/ntautges/.electron_build_tools/third_party/depot_tools/update_depot_tools
at checkExecSyncError (node:child_process:885:11)
at Object.execFileSync (node:child_process:921:15)
at depotExecFileSync (/Users/ntautges/.electron_build_tools/src/utils/depot-tools.js:131:23)
at updateDepotTools (/Users/ntautges/.electron_build_tools/src/utils/depot-tools.js:18:5)
at Object.ensureDepotTools [as ensure] (/Users/ntautges/.electron_build_tools/src/utils/depot-tools.js:30:5)
at runGClientConfig (/Users/ntautges/.electron_build_tools/src/e-init.js:79:9)
at ensureRoot (/Users/ntautges/.electron_build_tools/src/e-init.js:109:5)
at Command.<anonymous> (/Users/ntautges/.electron_build_tools/src/e-init.js:179:7)
at Command.listener [as _actionHandler] (/Users/ntautges/.electron_build_tools/node_modules/commander/lib/command.js:480:17)
Additional Information
If you create the config by removing ~/electron
and running e init --root=~/electron depot-tools-testing
and run e sync
, it also happens:
Creating /Users/ntautges/electron/src
Running "gclient sync --with_branch_heads --with_tags -vv" in /Users/ntautges/electron/src
Updating depot_tools...
xcrun: error: missing DEVELOPER_DIR path: /Users/ntautges/.electron_build_tools/third_party/Xcode/Xcode.app
depot_tools update failed. Couldn't fetch main branch.
Retry later or reclone depot_tools
xcrun: error: missing DEVELOPER_DIR path: /Users/ntautges/.electron_build_tools/third_party/Xcode/Xcode.app
ERROR Error: spawnSync /bin/sh ENOENT
at Object.spawnSync (node:internal/child_process:1110:20)
at spawnSync (node:child_process:871:24)
at Object.execSync (node:child_process:952:15)
at setRemotes (/Users/ntautges/.electron_build_tools/src/e-sync.js:29:8)
at runGClientSync (/Users/ntautges/.electron_build_tools/src/e-sync.js:62:5)
at Command.<anonymous> (/Users/ntautges/.electron_build_tools/src/e-sync.js:77:7)
at Command.listener [as _actionHandler] (/Users/ntautges/.electron_build_tools/node_modules/commander/lib/command.js:480:17)
at /Users/ntautges/.electron_build_tools/node_modules/commander/lib/command.js:1234:65
at Command._chainOrCall (/Users/ntautges/.electron_build_tools/node_modules/commander/lib/command.js:1151:12)
at Command._parseCommand (/Users/ntautges/.electron_build_tools/node_modules/commander/lib/command.js:1234:27)
The built-in version of git on macOS is a shim around the Xcode Command Line Tools install, so when DEVELOPER_DIR
is set when e load-xcode
hasn't been run yet, it looks to an installation of Xcode that hasn't yet been installed and causes the error.
e build
ensures that Xcode is installed before running. Would doing that some thing for e init
and e sync
(and whatever other commands need it) be a proper fix for this? Regardless, I'd be willing to take a crack at it.
Thank you for taking a look at this.
@NoelTautges i think that's reasonable! Feel free to request me on the PR.