Conversation

theSalted

When a building setting is set from an info.plist key, if the same key is set from another source. The previous one will be silently overwritten. This pull request added detectConflict() to detects if two PropertyListItem values are in conflict and emits an appropriate warning message if they are.

Note

#5 and #364 was accidentally closed, after a bot used to automatically sync fork matches my fork to main. This pr re-introduce those changes along with a test case.

Resolves #5

@theSalted

@owenv I have re-opened #364 and added a test-case. Thanks for your patience.

@owenv

@swift-ci test

@owenv

It looks like one of the existing tests might have exposed an issue here:

✘ Test diagnostics() recorded an issue at InfoPlistProcessorTaskTests.swift:157:13: Expectation failed: (outputDelegate.messages → ["warning: Type conflict for Info.plist key \'Integer\': integer from Info.plist will be replaced with array from additional content file \'/tmp/bad.plist\'", "error: tried to merge array value for key \'Integer\' onto integer value"]) == (errors.map { "error: \($0)" } → ["error: tried to merge array value for key \'Integer\' onto integer value"])
± inserted ["warning: Type conflict for Info.plist key \'Integer\': integer from Info.plist will be replaced with array from additional content file \'/tmp/bad.plist\'"]
↳ outputDelegate.messages: Swift.Array<Swift.String> → ["warning: Type conflict for Info.plist key \'Integer\': integer from Info.plist will be replaced with array from additional content file \'/tmp/bad.plist\'", "error: tried to merge array value for key \'Integer\' onto integer value"]
↳ errors.map { "error: \($0)" }: Swift.Array<Swift.String> → ["error: tried to merge array value for key \'Integer\' onto integer value"]
✘ Test diagnostics() recorded an issue at InfoPlistProcessorTaskTests.swift:157:13: Expectation failed: (outputDelegate.messages → ["warning: Type conflict for Info.plist key \'Array\': array from Info.plist will be replaced with string from additional content file \'/tmp/bad.plist\'", "error: tried to merge string value for key \'Array\' onto array value"]) == (errors.map { "error: \($0)" } → ["error: tried to merge string value for key \'Array\' onto array value"])
± inserted ["warning: Type conflict for Info.plist key \'Array\': array from Info.plist will be replaced with string from additional content file \'/tmp/bad.plist\'"]

from https://ci.swift.org/job/pr-swift-build-macos/554/

@theSalted

✘ Test diagnostics() recorded an issue at InfoPlistProcessorTaskTests.swift:157:13: Expectation failed: (outputDelegate.messages → ["warning: Type conflict for Info.plist key 'Integer': integer from Info.plist will be replaced with array from additional content file '/tmp/bad.plist'", "error: tried to merge array value for key 'Integer' onto integer value"]) == (errors.map { "error: ($0)" } → ["error: tried to merge array value for key 'Integer' onto integer value"])
± inserted ["warning: Type conflict for Info.plist key 'Integer': integer from Info.plist will be replaced with array from additional content file '/tmp/bad.plist'"]
↳ outputDelegate.messages: Swift.Array<Swift.String> → ["warning: Type conflict for Info.plist key 'Integer': integer from Info.plist will be replaced with array from additional content file '/tmp/bad.plist'", "error: tried to merge array value for key 'Integer' onto integer value"]
↳ errors.map { "error: ($0)" }: Swift.Array<Swift.String> → ["error: tried to merge array value for key 'Integer' onto integer value"]
✘ Test diagnostics() recorded an issue at InfoPlistProcessorTaskTests.swift:157:13: Expectation failed: (outputDelegate.messages → ["warning: Type conflict for Info.plist key 'Array': array from Info.plist will be replaced with string from additional content file '/tmp/bad.plist'", "error: tried to merge string value for key 'Array' onto array value"]) == (errors.map { "error: ($0)" } → ["error: tried to merge string value for key 'Array' onto array value"])
± inserted ["warning: Type conflict for Info.plist key 'Array': array from Info.plist will be replaced with string from additional content file '/tmp/bad.plist'"]

Thanks, it seems like diagnostics was expecting only error messages, but my implementation is adding warning messages about type conflicts in addition to the existing error messages. This is fixed now.

@owenv

@swift-ci test

@owenv

@swift-ci test macOS

@owenv

@swift-ci test linux

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

Successfully merging this pull request may close these issues.

Emit warnings when Info.plist key values from different user-supplied sources conflict