Reproduces the intermittent iOS build cycle described in react/react-native#57760 (Fix: react/react-native#57759)
When an app's codegenConfig.jsSrcsDir contains no files matching the codegen
spec naming convention (Native*.ts/Native*.js/*NativeComponent.ts/*NativeComponent.js),
getInputFiles() in
scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js
emits a directory path for the [CP-User] Generate Specs script phase
input_files instead of []. That directory holds the iOS build output
(ios/build, when -derivedDataPath is inside the project — e.g. Detox), which
makes Xcode detect a dependency cycle on the 2nd and later (incremental)
builds. A clean build passes.
This reproducer's ReproducerApp/package.json sets:
"codegenConfig": { "name": "ReproducerSpec", "type": "modules", "jsSrcsDir": "specs" }and ReproducerApp/specs/MyModule.ts is a valid TurboModule spec whose name does
not match the Native* pattern, so codegen's find returns nothing → triggers the bug.
cd ReproducerApp
yarn install # or: npm install
cd ios && pod installInspect the generated podspec (note: input_files is a directory, not []):
grep input_files build/generated/ios/ReactCodegen.podspec
# => 'input_files' => ["${PODS_ROOT}/.."], <-- BUG: a directoryBuild twice with an in-project -derivedDataPath (what Detox uses):
# 1st build (clean) — passes
xcodebuild -workspace ReproducerApp.xcworkspace -scheme ReproducerApp \
-configuration Debug -sdk iphonesimulator -derivedDataPath ios/build
# 2nd build (incremental) — FAILS
xcodebuild -workspace ReproducerApp.xcworkspace -scheme ReproducerApp \
-configuration Debug -sdk iphonesimulator -derivedDataPath ios/buildBoth builds succeed. With the fix (.filter(Boolean) in getInputFiles), the
generated podspec has 'input_files' => [] and there is no cycle.
error: Cycle in dependencies between targets 'ReactCodegen' and '<Pod>';
building could produce unreliable results.
Cycle path: ReactCodegen → <Pod> → ReactCodegen
Note: react-native run-ios is unaffected because it uses Xcode's default
DerivedData (outside the repo); only an in-project -derivedDataPath triggers it.