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

Fix unstable reads for XCSchemeManagement #758

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

kwridan
Copy link
Collaborator

@kwridan kwridan commented Apr 22, 2023

Resolves: #756

Short description 📝

  • Reading the same xcschememanagement.plist file was resulting in different XCSchemeManagement objects
  • This was due to the internal conversion of the schemeUserState from a dictionary to an array without sorting the dictionary key
  • This lead to having differently ordered XCSchemeManagement arrays each time the plist was read
  • Writes were stable (going from XCSchemeManagement > plist) is most likely why this wasn't previously noticed

Solution 📦

  • To address this, they dictionary elements are sorted by key name
  • Read stability tests have also been added and fixture updated to include more entries to aid with testing

Test Plan 🛠️

  • Verify unit tests pass
  • Verify writing an xcschememanagement.plist file remains unchanged by these changes

Notes 📝

it's unclear why the schemeUserState is stored as an array, it's a candidate to be changed to dictionary in the next major release as it would be a breaking change to do so now without any compatibility accessors to maintain the same public API.

Resolves: #756

- Reading the same `xcschememanagement.plist` file was resulting in different `XCSchemeManagement` objects
- This was due to the internal conversion of the `schemeUserState` from a dictionary to an array without sorting the dictionary key
- This lead to having differently ordered `XCSchemeManagement` arrays each time the plist was read
- Wrties were stable (going from `XCSchemeManagement` > `plist`) is most likely why this wasn't previously noticed
- To address this, they dictionary elements are sorted by key name
- Read stability tests have also been added and fixture updated to include more entries to aid with testing

Note: it's unclear why the `schemeUserState` is stored as an array, it's a candidate to be changed to dictionary in the next major release as it would be a breaking change to do so now without any compatibility accessors to maintain the same public API.

Test Plan:

- Verify unit tests pass
- Verify writing an `xcschememanagement.plist` file remains unchanged by these changes
@kwridan kwridan merged commit ceb3721 into main Apr 24, 2023
@kwridan kwridan deleted the fix/unstable-xcschememanagement branch April 24, 2023 07:05
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

Successfully merging this pull request may close these issues.

XCSchemeManagement reads from path are unstable
3 participants