Codegen: app codegenConfig with no spec files emits "${PODS_ROOT}/.." as Generate Specs input and causes an Xcode dependency cycle
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 92/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, react-native
- 領域
- build-system, mobile
調査の方向性
scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js から始め、特に getInputFiles() を確認し、空の jsSrcsDir を持つ app-level の codegenConfig のケースを再現してください。生成された ReactCodegen.podspec を調べ、Generate Specs の input_files リストが ios ディレクトリを含まず空であることを確認してください。その後、Xcode の依存関係サイクルが発生しなくなったことを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Description
scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js → getInputFiles() builds the Generate Specs script phase input_files from a find over the app's codegenConfig.jsSrcsDir. When that directory contains no Native*.{js,ts} / *NativeComponent.{js,ts} files, execSync(find …) returns an empty string, ''.trim().split('\n') is [''], and the single empty path is mapped to:
'input_files' => ["${PODS_ROOT}/.."]
i.e. the whole ios/ directory. Xcode then sees that the Generate Specs phase of ReactCodegen depends on files produced by other targets' script phases in that directory (in an Expo project: the app target's [Expo] Configure project phase, which writes Pods/Target Support Files/…/ExpoModulesProvider.swift) and fails:
error: Cycle in dependencies between targets 'Callingx' and 'TurnoHosts'; building could produce unreliable results.
Cycle path: Callingx → ReactCodegen → TurnoHosts → Callingx
→ Target 'Callingx' has an explicit dependency on Target 'ReactCodegen'
○ That command depends on command in Target 'ReactCodegen': script phase “[CP-User] Generate Specs”
→ That command depends on command in Target 'TurnoHosts': script phase “[Expo] Configure project”
An app-level codegenConfig with no spec files is a legitimate setup: it is the documented way to declare ios.modulesConformingToProtocol (e.g. an RCTImageURLLoader) from the app when a dependency cannot.
Steps to reproduce
- In an app's package.json add
where"codegenConfig": { "name": "AppSpecs", "type": "modules", "jsSrcsDir": "src/config", "ios": { "modulesConformingToProtocol": { "RCTImageURLLoader": ["SomeLoader"] } } }src/configexists but has no spec files. pod install- Inspect
ios/build/generated/ios/ReactCodegen/ReactCodegen.podspec→'input_files' => ["${PODS_ROOT}/.."]. - Build in Xcode → dependency cycle error above (seen with Expo SDK 57 projects; any other script phase writing under
ios/triggers it too).
Fix
Filter the empty entry:
const list = String(execSync(findCommand))
.trim()
.split('\n')
+ .filter(Boolean)
.sort()
With that, input_files is [] (same as projects without an app codegenConfig) and the build succeeds.
React Native Version
0.86.3
Affected Platforms
Build - MacOS, Runtime - iOS
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react/react-native のほかの issue
-
Needs: Author Feedback Needs: Repro
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
react/react-native#58610 · コメント 1 件 ·
-
Needs: Triage :mag:
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
react/react-native#58565 · コメント 1 件 · リアクション 2 件 ·
-
Needs: Author Feedback Needs: Repro
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
react/react-native#58555 · コメント 4 件 · リアクション 1 件 ·
-
Needs: Attention Needs: Repro
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
react/react-native#58526 · コメント 2 件 ·
-
Needs: Author Feedback Needs: Repro
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
react/react-native#58448 · コメント 1 件 ·
react/react-native の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
AXERA-TECH/ax-llm#77 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
games-on-whales/wolf#509 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
bug-unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NVIDIA/cuda-samples#453 ·