Check and delete Xcode app at default search path
Type of Request
bug
Infrastructure Environment
Recipes
What is happening?
Recipes resets Xcode every build using xcode-select --reset. This command "Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism."
The default path is /Applications/Xcode.app.
If there is an Xcode app at /Applications/Xcode.app, that Xcode app gets selected.
Recipes does not download Xcode at the default directory, it downloads them in the cache path, which means the /Applications/Xcode.app was probably downloaded manually.
Having a unmanaged, potentially outdated Xcode version selected may cause problems such as https://github.com/flutter/flutter/issues/161655#issuecomment-2672312880
Steps to reproduce
No response
Expected results
No response
The triaged-infra label is irrelevant if there is no team-infra label or fyi-infra label.
This may be something we can't do from recipes due to permissions issues:
If you use rm -rf, you get rm: /Applications/Xcode.app: Permission denied
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac_arm64_ios%20hello_world_ios__compile/5/infra
If you use self.m.file.rmtree, you get [Errno 1] Operation not permitted: '/Applications/Xcode.app/Contents/_CodeSignature'
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_ios%20hello_world_ios__compile/17897/overview
As I mention here, we likely can't delete it. Perhaps instead, we can provide a warning?