-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Better heuristic for finding the .xcodeproj directory #471
Conversation
Ha, I should have looked at the pull requests first, #461 implements pretty much the same heuristic! But this pull request adds better error messages in addition to this new heuristic. |
static NSString *const ATZInstallerErrorDomain = @"ATZInstallerErrorDomain"; | ||
NS_ENUM(NSInteger) | ||
{ | ||
ATZInstallerXcodeProjectNotFoundError = 666, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 🔥 🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kattrali is that good or bad fire? 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guillaume-algis @kattrali knows fires, she has the best fires!
Ha! It's really close to what I was doing with #461 indeed :) #461 was stalled because I didn't take the time to test that all packages (color schemes and templates included) still installed fine after the change. Did you test your implementation on all packages?
Anyway, appart a few things (I'll comment inline), I'd be ok to merge your PR instead of #461 (if it's tested against all packages 😉). |
[allXcodeProjFilenames addObject:directoryEntry]; | ||
} | ||
|
||
if ([directoryEntry isEqualToString:@".git"]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the performance gain from skipping .git
, but isn't it premature optimization? Did you encounter a real-world case where scanning the .git
folder was a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I changed it in 609b8f4.
I’m not sure if you are serious or not. I don’t think testing against all packages will bring value. This PR is about getting more packages to install. If some are still failing to install after this PR is merged, we should handle the issues on a per package basis IMHO. |
@0xced So sorry if I wasn't clear. I am serious, but the goal is to ensure that we don't break the install process for the plugins which are already working today.
Agreed! |
I took care of keeping the current behaviour of returning the .xcodeproj as soon as found if it has the same name as the package, so the risk of breaking existing packages is extremely low. |
Thanks for the contribution @0xced! 🍺 👍 when @guillaume-algis is ok to merge |
I hacked together an ugly script to install all packages on my machine. Will report tomorrow on the findings. Thanks for your patience @0xced! |
If anything, it would be nice to make sure that we install more packages correctly this way |
After merging this PR, the following packages will install correctly instead of failing:
This does not break any plugin which previously installed, as expected 🎉 Full report here: https://gist.github.com/guillaume-algis/1da584f0964e94803056782394137e6e One final thing before merging: I think this deserves a minor version number bump, not just a patch (I consider this to be more than just a bugfix), wdyt? |
Great! Looks like a good improvement then. I agree on the version bump. 👍 |
Done. |
@jurre @kattrali @supermarin what do you think? LGTM? |
Thank you @supermarin! @0xced do you mind rebasing on top of master once more? Thanks! |
The "Make the Mac Great Again" plugin would not install because Alcatraz assumes that the .xcodeproj has the exact same name as the package. This may not be true, for example "Make the Mac Great Again" xcodeproj file is "MakeTheMacGreatAgain.xcodeproj" (without the spaces). This new heuristic searches for all .xcodeproj and works fine if only one exists in the cloned directory.
* Define constants for error domains and error codes * Bubble up errors and present them to the user instead of just logging them
This is probably premature optimization, so better have smaller code.
Sure, I just rebased. |
👍 Ugh. We need to re-approve. @supermarin ? Edit: And the comment-parsing by pullapprove doesn't seems to work for some reason. I approved manually on pullapprove.com 🤔 |
Thanks @jurre ! 🙂 |
Thanks @0xced and @guillaumealgis :) |
The "Make the Mac Great Again" plugin would not install because Alcatraz assumes that the .xcodeproj has the exact same name as the package. This may not be true, for example "Make the Mac Great Again" xcodeproj file is "MakeTheMacGreatAgain.xcodeproj" (without the spaces).
This new heuristic searches for all .xcodeproj and works fine if only one exists in the cloned directory.
I also refactor error handling for better diagnostics when things go wrong.