Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Codegen: app codegenConfig with no spec files emits "${PODS_ROOT}/.." as Generate Specs input and causes an Xcode dependency cycle

Aperta Adatta ai principianti
#58,621 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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

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

Needs: Author Feedback Needs: Repro
Description

scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.jsgetInputFiles() 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
  1. In an app's package.json add
    "codegenConfig": { "name": "AppSpecs", "type": "modules", "jsSrcsDir": "src/config", "ios": { "modulesConformingToProtocol": { "RCTImageURLLoader": ["SomeLoader"] } } }
    
    where src/config exists but has no spec files.
  2. pod install
  3. Inspect ios/build/generated/ios/ReactCodegen/ReactCodegen.podspec'input_files' => ["${PODS_ROOT}/.."].
  4. 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di react/react-native

Tutte le issue di react/react-native

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.