Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same target attributes but triggers value mismatch #119

Closed
carrepbearep opened this issue Dec 19, 2022 · 10 comments
Closed

Same target attributes but triggers value mismatch #119

carrepbearep opened this issue Dec 19, 2022 · 10 comments

Comments

@carrepbearep
Copy link

carrepbearep commented Dec 19, 2022

Describe the bug
For my project file, I've added several SystemCapabilities attributes to the project file (shown in the screenshot). However, when running xcdiff between the project file and its exact duplicate, the tool picks up on these attribute differences and triggers a Value Mismatch. The attributes are still the same even in the diff log, just listed in different orders.
Additionally, every time xcdiff is run on the same 2 project files, the SystemCapabilities attribute order for both of them changes, without changing the project file itself.

I would appreciate any help with this bug!! Thank you!

To Reproduce
Steps to reproduce the behavior:

  1. Add multiple SystemCapabilities attributes to a target in the project file
  2. Duplicate the project file
  3. Run xcdiff on the project file and its duplicate
  4. See error

Expected behavior
xcdiff should not pick up on differences between the project files because their attributes are the same. The order of the attributes should not matter.

Screenshots
Screen Shot 2022-12-19 at 2 52 52 PM
Screen Shot 2022-12-19 at 2 56 06 PM

Environment (please complete the following information):

  • Operating System and Version: macOS 12.6.1

Additional context
I am using XcodeGen to generate the project file. However, it generates the same attributes in the same order every time.

@marciniwanicki
Copy link
Contributor

marciniwanicki commented Dec 29, 2022

Hi @carrepbearep, many thanks for the very detailed ticket. I think I understand the source of this issue, but wasn't able to reproduce it by just using Xcode 14. The capabilities toggled in the Xcode UI are reflected in the entitlements file, not in the xcodeproj file itself (perhaps I missed some settings).
I added a small unit test which is triggering this issue and drafted a possible fix https://github.com/marciniwanicki/xcdiff/tree/mi/119-system-capabilities-ordering-issue.
Could you please check if that helps? We have a short info how to build xcdiff locally https://github.com/bloomberg/xcdiff/blob/main/Documentation/Installation.md#building-from-source. Feel free to ping me if you need any help :)

@carrepbearep
Copy link
Author

Thanks for your response @marciniwanicki !!
I cloned the repo, applied your changes, built the project, and then ran xcdiff against the project files again and I am unfortunately still having the same issue. Are these the correct steps to test the changes?

@marciniwanicki
Copy link
Contributor

Thanks @carrepbearep for checking the branch and instant feedback, I truly appreciate it. It's very likely the implementation isn't quire right. I've just pushed a small update to also sort "target attributes" (20fcbb7), not sure if that will help.
You can always check if you're using the "local" build by calling "xcdiff --version", normal releases will print something like "0.9.0+0e6a933", however, when building locally you should see "0.9.0+local" (for release build) or "0.9.0+debug.local" (for debug).
I wonder if you could paste here or via gist a fragment of your project file with attributes (including "SystemCapabilities")? I can try to add it to our Fixtures.

@carrepbearep
Copy link
Author

carrepbearep commented Dec 30, 2022

Thank you so much for your help!! These changes worked on my project files! Seems like sorting them did the trick :)
And thanks for updating with these changes so fast! You've been immensely helpful

Would you still like a sample of my project file? Which parts would be most helpful to you to see? Mine is rather lengthy (~50,000 lines)

@marciniwanicki
Copy link
Contributor

@carrepbearep, glad the fix it working :) If you can paste here just the "SystemCapabilities" dictionary, that would be helpful, alternatively I can retype it or get it via OCR :) ie no worries if you are busy. I will try to extend out fixtures.

@carrepbearep
Copy link
Author

Heres the dictionary, let me know if you need anything else!

CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 1020;
SystemCapabilities = {
  com.apple.ApplicationGroups.iOS = {
    enabled = 1;
  };
  com.apple.BackgroundModes = {
    enabled = 1;
  };
  com.apple.DataProtection = {
    enabled = 1;
  };
  com.apple.Keychain = {
    enabled = 1;
  };
  com.apple.Push = {
    enabled = 1;
  };
  com.apple.SafariKeychain = {
    enabled = 1;
  };
  com.apple.Siri = {
    enabled = 1;
  };
};

@marciniwanicki
Copy link
Contributor

Many thanks @carrepbearep, that's exactly what I needed. I will try to make the branch ready for PR tomorrow.

@carrepbearep
Copy link
Author

Sounds good, keep me updated!

@marciniwanicki
Copy link
Contributor

Hi @carrepbearep, we're almost there :) I will ask @kwridan on Monday to review the PR (#122), and if all goes well, the same day we will release 0.10.0.

@carrepbearep
Copy link
Author

That's great!! Thanks for the update :) Let me know once it's been released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants