-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
refactor: strongly typed values in BuildSettings
and BuildFileSettings
#903
base: main
Are you sure you want to change the base?
Conversation
BuildSettings
and BuildFileSettings
The settings here are constrained to two cases, one as a string and one as a string array as defined here: https://buck.build/javadoc/com/facebook/buck/apple/xcode/xcodeproj/PBXBuildFile.html Given the narrow use case we should constraint the available types here to fit the need.
46ac0d6
to
791afe0
Compare
a28c2ff
to
bf96639
Compare
- Updates to xcdiff for compatibility with tuist/XcodeProj#903 - Build setting values are no longer type erased and instead can now either be a `String` or `[String]` - This alleviates the need to casting values and throwing errors when dealing with build settings Test Plan: - Verify CI passes Signed-off-by: Kassem Wridan <[email protected]>
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.
Thanks @waltflanagan this is a much needed change! 👌
Indeed this is source breaking and would likely need a major release
e.g. updates needed for xcdiff
bloomberg/xcdiff#145
// func XCTAssertEqual(_ lhs: BuildSettings, _ rhs: BuildSettings, file: StaticString = #file, line: UInt = #line) { | ||
// XCTAssertEqual(lhs as NSDictionary, | ||
// rhs as NSDictionary, | ||
// file: file, | ||
// line: line) | ||
// } |
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.
Is this still needed?
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.
probably not
@kwridan thats what i was afraid of. I'll see if i can find some time to put together a 9.0 checklist so we can identify anything else that we may want to break There are some other Do you think it would be worth a transitional phase that preserves |
I wouldn't shy away from a a major release for this per se as there are already a few compatibility APIs lying around that could do with a clean up: e.g. You are right, there are other collections (e.g. Another accessor could be exposed with the strong types |
XcodeGen introduced the ability to include whole `PBXObject` values within these dictionaries which end up being written to the project as their reference string value. In order to simplify the attributes interface, i’m removing that capability and consumers will need to do their own unwrapping.
for (reference, value) in targetAttributeReferences { | ||
plistTargetAttributes[reference.value] = value.mapValues { value in | ||
(value as? PBXObject)?.reference.value ?? value |
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.
This was added as a feature for XcodeGen
to be able to easily work with these values. This complicates support for strong types though and the migration due to the removal of this change would be to set the .string(object.reference.value)
instead of just object
at the callsites.
Short description 📝
Mostly work that was done on the
9.0.0
branch that shouldn't be coupled to Sendability changes.This introduces the
BuildSetting
type that will allow safer manipulation of build settings and set us with more typesafety when working with build settings that have constraints.Keys issues are that this introduces source breaking changes with the signature of the
BuildSettings
typealias.