You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
addTargetDependency misses some dependency links if PBXTargetDependency or PBXContainerItemProxy are not present.
Affected Projects
Calls made to addTarget or addTargetDependency with any .xcodeproj that only has one target, these do NOT have PBXTargetDependency or PBXContainerItemProxy.
Details
The root cause
The following if statement in the addTargetDependency function skips the dependencies and other steps if it is missing.
A simple way to fix this would be to use short-circuit evaluation where these vars are assigned to handle null, undefined, or if no key exists when reading from hash.project.objects.
// Add code anytime before calling addTarget or addTargetDependencyconstprojObjects=xcodeProject.hash.project.objects;projObjects['PBXTargetDependency']=projObjects['PBXTargetDependency']||{};projObjects['PBXContainerItemProxy']=projObjects['PBXTargetDependency']||{};
2. addTargetDependency() is indirectly called as well from proj.addTarget('AppExtension', 'app_extension'). In my project, PBXTargetDependency and PBXContainerItemProxy sections did not yet exist which results in the necessary dependencies not being set up properly for building the extension with the main app. Create these sections if they do not exist.
They attempted to fix this in a similar way I am suggesting with commit 2e09d78.
This PR was not merged however, so this is still an active issue.
There is another issue #37, that references PR #12, notes that targetDependency is still an issue.
Submitting a PR - Is this an active library?
It has been over a year since there has been a release or even a commit. If the maintainers could chime in I'd be happy to create one.
I have read the CONTRIBUTING.md guide, is there any more to it than that? I see there is a good number of tests, I'll make sure to add one to cover the code change. Lastly let me know which of the possible fixes you prefer or if you have another idea.
The text was updated successfully, but these errors were encountered:
Description
One Line Summary
addTargetDependency
misses some dependency links ifPBXTargetDependency
orPBXContainerItemProxy
are not present.Affected Projects
Calls made to
addTarget
oraddTargetDependency
with any.xcodeproj
that only has one target, these do NOT havePBXTargetDependency
orPBXContainerItemProxy
.Details
The root cause
The following if statement in the
addTargetDependency
function skips the dependencies and other steps if it is missing.cordova-node-xcode/lib/pbxProject.js
Line 860 in 8b98cab
Possible fixes
Option 1 - Smallest number changes
A simple way to fix this would be to use short-circuit evaluation where these
vars
are assigned to handlenull
,undefined
, or if no key exists when reading fromhash.project.objects
.cordova-node-xcode/lib/pbxProject.js
Lines 834 to 835 in 8b98cab
This could become the following to fix this issue:
I have tested this on some projects on my machine and was able to successfully run an App Extension on an iOS device to confirm the solution works.
Option 2 - Larger Refactor - Fix some clean up
Same fix as option 1, but clean up the hard coded strings.
Workaround
Related issues
PR #12 also made a note of this issue:
They attempted to fix this in a similar way I am suggesting with commit 2e09d78.
This PR was not merged however, so this is still an active issue.
There is another issue #37, that references PR #12, notes that
targetDependency
is still an issue.Submitting a PR - Is this an active library?
It has been over a year since there has been a release or even a commit. If the maintainers could chime in I'd be happy to create one.
I have read the CONTRIBUTING.md guide, is there any more to it than that? I see there is a good number of tests, I'll make sure to add one to cover the code change. Lastly let me know which of the possible fixes you prefer or if you have another idea.
The text was updated successfully, but these errors were encountered: