From cd472b3a21f1a511585fbad26c402dc0ad37aaa0 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 11 Dec 2025 10:54:08 +0100 Subject: [PATCH 1/5] fix(ios): cocoa-v9: Fix _SentryPrivate module issue --- .../patch-scripts/rn.patch.podfile.js | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js index 8ab2afa36b..7854d82d4c 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js @@ -63,8 +63,76 @@ if (currentMatch) { debug.log('Warning: Could not find platform :ios line to patch'); } +// Add post_install hook to fix Sentry module map resolution for RN < 0.80 +// This is needed for Sentry Cocoa SDK 9.x which uses _SentryPrivate module +// Check RN version from environment or try to detect from content +const rnVersion = process.env.RN_VERSION; +const rnVersionMatch = rnVersion || content.match(/react-native['"][\s:]*['"]?([0-9.]+)/)?.[1]; +const needsSentryFix = rnVersionMatch && parseFloat(rnVersionMatch) < 0.80; +const hasPostInstall = content.includes('post_install do |installer|'); +const hasSentryFix = content.includes('_SentryPrivate module resolution'); + +if (needsSentryFix && !hasSentryFix) { + const sentryFixCode = ` # Fix for Sentry Cocoa SDK 9.x _SentryPrivate module resolution in RN < 0.80 + installer.pods_project.targets.each do |target| + if target.name == 'Sentry' || target.name.start_with?('Sentry') + target.build_configurations.each do |config| + config.build_settings['CLANG_ENABLE_MODULES'] = 'YES' + config.build_settings['DEFINES_MODULE'] = 'YES' + end + end + end`; + + if (hasPostInstall) { + // Append to existing post_install hook + // Find the post_install block and insert before its closing 'end' + // Match: post_install do |installer| ... end (accounting for nested blocks) + const postInstallPattern = /(post_install do \|installer\|[\s\S]*?)(\n\s*end)/; + if (postInstallPattern.test(content)) { + content = content.replace( + postInstallPattern, + (match, postInstallContent, endBlock) => { + // Check if sentry fix is already there + if (postInstallContent.includes('_SentryPrivate')) { + return match; + } + // Add sentry fix before the end, maintaining proper indentation + const indent = endBlock.match(/^(\s*)/)?.[1] || ' '; + return postInstallContent + '\n' + indent + sentryFixCode + endBlock; + } + ); + debug.log('Added Sentry module map fix to existing post_install hook'); + } + } else { + // Add new post_install hook before the target's closing 'end' + // Find the target block and insert post_install before its closing 'end' + const targetPattern = /(target\s+['"][^'"]+['"]\s+do[\s\S]*?)(\n\s*end\s*$)/m; + if (targetPattern.test(content)) { + content = content.replace( + targetPattern, + (match, targetContent, endBlock) => { + // Check if already has post_install (shouldn't happen, but be safe) + if (targetContent.includes('post_install')) { + return match; + } + // Add post_install hook before the target's end + const indent = endBlock.match(/^(\s*)/)?.[1] || ''; + const sentryFixHook = `\n${indent} post_install do |installer|\n${indent}${sentryFixCode}\n${indent} end`; + return targetContent + sentryFixHook + endBlock; + } + ); + debug.log('Added new post_install hook to fix Sentry module map resolution'); + } else { + // Fallback: append at the end before final 'end' + const sentryFixHook = `\n post_install do |installer|\n${sentryFixCode}\n end\n`; + content = content.replace(/(\n\s*end\s*$)/, sentryFixHook + '$1'); + debug.log('Added new post_install hook (fallback method)'); + } + } +} + // Write the file if any changes were made -if (shouldPatch || currentMatch) { +if (shouldPatch || currentMatch || needsSentryFix) { fs.writeFileSync(args['pod-file'], content); debug.log('Podfile patched successfully!'); } else { From 39572984ceedb557fcd21621bd43f89c4773ef13 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 11 Dec 2025 11:21:07 +0100 Subject: [PATCH 2/5] Revert "fix(ios): cocoa-v9: Fix _SentryPrivate module issue" This reverts commit cd472b3a21f1a511585fbad26c402dc0ad37aaa0. --- .../patch-scripts/rn.patch.podfile.js | 70 +------------------ 1 file changed, 1 insertion(+), 69 deletions(-) diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js index 7854d82d4c..8ab2afa36b 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js @@ -63,76 +63,8 @@ if (currentMatch) { debug.log('Warning: Could not find platform :ios line to patch'); } -// Add post_install hook to fix Sentry module map resolution for RN < 0.80 -// This is needed for Sentry Cocoa SDK 9.x which uses _SentryPrivate module -// Check RN version from environment or try to detect from content -const rnVersion = process.env.RN_VERSION; -const rnVersionMatch = rnVersion || content.match(/react-native['"][\s:]*['"]?([0-9.]+)/)?.[1]; -const needsSentryFix = rnVersionMatch && parseFloat(rnVersionMatch) < 0.80; -const hasPostInstall = content.includes('post_install do |installer|'); -const hasSentryFix = content.includes('_SentryPrivate module resolution'); - -if (needsSentryFix && !hasSentryFix) { - const sentryFixCode = ` # Fix for Sentry Cocoa SDK 9.x _SentryPrivate module resolution in RN < 0.80 - installer.pods_project.targets.each do |target| - if target.name == 'Sentry' || target.name.start_with?('Sentry') - target.build_configurations.each do |config| - config.build_settings['CLANG_ENABLE_MODULES'] = 'YES' - config.build_settings['DEFINES_MODULE'] = 'YES' - end - end - end`; - - if (hasPostInstall) { - // Append to existing post_install hook - // Find the post_install block and insert before its closing 'end' - // Match: post_install do |installer| ... end (accounting for nested blocks) - const postInstallPattern = /(post_install do \|installer\|[\s\S]*?)(\n\s*end)/; - if (postInstallPattern.test(content)) { - content = content.replace( - postInstallPattern, - (match, postInstallContent, endBlock) => { - // Check if sentry fix is already there - if (postInstallContent.includes('_SentryPrivate')) { - return match; - } - // Add sentry fix before the end, maintaining proper indentation - const indent = endBlock.match(/^(\s*)/)?.[1] || ' '; - return postInstallContent + '\n' + indent + sentryFixCode + endBlock; - } - ); - debug.log('Added Sentry module map fix to existing post_install hook'); - } - } else { - // Add new post_install hook before the target's closing 'end' - // Find the target block and insert post_install before its closing 'end' - const targetPattern = /(target\s+['"][^'"]+['"]\s+do[\s\S]*?)(\n\s*end\s*$)/m; - if (targetPattern.test(content)) { - content = content.replace( - targetPattern, - (match, targetContent, endBlock) => { - // Check if already has post_install (shouldn't happen, but be safe) - if (targetContent.includes('post_install')) { - return match; - } - // Add post_install hook before the target's end - const indent = endBlock.match(/^(\s*)/)?.[1] || ''; - const sentryFixHook = `\n${indent} post_install do |installer|\n${indent}${sentryFixCode}\n${indent} end`; - return targetContent + sentryFixHook + endBlock; - } - ); - debug.log('Added new post_install hook to fix Sentry module map resolution'); - } else { - // Fallback: append at the end before final 'end' - const sentryFixHook = `\n post_install do |installer|\n${sentryFixCode}\n end\n`; - content = content.replace(/(\n\s*end\s*$)/, sentryFixHook + '$1'); - debug.log('Added new post_install hook (fallback method)'); - } - } -} - // Write the file if any changes were made -if (shouldPatch || currentMatch || needsSentryFix) { +if (shouldPatch || currentMatch) { fs.writeFileSync(args['pod-file'], content); debug.log('Podfile patched successfully!'); } else { From b2cd4c5a726189ddd9a19c61dc8875928920dd53 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 11 Dec 2025 11:37:06 +0100 Subject: [PATCH 3/5] Pass RNVersion --- dev-packages/e2e-tests/cli.mjs | 2 +- .../patch-scripts/rn.patch.podfile.js | 82 ++++++++++++++++++- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/dev-packages/e2e-tests/cli.mjs b/dev-packages/e2e-tests/cli.mjs index c3ee22f3f7..be5873d22a 100755 --- a/dev-packages/e2e-tests/cli.mjs +++ b/dev-packages/e2e-tests/cli.mjs @@ -183,7 +183,7 @@ if (actions.includes('create')) { if (platform === 'ios') { execSync('ruby --version', { stdio: 'inherit', cwd: `${appDir}`, env: env }); - execSync(`${patchScriptsDir}/rn.patch.podfile.js --pod-file Podfile --engine ${RNEngine}`, { + execSync(`${patchScriptsDir}/rn.patch.podfile.js --pod-file Podfile --engine ${RNEngine} --rn-version ${RNVersion}`, { stdio: 'inherit', cwd: `${appDir}/ios`, env: env, diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js index 8ab2afa36b..17b8ad6c83 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js @@ -16,6 +16,9 @@ if (!args['engine']) { throw new Error('Missing --engine'); } +// RN version is optional but recommended for Sentry fix +const providedRNVersion = args['rn-version']; + const enableHermes = args['engine'] === 'hermes' ? true : args['engine'] === 'jsc' ? false : null; if (enableHermes === null) { throw new Error('Invalid engine'); @@ -63,8 +66,85 @@ if (currentMatch) { debug.log('Warning: Could not find platform :ios line to patch'); } +// Add post_install hook to fix Sentry module map resolution for RN < 0.80 +// This is needed for Sentry Cocoa SDK 9.x which uses _SentryPrivate module +const rnVersionMatch = providedRNVersion; +const needsSentryFix = rnVersionMatch && parseFloat(rnVersionMatch) < 0.80; +const hasPostInstall = content.includes('post_install do |installer|'); +const hasSentryFix = content.includes('_SentryPrivate module resolution'); + +if (needsSentryFix && !hasSentryFix && rnVersionMatch) { + debug.log(`RN version: ${rnVersionMatch}, applying Sentry module map fix`); + + const sentryFixCode = ` # Fix for Sentry Cocoa SDK 9.x _SentryPrivate module resolution in RN < 0.80 + # The _SentryPrivate module is used internally by Sentry SDK 9.x and needs proper module map resolution + Pod::UI.puts "Applying Sentry module map fix for RN < 0.80" + installer.pods_project.targets.each do |target| + if target.name == 'Sentry' || target.name.start_with?('Sentry') + Pod::UI.puts "Found Sentry target: #{target.name}" + target.build_configurations.each do |config| + # Enable modules and ensure proper module map resolution + config.build_settings['CLANG_ENABLE_MODULES'] = 'YES' + config.build_settings['DEFINES_MODULE'] = 'YES' + config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES' + Pod::UI.puts "Applied module map fix to #{target.name} (#{config.name})" + end + end + end`; + + if (hasPostInstall) { + // Append to existing post_install hook + // Find the post_install block and insert before its closing 'end' + const postInstallPattern = /(post_install do \|installer\|[\s\S]*?)(\n\s*end)/; + if (postInstallPattern.test(content)) { + content = content.replace( + postInstallPattern, + (match, postInstallContent, endBlock) => { + // Check if sentry fix is already there + if (postInstallContent.includes('_SentryPrivate')) { + return match; + } + // Add sentry fix before the end, maintaining proper indentation + const indent = endBlock.match(/^(\s*)/)?.[1] || ' '; + return postInstallContent + '\n' + indent + sentryFixCode + endBlock; + } + ); + debug.log('Added Sentry module map fix to existing post_install hook'); + } + } else { + // Add new post_install hook before the target's closing 'end' + // Find the target block and insert post_install before its closing 'end' + const targetPattern = /(target\s+['"][^'"]+['"]\s+do[\s\S]*?)(\n\s*end\s*$)/m; + if (targetPattern.test(content)) { + content = content.replace( + targetPattern, + (match, targetContent, endBlock) => { + // Check if already has post_install (shouldn't happen, but be safe) + if (targetContent.includes('post_install')) { + return match; + } + // Add post_install hook before the target's end + const indent = endBlock.match(/^(\s*)/)?.[1] || ''; + const sentryFixHook = `\n${indent} post_install do |installer|\n${indent}${sentryFixCode}\n${indent} end`; + return targetContent + sentryFixHook + endBlock; + } + ); + debug.log('Added new post_install hook to fix Sentry module map resolution'); + } else { + // Fallback: append at the end before final 'end' + const sentryFixHook = `\n post_install do |installer|\n${sentryFixCode}\n end\n`; + content = content.replace(/(\n\s*end\s*$)/, sentryFixHook + '$1'); + debug.log('Added new post_install hook (fallback method)'); + } + } +} else if (rnVersionMatch && !needsSentryFix) { + debug.log(`RN version ${rnVersionMatch} >= 0.80, skipping Sentry fix`); +} else if (!rnVersionMatch) { + debug.log('RN version not provided, skipping Sentry fix check'); +} + // Write the file if any changes were made -if (shouldPatch || currentMatch) { +if (shouldPatch || currentMatch || (needsSentryFix && !hasSentryFix)) { fs.writeFileSync(args['pod-file'], content); debug.log('Podfile patched successfully!'); } else { From 7d6b2bf54e2760fc065f84f8ba5ec5b8dc2a0c9d Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 11 Dec 2025 12:17:31 +0100 Subject: [PATCH 4/5] Revert "Pass RNVersion" This reverts commit b2cd4c5a726189ddd9a19c61dc8875928920dd53. --- dev-packages/e2e-tests/cli.mjs | 2 +- .../patch-scripts/rn.patch.podfile.js | 82 +------------------ 2 files changed, 2 insertions(+), 82 deletions(-) diff --git a/dev-packages/e2e-tests/cli.mjs b/dev-packages/e2e-tests/cli.mjs index be5873d22a..c3ee22f3f7 100755 --- a/dev-packages/e2e-tests/cli.mjs +++ b/dev-packages/e2e-tests/cli.mjs @@ -183,7 +183,7 @@ if (actions.includes('create')) { if (platform === 'ios') { execSync('ruby --version', { stdio: 'inherit', cwd: `${appDir}`, env: env }); - execSync(`${patchScriptsDir}/rn.patch.podfile.js --pod-file Podfile --engine ${RNEngine} --rn-version ${RNVersion}`, { + execSync(`${patchScriptsDir}/rn.patch.podfile.js --pod-file Podfile --engine ${RNEngine}`, { stdio: 'inherit', cwd: `${appDir}/ios`, env: env, diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js index 17b8ad6c83..8ab2afa36b 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js @@ -16,9 +16,6 @@ if (!args['engine']) { throw new Error('Missing --engine'); } -// RN version is optional but recommended for Sentry fix -const providedRNVersion = args['rn-version']; - const enableHermes = args['engine'] === 'hermes' ? true : args['engine'] === 'jsc' ? false : null; if (enableHermes === null) { throw new Error('Invalid engine'); @@ -66,85 +63,8 @@ if (currentMatch) { debug.log('Warning: Could not find platform :ios line to patch'); } -// Add post_install hook to fix Sentry module map resolution for RN < 0.80 -// This is needed for Sentry Cocoa SDK 9.x which uses _SentryPrivate module -const rnVersionMatch = providedRNVersion; -const needsSentryFix = rnVersionMatch && parseFloat(rnVersionMatch) < 0.80; -const hasPostInstall = content.includes('post_install do |installer|'); -const hasSentryFix = content.includes('_SentryPrivate module resolution'); - -if (needsSentryFix && !hasSentryFix && rnVersionMatch) { - debug.log(`RN version: ${rnVersionMatch}, applying Sentry module map fix`); - - const sentryFixCode = ` # Fix for Sentry Cocoa SDK 9.x _SentryPrivate module resolution in RN < 0.80 - # The _SentryPrivate module is used internally by Sentry SDK 9.x and needs proper module map resolution - Pod::UI.puts "Applying Sentry module map fix for RN < 0.80" - installer.pods_project.targets.each do |target| - if target.name == 'Sentry' || target.name.start_with?('Sentry') - Pod::UI.puts "Found Sentry target: #{target.name}" - target.build_configurations.each do |config| - # Enable modules and ensure proper module map resolution - config.build_settings['CLANG_ENABLE_MODULES'] = 'YES' - config.build_settings['DEFINES_MODULE'] = 'YES' - config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES' - Pod::UI.puts "Applied module map fix to #{target.name} (#{config.name})" - end - end - end`; - - if (hasPostInstall) { - // Append to existing post_install hook - // Find the post_install block and insert before its closing 'end' - const postInstallPattern = /(post_install do \|installer\|[\s\S]*?)(\n\s*end)/; - if (postInstallPattern.test(content)) { - content = content.replace( - postInstallPattern, - (match, postInstallContent, endBlock) => { - // Check if sentry fix is already there - if (postInstallContent.includes('_SentryPrivate')) { - return match; - } - // Add sentry fix before the end, maintaining proper indentation - const indent = endBlock.match(/^(\s*)/)?.[1] || ' '; - return postInstallContent + '\n' + indent + sentryFixCode + endBlock; - } - ); - debug.log('Added Sentry module map fix to existing post_install hook'); - } - } else { - // Add new post_install hook before the target's closing 'end' - // Find the target block and insert post_install before its closing 'end' - const targetPattern = /(target\s+['"][^'"]+['"]\s+do[\s\S]*?)(\n\s*end\s*$)/m; - if (targetPattern.test(content)) { - content = content.replace( - targetPattern, - (match, targetContent, endBlock) => { - // Check if already has post_install (shouldn't happen, but be safe) - if (targetContent.includes('post_install')) { - return match; - } - // Add post_install hook before the target's end - const indent = endBlock.match(/^(\s*)/)?.[1] || ''; - const sentryFixHook = `\n${indent} post_install do |installer|\n${indent}${sentryFixCode}\n${indent} end`; - return targetContent + sentryFixHook + endBlock; - } - ); - debug.log('Added new post_install hook to fix Sentry module map resolution'); - } else { - // Fallback: append at the end before final 'end' - const sentryFixHook = `\n post_install do |installer|\n${sentryFixCode}\n end\n`; - content = content.replace(/(\n\s*end\s*$)/, sentryFixHook + '$1'); - debug.log('Added new post_install hook (fallback method)'); - } - } -} else if (rnVersionMatch && !needsSentryFix) { - debug.log(`RN version ${rnVersionMatch} >= 0.80, skipping Sentry fix`); -} else if (!rnVersionMatch) { - debug.log('RN version not provided, skipping Sentry fix check'); -} - // Write the file if any changes were made -if (shouldPatch || currentMatch || (needsSentryFix && !hasSentryFix)) { +if (shouldPatch || currentMatch) { fs.writeFileSync(args['pod-file'], content); debug.log('Podfile patched successfully!'); } else { From 8efdfc82325d9faea01ebe3541d295517639fdd0 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 11 Dec 2025 12:19:30 +0100 Subject: [PATCH 5/5] Try with xcode 16.4 and no othre changes --- .github/workflows/e2e-v2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-v2.yml b/.github/workflows/e2e-v2.yml index 5cc906da90..1b8456c3f3 100644 --- a/.github/workflows/e2e-v2.yml +++ b/.github/workflows/e2e-v2.yml @@ -191,8 +191,8 @@ jobs: runs-on: macos-15 - platform: ios rn-version: '0.71.19' - xcode-version: '15.4' - runs-on: macos-14 + xcode-version: '16.4' + runs-on: macos-15 - platform: android runs-on: ubuntu-latest exclude: