Watch Xcode version metadata to invalidate repository config #655
what if we just always watched /var/db/xcode_select_link/../version.plist if it existed (i imagine in the CLT case it would not?) that way we could avoid the xcode-select call. might also have to consider /var/db/xcode_select_link/Contents/version.plist, i'd have to check if it normalizes that symlink to Contents/Developer or not
@keith hrm. That could avoid the subprocess when DEVELOPER_DIR is unset. Do you think we still need to handle the override? On my machine /var/db/xcode_select_link points to CLT, but builds select Xcode through --repo_env=DEVELOPER_DIR. I’ll check the symlink layout and whether we can derive the plist paths directly for both cases. I’d keep watching Info.plist alongside version.plist, since the locator reads the release version from one and the build number from the other.
Did a bit of cleanup, lmk 🙏
what do we get from watching both?
if we run run_xcode_locator we might as well watch every xcode in the result, if we can easily get those from the existing call
what does this watch do? either way we probably want it after the .exists call?
can you simplify this to only have selected_path?
ah i see now we are doing that, i'd throw in a comment about how that is elsewhere
looking viable to me!
The locator reads CFBundleShortVersionString from Info.plist and ProductBuildVersion from Version.plist, so this catches build-only updates even when the release version stays the same.
This watches the selected path appearing or disappearing. It needs to precede the .exists check so we also track a currently missing selection becoming available. Atleast that was my thought process but do you think this is still viable after exists?
Yep, run_xcode_locator already watches the version metadata for every Xcode it discovers. I'll add a comment at this call site to make that clear
Done!
@keith Added some more cleanup if you can review when you get a chance, thank you!
isn't version.plist enough?
% plutil -p version.plist
{
"BuildVersion" => "2"
"CFBundleShortVersionString" => "26.5"
"CFBundleVersion" => "24943"
"ProductBuildVersion" => "17F42"
"ProjectName" => "IDEApplication"
"SourceVersion" => "24943000000000000"
}
seems like this has all the version components but realistically just the ProductBuildVersion here is probably enough?
Hmmm, yeah I think that is likely fine then, pushed it
Should be good now, thanks! @keith
Approved these changes.
keith
ssarad
Watch
Contents/Info.plistandContents/version.plistso upgrading Xcode at the same path invalidates the repository and reruns discovery.