Codegen: app codegenConfig with no spec files emits "${PODS_ROOT}/.." as Generate Specs input and causes an Xcode dependency cycle
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 92/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, react-native
- Ambito
- build-system, mobile
Direzione di ricerca
Inizia da scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js, in particolare da getInputFiles(), e riproduci il caso di una codegenConfig a livello di app con un jsSrcsDir vuoto. Ispeziona il ReactCodegen.podspec generato e conferma che l’elenco input_files di Generate Specs sia vuoto invece di contenere la directory ios; quindi verifica che il ciclo di dipendenze di Xcode non si verifichi più.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react/react-native
-
Needs: Author Feedback Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
react/react-native#58610 · 1 commento ·
-
Needs: Triage :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
react/react-native#58565 · 1 commento · 2 reazioni ·
-
Needs: Author Feedback Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
react/react-native#58555 · 5 commenti · 2 reazioni ·
-
Needs: Attention Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
react/react-native#58526 · 2 commenti ·
-
Needs: Author Feedback Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
react/react-native#58448 · 1 commento ·
Tutte le issue di react/react-native
Issue simili
-
ai_reviewed
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ydb-platform/ydb#53869 · 3 commenti ·
-
bug cert blocker needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
project-chip/connectedhomeip#74373 ·
-
[request] tracy/0.14.1 Apertaupstream update
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
vllm-project/vllm-ascend#17329 ·