BUG - addTargetDependency - If project doesn't contain PBXTargetDependency or PBXContainerItemProxy
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- ios, javascript, nodejs
調査の方向性
lib/pbxProject.js の addTargetDependency から始め、addTarget または addTargetDependency のカバレッジについて既存のテストスイートを調べてください。PBXTargetDependency または PBXContainerItemProxy を含まない単一 Target の .xcodeproj のケースを再現し、その後リグレッションテストを追加してください。依存関係が正しく作成または処理され、既存のテストが引き続き成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
One Line Summary
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.
https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
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 handle null, undefined, or if no key exists when reading from hash.project.objects.
https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L834-L835
This could become the following to fix this issue:
pbxTargetDependencySection = this.hash.project.objects[pbxTargetDependency] || {},
pbxContainerItemProxySection = this.hash.project.objects[pbxContainerItemProxy] || {};
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.
- Put these at the top of the file:
const PBX_TARGET_DEPENDECY = "PBXTargetDependency";
const PBX_CONTAINER_ITEM_PROXY = "PBXContainerItemProxy";
- Use them here and remove the old vars:
const pbxTargetDependencySection = this.hash.project.objects[PBXTargetDependency] || {};
const pbxContainerItemProxySection = this.hash.project.objects[PBXContainerItemProxy] || {};
Workaround
// Add code anytime before calling addTarget or addTargetDependency
const projObjects = xcodeProject.hash.project.objects;
projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};
projObjects['PBXContainerItemProxy'] = projObjects['PBXTargetDependency'] || {};
Related issues
PR #12 also made a note of this issue:
2.
addTargetDependency()is indirectly called as well fromproj.addTarget('AppExtension', 'app_extension'). In my project,PBXTargetDependencyandPBXContainerItemProxysections 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 2e09d78efdb1d667dd513a3c97c46dc448305f5f.
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.
- 主要言語
- JavaScript
- スター
- 217
- フォーク
- 102
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 8
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cordova-node-xcode のほかの issue
-
Add & Improve JSDocs再び着手できるかも @erisu が 95 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
apache/cordova-node-xcode#171 · 担当者 1 名 ·
-
🔖 New releaseオープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
apache/cordova-node-xcode#162 · コメント 4 件 · リアクション 2 件 ·
-
Install .xcframeworkオープン
難易度 3/5 1〜2日 初心者へのやさしさ 28/100
apache/cordova-node-xcode#139 · コメント 2 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
apache/cordova-node-xcode#138 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
apache/cordova-node-xcode#137 · リアクション 2 件 ·
apache/cordova-node-xcode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
parse-community/parse-server#10699 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: dashboard bug perceived difficulty: 3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
メンテナーはふだん 1 日以内に返信
-
Aframe enhancement javascript
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
webarkit/Aframe-nft#17 ·
-
spec-feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100