From 966154dfc5359084b0381b34f32360050ffbe945 Mon Sep 17 00:00:00 2001 From: Nikita Levin Date: Thu, 30 Jul 2026 10:41:15 +0500 Subject: [PATCH] fix(codegen): empty ReactCodegen input_files when no Native spec files found getInputFiles() produced a bogus directory entry in the ReactCodegen "Generate Specs" script phase input_files when an app's codegenConfig.jsSrcsDir contained no Native*/*NativeComponent spec files. Because that directory typically holds the iOS build output (e.g. ios/build, common with -derivedDataPath inside the project, as Detox/CI use), Xcode detected a dependency cycle on incremental builds: Cycle in dependencies between targets 'ReactCodegen' and '' Clean builds passed (output dir did not exist yet), so the failure only surfaced on the 2nd and later builds. Filter empty entries from the find result so an empty match yields []. Behavior is unchanged when real spec files are present. Test Plan: in a New Arch app, set codegenConfig.jsSrcsDir to a dir without Native*/*NativeComponent files, run `pod install`, then build twice with `-derivedDataPath ios/build`. Before: 2nd build fails with the cycle error. After: both builds pass. With real Native* specs, input_files is unchanged. --- .../generate-artifacts-executor/generateReactCodegenPodspec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js b/packages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js index 23df266c81f7..09abe7685259 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js @@ -75,6 +75,7 @@ function getInputFiles(appPath /*: string */, appPkgJson /*: $FlowFixMe */) { const list = String(execSync(findCommand)) .trim() .split('\n') + .filter(Boolean) .sort() .map(filepath => `"\${PODS_ROOT}/${path.relative(xcodeproj, filepath)}"`) .join(',\n');