Sanitize the ends of folder source paths (#1341)

* Sanitize the ends of folder source paths

Setting the source: `/foo/bar` is _sometimes_ different from `/foo/bar/` even if `bar` is a folder in both cases. The result of this is that we often run into a race condition where we have two objects with the same hash but different properties. This fixes #1339 and #1131.

* Update CHANGELOG.md

* Update TargetSource.swift

* Update TargetSource.swift

* Update TargetSource.swift
This commit is contained in:
Dale Myers 2023-04-06 00:17:31 +01:00 committed by GitHub
parent 5a34c489e1
commit 988afa0f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -6,6 +6,10 @@
- Added support for shared breakpoints #177 @alexruperez @myihsan
### Fixed
- Fix case where source paths may not be deduplicated correctly resulting in duplicate groups and/or a crash in running Xcodegen #1341 @dalemyers
## 2.34.0
### Changed

View File

@ -4,8 +4,13 @@ import PathKit
public struct TargetSource: Equatable {
public static let optionalDefault = false
public var path: String
public var path: String {
didSet {
path = (path as NSString).standardizingPath
}
}
public var name: String?
public var group: String?
public var compilerFlags: [String]
@ -48,7 +53,7 @@ public struct TargetSource: Equatable {
attributes: [String] = [],
resourceTags: [String] = []
) {
self.path = path
self.path = (path as NSString).standardizingPath
self.name = name
self.group = group
self.compilerFlags = compilerFlags
@ -83,6 +88,7 @@ extension TargetSource: JSONObjectConvertible {
public init(jsonDictionary: JSONDictionary) throws {
path = try jsonDictionary.json(atKeyPath: "path")
path = (path as NSString).standardizingPath // Done in two steps as the compiler can't figure out the types otherwise
name = jsonDictionary.json(atKeyPath: "name")
group = jsonDictionary.json(atKeyPath: "group")