Reuse ReferenceProxy references when possible (#1354)

* Reuse ReferenceProxy references when possible

* Add changelog

* Update CHANGELOG.md

---------

Co-authored-by: Yonas Kolb <yonaskolb@users.noreply.github.com>
This commit is contained in:
Roman Gardukevich 2023-05-17 04:58:32 +03:00 committed by GitHub
parent 9766326dcd
commit 372f20fe5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 10 deletions

View File

@ -2,12 +2,18 @@
## Next Version
### Added
### Fixed
- Fix external dependencies from being removed by Xcode #1354 @OdNairy
## 2.35.0
### Added
- Added support for shared breakpoints #177 @alexruperez @myihsan
- Added support for `putResourcesBeforeSourcesBuildPhase` in a target #1351 @mat1th
- Added support for `putResourcesBeforeSourcesBuildPhase` in a target #1351 @mat1th
### Fixed

View File

@ -423,16 +423,32 @@ public class PBXProjGenerator {
path = "lib\(tmpPath)"
}
let productReferenceProxy = addObject(
PBXReferenceProxy(
fileType: targetObject.productNameWithExtension().flatMap { Xcode.fileType(path: Path($0)) },
path: path,
remote: productProxy,
sourceTree: .buildProductsDir
)
)
let productReferenceProxyFileType = targetObject.productNameWithExtension()
.flatMap { Xcode.fileType(path: Path($0)) }
let existingValue = self.pbxProj.referenceProxies.first { referenceProxy in
referenceProxy.path == path &&
referenceProxy.remote == productProxy &&
referenceProxy.sourceTree == .buildProductsDir &&
referenceProxy.fileType == productReferenceProxyFileType
}
let productReferenceProxy: PBXReferenceProxy
if let existingValue = existingValue {
productReferenceProxy = existingValue
} else {
productReferenceProxy = addObject(
PBXReferenceProxy(
fileType: productReferenceProxyFileType,
path: path,
remote: productProxy,
sourceTree: .buildProductsDir
)
)
productsGroup.children.append(productReferenceProxy)
}
productsGroup.children.append(productReferenceProxy)
let targetDependency = addObject(
PBXTargetDependency(