Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Reproducer — iOS "Cycle in dependencies" between ReactCodegen and a pod

Reproduces the intermittent iOS build cycle described in react/react-native#57760 (Fix: react/react-native#57759)

TL;DR

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.

Steps to reproduce

cd ReproducerApp
yarn install            # or: npm install
cd ios && pod install

Inspect the generated podspec (note: input_files is a directory, not []):

grep input_files build/generated/ios/ReactCodegen.podspec
# => 'input_files' => ["${PODS_ROOT}/.."],     <-- BUG: a directory

Build 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/build

Expected

Both builds succeed. With the fix (.filter(Boolean) in getInputFiles), the generated podspec has 'input_files' => [] and there is no cycle.

Actual (2nd build)

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.

About

Reproducer: iOS Cycle in dependencies (ReactCodegen) when codegenConfig.jsSrcsDir has no Native* specs

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages