diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor/generatePackageSwift.js b/packages/react-native/scripts/codegen/generate-artifacts-executor/generatePackageSwift.js index 1bb738dbb99..f90f2639af3 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor/generatePackageSwift.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor/generatePackageSwift.js @@ -10,9 +10,7 @@ 'use strict'; const {TEMPLATES_FOLDER_PATH} = require('./constants'); -const { - codegenLog, -} = require('./utils'); +const {codegenLog} = require('./utils'); const fs = require('fs'); const path = require('path'); @@ -32,12 +30,15 @@ function generatePackageSwift( codegenLog('Generating Package.swift'); const templateH = fs .readFileSync(PACKAGE_SWIFT_TEMPLATE_PATH, 'utf8') - .replace(/{reactNativePath}/, path.relative(fullOutputPath, reactNativePath)); + .replace( + /{reactNativePath}/, + path.relative(fullOutputPath, reactNativePath), + ); const finalPathH = path.join(outputDir, 'Package.swift'); fs.writeFileSync(finalPathH, templateH); codegenLog(`Generated artifact: ${finalPathH}`); } module.exports = { - generatePackageSwift + generatePackageSwift, }; diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor/index.js b/packages/react-native/scripts/codegen/generate-artifacts-executor/index.js index b5e7ed8210c..35a7b0265a1 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor/index.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor/index.js @@ -127,7 +127,10 @@ function execute( platform, ); - const reactCodegenOutputPath = platform === 'android' ? outputPath : path.join(outputPath, 'ReactCodegen'); + const reactCodegenOutputPath = + platform === 'android' + ? outputPath + : path.join(outputPath, 'ReactCodegen'); if (runReactNativeCodegen) { const schemaInfos = generateSchemaInfos(libraries); @@ -144,20 +147,31 @@ function execute( if (source === 'app' && platform !== 'android') { // These components are only required by apps, not by libraries and are Apple specific. generateRCTThirdPartyComponents(libraries, reactCodegenOutputPath); - generateRCTModuleProviders(projectRoot, pkgJson, libraries, reactCodegenOutputPath); + generateRCTModuleProviders( + projectRoot, + pkgJson, + libraries, + reactCodegenOutputPath, + ); generateCustomURLHandlers(libraries, reactCodegenOutputPath); generateUnstableModulesRequiringMainQueueSetupProvider( libraries, reactCodegenOutputPath, ); - generateAppDependencyProvider(path.join(outputPath, 'ReactAppDependencyProvider')); + generateAppDependencyProvider( + path.join(outputPath, 'ReactAppDependencyProvider'), + ); generateReactCodegenPodspec( projectRoot, pkgJson, reactCodegenOutputPath, baseOutputPath, ); - generatePackageSwift(projectRoot, outputPath, findReactNativeRootPath(projectRoot)); + generatePackageSwift( + projectRoot, + outputPath, + findReactNativeRootPath(projectRoot), + ); } cleanupEmptyFilesAndFolders(outputPath); diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js b/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js index 5fbf86895c6..97a4b89c540 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js @@ -461,10 +461,13 @@ function findDisabledLibrariesByPlatform( ); } -function findReactNativeRootPath(projectRoot /* : string */) /* : string */ { - const reactNativePackageJsonPath = require.resolve(path.join('react-native', 'package.json'), { - paths: [projectRoot], - }); +function findReactNativeRootPath(projectRoot /* : string */) /* : string */ { + const reactNativePackageJsonPath = require.resolve( + path.join('react-native', 'package.json'), + { + paths: [projectRoot], + }, + ); return path.dirname(reactNativePackageJsonPath); } diff --git a/packages/react-native/scripts/swiftpm/prepare-app-dependencies-headers.js b/packages/react-native/scripts/swiftpm/prepare-app-dependencies-headers.js index 77cb6d3c644..0bffdb87958 100644 --- a/packages/react-native/scripts/swiftpm/prepare-app-dependencies-headers.js +++ b/packages/react-native/scripts/swiftpm/prepare-app-dependencies-headers.js @@ -8,9 +8,9 @@ * @format */ +const {execSync} = require('child_process'); const fs = require('fs'); const path = require('path'); -const {execSync} = require('child_process'); /** * Prepares app dependencies headers for SwiftPM integration @@ -98,7 +98,11 @@ function prepareAppDependenciesHeaders( * @param {string} outputFolder - Path to the output folder * @param {string} folderName - Name of the folder where headers will be created (default: 'headers') */ -function hardlinkReactNativeHeaders(reactNativePath, outputFolder, folderName = 'headers') { +function hardlinkReactNativeHeaders( + reactNativePath, + outputFolder, + folderName = 'headers', +) { console.log('Creating hard links for React Native headers...'); const headersOutput = path.join(outputFolder, folderName); @@ -426,7 +430,6 @@ function hardlinkReactCommonHeaders( const relativePath = path.relative(reactCommonPath, sourceHeaderPath); let destPath; - let isFlattened = false; // Check for ReactCommon/**/ReactCommon/header.h pattern // Since relativePath is calculated from ReactCommon base, any "ReactCommon" component @@ -458,7 +461,6 @@ function hardlinkReactCommonHeaders( // Flatten to ReactCommon folder const headerName = path.basename(sourceHeaderPath); destPath = path.join(reactCommonHeadersOutput, headerName); - isFlattened = true; console.log(` -> ${headerName} (flattened to ReactCommon)`); } else if (relativePath.startsWith('react/')) { // Handle Switch special case @@ -487,11 +489,11 @@ function hardlinkReactCommonHeaders( // Handle platform-specific headers with pattern: // react/renderer/components/view/platform/{cxx,android}/react/renderer/components/view/header.h const platformMatch = relativePath.match( - /^(react\/.*?)\/platform\/([^\/]+)\/react\/(.*)$/, + /^(react\/.*?)\/platform\/([^/]+)\/react\/(.*)$/, ); if (platformMatch) { - const [, basePath, platform, remainingPath] = platformMatch; + const [, , platform, remainingPath] = platformMatch; const supportedPlatforms = ['ios', 'cxx']; const ignoredPlatforms = ['android', 'windows', 'macos']; @@ -523,16 +525,25 @@ function hardlinkReactCommonHeaders( } else { // Check for special mappings let specialCaseMatched = false; - for (const [prefix, destinationFolder] of Object.entries(specialMapping)) { + for (const [prefix, destinationFolder] of Object.entries( + specialMapping, + )) { if (relativePath.startsWith(prefix)) { let mappedPath = relativePath; // Special handling for yoga - remove duplicated yoga/ prefix - if (prefix === 'yoga/' && relativePath.startsWith('yoga/yoga/')) { + if ( + prefix === 'yoga/' && + relativePath.startsWith('yoga/yoga/') + ) { mappedPath = relativePath.substring(5); // Remove 'yoga/' (5 characters) } - destPath = path.join(headersOutput, destinationFolder, mappedPath.substring(prefix.length)); + destPath = path.join( + headersOutput, + destinationFolder, + mappedPath.substring(prefix.length), + ); console.log( ` -> ${destinationFolder}/${mappedPath.substring(prefix.length)} (${prefix.slice(0, -1)} headers flattened, bypassing ReactCommon)`, ); @@ -588,7 +599,11 @@ function hardlinkReactCommonHeaders( * @param {string} outputFolder - Path to the output folder * @param {string} folderName - Name of the folder where headers will be created (default: 'headers') */ -function hardlinkThirdPartyDependenciesHeaders(reactNativePath, outputFolder, folderName = 'headers') { +function hardlinkThirdPartyDependenciesHeaders( + reactNativePath, + outputFolder, + folderName = 'headers', +) { console.log('Creating hard links for Third-Party Dependencies headers...'); // Look for ReactNativeDependencies.xcframework/Headers folder specifically diff --git a/packages/react-native/scripts/swiftpm/prepare-app.js b/packages/react-native/scripts/swiftpm/prepare-app.js index 280cef57e5b..621edab6fae 100644 --- a/packages/react-native/scripts/swiftpm/prepare-app.js +++ b/packages/react-native/scripts/swiftpm/prepare-app.js @@ -15,19 +15,18 @@ * private/helloworld/ios/to-remove-instructions-to-build-from-source-with-spm */ -const fs = require('fs'); -const path = require('path'); -const {execSync} = require('child_process'); - +const codegenExecutor = require('../codegen/generate-artifacts-executor'); // Import functions from other scripts const { - prepareAppDependenciesHeaders, hardlinkReactNativeHeaders, hardlinkThirdPartyDependenciesHeaders, + prepareAppDependenciesHeaders, } = require('./prepare-app-dependencies-headers'); -const {createSymlinks: createSymlinksFunction} = require('./create-symlinks'); const {integrateSwiftPackagesInXcode} = require('./update-xcodeproject'); -const codegenExecutor = require('../codegen/generate-artifacts-executor'); +const {execSync} = require('child_process'); +const fs = require('fs'); +const path = require('path'); + /** * Find the directory containing the Xcode project within the app path @@ -642,7 +641,6 @@ async function openXcodeProject(appIosPath, appXcodeProject) { if (require.main === module) { const args = process.argv.slice(2); - let appPath = '../../private/helloworld'; let reactNativePath = '.'; let appXcodeProject = 'HelloWorld.xcodeproj'; @@ -660,7 +658,6 @@ if (require.main === module) { appXcodeProject = swiftPMConfig.appXcodeProject; targetName = swiftPMConfig.targetName; additionalPackages = swiftPMConfig.additionalPackages; - } catch { if (args.length >= 1) { appPath = args[0]; @@ -687,7 +684,13 @@ if (require.main === module) { console.log(`Using App Xcode project: ${appXcodeProject}`); console.log(`Using Target name: ${targetName}`); - prepareApp(appPath, reactNativePath, appXcodeProject, targetName, additionalPackages) + prepareApp( + appPath, + reactNativePath, + appXcodeProject, + targetName, + additionalPackages, + ) .then(() => { console.log( '\nšŸŽ‰ All done! Your app is ready for SwiftPM build from source.', diff --git a/packages/react-native/scripts/swiftpm/update-xcodeproject.js b/packages/react-native/scripts/swiftpm/update-xcodeproject.js index 007d15a6569..795eac93ea6 100644 --- a/packages/react-native/scripts/swiftpm/update-xcodeproject.js +++ b/packages/react-native/scripts/swiftpm/update-xcodeproject.js @@ -17,21 +17,26 @@ * - Other project-specific configurations */ +const { + addLocalSwiftPM, + convertXcodeProjectToJSON, + deintegrateSwiftPM, + updateXcodeProject, +} = require('./xcodeproj-utils'); const fs = require('fs'); const path = require('path'); -const { - convertXcodeProjectToJSON, - updateXcodeProject, - deintegrateSwiftPM, - addLocalSwiftPM -} = require('./xcodeproj-utils'); + /** * Integrate Swift packages into Xcode project * @param {string} xcodeProjectPath - Path to the app.xcodeproj file * @param {Array} packageSwiftObjects - List of PackageSwift objects with relativePath and targets * @param {string} appTargetName - Name of the app target */ -function integrateSwiftPackagesInXcode(xcodeProjectPath, packageSwiftObjects, appTargetName) { +function integrateSwiftPackagesInXcode( + xcodeProjectPath, + packageSwiftObjects, + appTargetName, +) { // Construct path to project.pbxproj const projectPbxprojPath = path.join(xcodeProjectPath, 'project.pbxproj'); @@ -51,12 +56,15 @@ function integrateSwiftPackagesInXcode(xcodeProjectPath, packageSwiftObjects, ap packageSwift.relativePath, packageSwift.targets, xcodeProject, - appTargetName + appTargetName, ); } // Convert back to text format and write to project.pbxproj file - fs.writeFileSync(projectPbxprojPath, updateXcodeProject(xcodeProject,projectPbxprojPath)); + fs.writeFileSync( + projectPbxprojPath, + updateXcodeProject(xcodeProject, projectPbxprojPath), + ); } // CLI usage @@ -64,8 +72,12 @@ if (require.main === module) { const args = process.argv.slice(2); if (args.length < 3) { - console.log('Usage: node update-xcodeproject.js '); - console.log('Example: node update-xcodeproject.js ./MyApp.xcodeproj MyApp \'[{"relativePath":"../react-native","targets":["ReactCommon","React-Core"]}]\''); + console.log( + 'Usage: node update-xcodeproject.js ', + ); + console.log( + 'Example: node update-xcodeproject.js ./MyApp.xcodeproj MyApp \'[{"relativePath":"../react-native","targets":["ReactCommon","React-Core"]}]\'', + ); process.exit(1); } @@ -75,7 +87,11 @@ if (require.main === module) { try { const packageSwiftObjects = JSON.parse(packageSwiftObjectsJSON); - integrateSwiftPackagesInXcode(xcodeProjectPath, packageSwiftObjects, appTargetName); + integrateSwiftPackagesInXcode( + xcodeProjectPath, + packageSwiftObjects, + appTargetName, + ); console.log('āœ… Successfully integrated Swift packages into Xcode project'); } catch (error) { console.error('āŒ Error:', error.message); @@ -84,5 +100,5 @@ if (require.main === module) { } module.exports = { - integrateSwiftPackagesInXcode + integrateSwiftPackagesInXcode, }; diff --git a/packages/react-native/scripts/swiftpm/xcodeproj-utils.js b/packages/react-native/scripts/swiftpm/xcodeproj-utils.js index 5a8dfbd1de5..20e3eccad54 100644 --- a/packages/react-native/scripts/swiftpm/xcodeproj-utils.js +++ b/packages/react-native/scripts/swiftpm/xcodeproj-utils.js @@ -8,8 +8,8 @@ * @format */ -const crypto = require('crypto'); const {execSync} = require('child_process'); +const crypto = require('crypto'); const fs = require('fs'); /** @@ -27,7 +27,7 @@ function generateXcodeObjectId() { */ function convertXcodeProjectToJSON(projectPath) { const command = `plutil -convert json -o - "${projectPath}"`; - const jsonOutput = execSync(command, { encoding: 'utf8' }); + const jsonOutput = execSync(command, {encoding: 'utf8'}); return JSON.parse(jsonOutput); } @@ -43,7 +43,9 @@ function updateXcodeProject(xcodeProjectJSON, projectPath) { // Group the objects in the JSON by their isa type const objectsByIsa = {}; - for (const [objectId, objectData] of Object.entries(xcodeProjectJSON.objects)) { + for (const [objectId, objectData] of Object.entries( + xcodeProjectJSON.objects, + )) { const isaType = objectData.isa; if (!objectsByIsa[isaType]) { objectsByIsa[isaType] = {}; @@ -52,30 +54,28 @@ function updateXcodeProject(xcodeProjectJSON, projectPath) { } // Update the Project.pbxproj file with the sections that needs to be rewritten - textualProject = updateProjectFile(textualProject, xcodeProjectJSON, objectsByIsa); + textualProject = updateProjectFile( + textualProject, + xcodeProjectJSON, + objectsByIsa, + ); // Update PBXProject.packagereference section - textualProject = updatePackageReferenceSection(textualProject, xcodeProjectJSON, objectsByIsa); + textualProject = updatePackageReferenceSection( + textualProject, + xcodeProjectJSON, + objectsByIsa, + ); // Update the PBXFrameworksBuildPhase.files array - textualProject = updatePBXFrameworksBuildPhaseFiles(textualProject, xcodeProjectJSON); + textualProject = updatePBXFrameworksBuildPhaseFiles( + textualProject, + xcodeProjectJSON, + ); return textualProject; } -/** - * Sort object keys with 'isa' first, then alphabetically - * @param {Object} objectData - The object to get sorted keys for - * @returns {Array} Sorted array of keys - */ -function sortKeys(objectData) { - return Object.keys(objectData).sort((a, b) => { - if (a === 'isa') return -1; - if (b === 'isa') return 1; - return a.localeCompare(b); - }); -} - /** * Remove all existing SwiftPM package references and dependencies from Xcode project * @param {Object} xcodeProject - The xcode project converted in JSON format @@ -87,22 +87,35 @@ function deintegrateSwiftPM(xcodeProject) { // Step 1: Find all PBXNativeTarget objects and clean up their SwiftPM dependencies for (const objectId in objects) { const object = objects[objectId]; - if (object.isa !== "PBXNativeTarget") continue; + if (object.isa !== 'PBXNativeTarget') continue; // Find PBXFrameworksBuildPhase for (const buildPhaseId of object.buildPhases || []) { const buildPhaseObject = objects[buildPhaseId]; - if (!buildPhaseObject || buildPhaseObject.isa !== "PBXFrameworksBuildPhase") continue; + if ( + !buildPhaseObject || + buildPhaseObject.isa !== 'PBXFrameworksBuildPhase' + ) + continue; const filesToRemove = []; // Check each file in the build phase for (const fileId of buildPhaseObject.files || []) { const buildFileObject = objects[fileId]; - if (!buildFileObject || buildFileObject.isa !== "PBXBuildFile" || !buildFileObject.productRef) continue; + if ( + !buildFileObject || + buildFileObject.isa !== 'PBXBuildFile' || + !buildFileObject.productRef + ) + continue; const productRefObject = objects[buildFileObject.productRef]; - if (!productRefObject || productRefObject.isa !== "XCSwiftPackageProductDependency") continue; + if ( + !productRefObject || + productRefObject.isa !== 'XCSwiftPackageProductDependency' + ) + continue; // Mark for removal: the product dependency, the build file, and remove from files list objectsToRemove.push(buildFileObject.productRef); @@ -112,7 +125,9 @@ function deintegrateSwiftPM(xcodeProject) { // Remove files from the build phase if (filesToRemove.length > 0) { - buildPhaseObject.files = (buildPhaseObject.files || []).filter(fileId => !filesToRemove.includes(fileId)); + buildPhaseObject.files = (buildPhaseObject.files || []).filter( + fileId => !filesToRemove.includes(fileId), + ); } } } @@ -120,14 +135,18 @@ function deintegrateSwiftPM(xcodeProject) { // Step 2: Find PBXProject and clean up packageReferences for (const objectId in objects) { const object = objects[objectId]; - if (object.isa !== "PBXProject") continue; + if (object.isa !== 'PBXProject') continue; const packageReferencesToRemove = []; // Check each package reference for (const packageRefId of object.packageReferences || []) { const packageRefObject = objects[packageRefId]; - if (!packageRefObject || packageRefObject.isa !== "XCLocalSwiftPackageReference") continue; + if ( + !packageRefObject || + packageRefObject.isa !== 'XCLocalSwiftPackageReference' + ) + continue; // Mark for removal objectsToRemove.push(packageRefId); @@ -136,7 +155,9 @@ function deintegrateSwiftPM(xcodeProject) { // Remove package references from the project if (packageReferencesToRemove.length > 0) { - object.packageReferences = (object.packageReferences || []).filter(refId => !packageReferencesToRemove.includes(refId)); + object.packageReferences = (object.packageReferences || []).filter( + refId => !packageReferencesToRemove.includes(refId), + ); } break; @@ -147,7 +168,9 @@ function deintegrateSwiftPM(xcodeProject) { delete objects[objectId]; } - console.log(`āœ“ Removed ${objectsToRemove.length} SwiftPM-related objects from Xcode project`); + console.log( + `āœ“ Removed ${objectsToRemove.length} SwiftPM-related objects from Xcode project`, + ); } /** @@ -161,15 +184,15 @@ function addLocalSwiftPM(relativePath, productNames, xcodeProject, targetName) { // For the relative path: create XCLocalSwiftPackageReference const packageReferenceId = generateXcodeObjectId(); xcodeProject.objects[packageReferenceId] = { - "isa": "XCLocalSwiftPackageReference", - "relativePath": relativePath + isa: 'XCLocalSwiftPackageReference', + relativePath: relativePath, }; // Find PBXProject object and update packageReferences const objects = xcodeProject.objects; for (const objectId in objects) { const object = objects[objectId]; - if (object.isa !== "PBXProject") continue; + if (object.isa !== 'PBXProject') continue; if (!object.packageReferences) { object.packageReferences = []; @@ -183,26 +206,31 @@ function addLocalSwiftPM(relativePath, productNames, xcodeProject, targetName) { // Generate XcodeID for XCSwiftPackageProductDependency const productDependencyId = generateXcodeObjectId(); xcodeProject.objects[productDependencyId] = { - "isa": "XCSwiftPackageProductDependency", - "productName": productName + isa: 'XCSwiftPackageProductDependency', + productName: productName, }; // Generate second XcodeID for PBXBuildFile const buildFileId = generateXcodeObjectId(); xcodeProject.objects[buildFileId] = { - "isa": "PBXBuildFile", - "productRef": productDependencyId + isa: 'PBXBuildFile', + productRef: productDependencyId, }; // Find PBXNativeTarget with matching name for (const objectId in objects) { const object = objects[objectId]; - if (object.isa !== "PBXNativeTarget" || object.name !== targetName) continue; + if (object.isa !== 'PBXNativeTarget' || object.name !== targetName) + continue; // Iterate over buildPhases to find PBXFrameworksBuildPhase for (const buildPhaseId of object.buildPhases) { const buildPhaseObject = objects[buildPhaseId]; - if (!buildPhaseObject || buildPhaseObject.isa !== "PBXFrameworksBuildPhase") continue; + if ( + !buildPhaseObject || + buildPhaseObject.isa !== 'PBXFrameworksBuildPhase' + ) + continue; // Add buildFileId to the files array if (!buildPhaseObject.files) { @@ -223,8 +251,11 @@ function addLocalSwiftPM(relativePath, productNames, xcodeProject, targetName) { * @returns {string} Updated textual project the sections that needs to be rewritten. */ function updateProjectFile(textualProject, xcodeProjectJSON, objectsByIsa) { - - const sectionsToRewrite = {'PBXBuildFile' : printPBXBuildFile, 'XCLocalSwiftPackageReference' : printXCLocalSwiftPackageReference , 'XCSwiftPackageProductDependency': printXCSwiftPackageProductDependency}; + const sectionsToRewrite = { + PBXBuildFile: printPBXBuildFile, + XCLocalSwiftPackageReference: printXCLocalSwiftPackageReference, + XCSwiftPackageProductDependency: printXCSwiftPackageProductDependency, + }; // Track which sections exist and which need to be added const sectionsToAdd = []; @@ -240,13 +271,21 @@ function updateProjectFile(textualProject, xcodeProjectJSON, objectsByIsa) { // Create replacement text using the appropriate print function let replacementText = ''; for (const objectId of sortedObjectIds) { - const objectData = objectsOfType[objectId]; - replacementText += printFn(objectId, objectData, xcodeProjectJSON.objects); + const objectData = objectsOfType[objectId]; + replacementText += printFn( + objectId, + objectData, + xcodeProjectJSON.objects, + ); } // Search for the section in textualProject and replace it - const sectionStartPattern = new RegExp(`/\\* Begin ${sectionType} section \\*/`); - const sectionEndPattern = new RegExp(`/\\* End ${sectionType} section \\*/`); + const sectionStartPattern = new RegExp( + `/\\* Begin ${sectionType} section \\*/`, + ); + const sectionEndPattern = new RegExp( + `/\\* End ${sectionType} section \\*/`, + ); const startMatch = textualProject.match(sectionStartPattern); const endMatch = textualProject.match(sectionEndPattern); @@ -264,7 +303,7 @@ function updateProjectFile(textualProject, xcodeProjectJSON, objectsByIsa) { // Section doesn't exist but we have objects to add sectionsToAdd.push({ sectionType, - replacementText: `/* Begin ${sectionType} section */\n${replacementText}/* End ${sectionType} section */\n` + replacementText: `/* Begin ${sectionType} section */\n${replacementText}/* End ${sectionType} section */\n`, }); } } @@ -277,7 +316,11 @@ function updateProjectFile(textualProject, xcodeProjectJSON, objectsByIsa) { return textualProject; } -function updatePackageReferenceSection(textualProject, xcodeProjectJSON, objectsByIsa) { +function updatePackageReferenceSection( + textualProject, + xcodeProjectJSON, + objectsByIsa, +) { const lines = textualProject.split('\n'); const processedLines = []; let inPBXProjectSection = false; @@ -306,7 +349,9 @@ function updatePackageReferenceSection(textualProject, xcodeProjectJSON, objects // If we're in the PBXProject section if (inPBXProjectSection) { // Look for project object pattern: "objectId /* Project object */ = {" - const projectMatch = line.match(/^\s*([A-F0-9]+)\s*\/\*\s*Project object\s*\*\/\s*=\s*\{/); + const projectMatch = line.match( + /^\s*([A-F0-9]+)\s*\/\*\s*Project object\s*\*\/\s*=\s*\{/, + ); if (projectMatch) { inProjectObject = true; projectBraceDepth = 1; @@ -329,12 +374,18 @@ function updatePackageReferenceSection(textualProject, xcodeProjectJSON, objects processedLines.push(line); // Generate new packageReferences content - const projectObject = xcodeProjectJSON.objects[currentProjectObjectId]; + const projectObject = + xcodeProjectJSON.objects[currentProjectObjectId]; if (projectObject && projectObject.packageReferences) { for (const packageRefId of projectObject.packageReferences) { const packageRefObject = xcodeProjectJSON.objects[packageRefId]; - if (packageRefObject && packageRefObject.isa === 'XCLocalSwiftPackageReference') { - processedLines.push(`\t\t\t\t${packageRefId} /* XCLocalSwiftPackageReference "${packageRefObject.relativePath}" */,`); + if ( + packageRefObject && + packageRefObject.isa === 'XCLocalSwiftPackageReference' + ) { + processedLines.push( + `\t\t\t\t${packageRefId} /* XCLocalSwiftPackageReference "${packageRefObject.relativePath}" */,`, + ); } } } @@ -352,7 +403,12 @@ function updatePackageReferenceSection(textualProject, xcodeProjectJSON, objects } // Check if we need to insert packageReferences property - if (projectBraceDepth === 1 && !packageReferencesInserted && !line.includes('packageReferences') && line.trim().endsWith(';')) { + if ( + projectBraceDepth === 1 && + !packageReferencesInserted && + !line.includes('packageReferences') && + line.trim().endsWith(';') + ) { // Check if this is a property line we should insert packageReferences before // Insert packageReferences in alphabetical order (after 'mainGroup' but before 'projectDirPath') const propertyMatch = line.match(/^\s*(\w+)\s*=/); @@ -361,13 +417,24 @@ function updatePackageReferenceSection(textualProject, xcodeProjectJSON, objects // Insert packageReferences before properties that come after 'p' alphabetically if (propertyName > 'packageReferences') { - const projectObject = xcodeProjectJSON.objects[currentProjectObjectId]; - if (projectObject && projectObject.packageReferences && projectObject.packageReferences.length > 0) { + const projectObject = + xcodeProjectJSON.objects[currentProjectObjectId]; + if ( + projectObject && + projectObject.packageReferences && + projectObject.packageReferences.length > 0 + ) { processedLines.push('\t\t\tpackageReferences = ('); for (const packageRefId of projectObject.packageReferences) { - const packageRefObject = xcodeProjectJSON.objects[packageRefId]; - if (packageRefObject && packageRefObject.isa === 'XCLocalSwiftPackageReference') { - processedLines.push(`\t\t\t\t${packageRefId} /* XCLocalSwiftPackageReference "${packageRefObject.relativePath}" */,`); + const packageRefObject = + xcodeProjectJSON.objects[packageRefId]; + if ( + packageRefObject && + packageRefObject.isa === 'XCLocalSwiftPackageReference' + ) { + processedLines.push( + `\t\t\t\t${packageRefId} /* XCLocalSwiftPackageReference "${packageRefObject.relativePath}" */,`, + ); } } processedLines.push('\t\t\t);'); @@ -407,17 +474,21 @@ function printPBXBuildFile(objectId, objectData, allObjects) { // Handle productRef case for Swift Package dependencies if (objectData.productRef) { const productRefObject = allObjects[objectData.productRef]; - const productName = productRefObject ? productRefObject.productName : 'Unknown'; + const productName = productRefObject + ? productRefObject.productName + : 'Unknown'; return `\t\t${objectId} /* ${productName} in Frameworks */ = {isa = PBXBuildFile; productRef = ${objectData.productRef} /* ${productName} */; };\n`; } // Handle fileRef case for regular files const referencedFile = allObjects[objectData.fileRef]; - const filename = referencedFile ? (referencedFile.name || referencedFile.path || 'Unknown') : 'Unknown'; + const filename = referencedFile + ? referencedFile.name || referencedFile.path || 'Unknown' + : 'Unknown'; // Determine the type by searching build phases let type = 'Unknown'; - for (const [phaseId, phaseObject] of Object.entries(allObjects)) { + for (const [, phaseObject] of Object.entries(allObjects)) { if (phaseObject.files && phaseObject.files.includes(objectId)) { // Check if the isa property ends up with "BuildPhase" if (phaseObject.isa.endsWith('BuildPhase')) { @@ -443,7 +514,9 @@ function printXCLocalSwiftPackageReference(objectId, objectData, allObjects) { const relativePath = objectData.relativePath; // Escape path with quotes if it contains spaces - const escapedPath = relativePath.includes(' ') ? `"${relativePath}"` : relativePath; + const escapedPath = relativePath.includes(' ') + ? `"${relativePath}"` + : relativePath; return `\t\t${objectId} /* XCLocalSwiftPackageReference "${relativePath}" */ = { \t\t\tisa = XCLocalSwiftPackageReference; @@ -459,7 +532,11 @@ function printXCLocalSwiftPackageReference(objectId, objectData, allObjects) { * @param {Object} allObjects - All objects for reference lookup * @returns {string} Formatted string for this object type */ -function printXCSwiftPackageProductDependency(objectId, objectData, allObjects) { +function printXCSwiftPackageProductDependency( + objectId, + objectData, + allObjects, +) { const productName = objectData.productName; return `\t\t${objectId} /* ${productName} */ = { @@ -496,7 +573,11 @@ function printFilesForBuildPhase(objectId, objectData, allObjects) { */ function addMissingSections(textualProject, sectionsToAdd) { // Define the order of sections - PBXBuildFile first, then XCLocalSwiftPackageReference, then XCSwiftPackageProductDependency - const sectionOrder = ['PBXBuildFile', 'XCLocalSwiftPackageReference', 'XCSwiftPackageProductDependency']; + const sectionOrder = [ + 'PBXBuildFile', + 'XCLocalSwiftPackageReference', + 'XCSwiftPackageProductDependency', + ]; // Sort sections according to the defined order sectionsToAdd.sort((a, b) => { @@ -510,7 +591,7 @@ function addMissingSections(textualProject, sectionsToAdd) { let insertionIndex = -1; for (const sectionToAdd of sectionsToAdd) { - const { sectionType, replacementText } = sectionToAdd; + const {sectionType, replacementText} = sectionToAdd; if (sectionType === 'PBXBuildFile') { // PBXBuildFile should be first in the objects array @@ -526,7 +607,7 @@ function addMissingSections(textualProject, sectionsToAdd) { // Find the rootObject line and go back to find a good insertion point for (let i = lines.length - 1; i >= 0; i--) { if (lines[i].includes('rootObject =')) { - insertionIndex = i-1; + insertionIndex = i - 1; break; } } @@ -534,7 +615,7 @@ function addMissingSections(textualProject, sectionsToAdd) { // Should be last before rootObject for (let i = lines.length - 1; i >= 0; i--) { if (lines[i].includes('rootObject =')) { - insertionIndex = i-1; + insertionIndex = i - 1; break; } } @@ -562,7 +643,6 @@ function updatePBXFrameworksBuildPhaseFiles(textualProject, xcodeProjectJSON) { const processedLines = []; let inPBXFrameworksBuildPhase = false; let inFrameworksSection = false; - let inFilesSection = false; let frameworksBraceDepth = 0; let currentFrameworksBuildPhaseId = null; @@ -586,7 +666,9 @@ function updatePBXFrameworksBuildPhaseFiles(textualProject, xcodeProjectJSON) { // If we're in the PBXFrameworksBuildPhase section if (inPBXFrameworksBuildPhase) { // Look for framework build phase pattern: "objectId /* Frameworks */ = {" - const frameworksMatch = line.match(/^\s*([A-F0-9]+)\s*\/\*\s*Frameworks\s*\*\/\s*=\s*\{/); + const frameworksMatch = line.match( + /^\s*([A-F0-9]+)\s*\/\*\s*Frameworks\s*\*\/\s*=\s*\{/, + ); if (frameworksMatch) { inFrameworksSection = true; frameworksBraceDepth = 1; @@ -604,16 +686,22 @@ function updatePBXFrameworksBuildPhaseFiles(textualProject, xcodeProjectJSON) { // Check if we found "files = (" if (line.includes('files = (')) { - inFilesSection = true; processedLines.push(line); // Generate new files content - const frameworksBuildPhase = xcodeProjectJSON.objects[currentFrameworksBuildPhaseId]; + const frameworksBuildPhase = + xcodeProjectJSON.objects[currentFrameworksBuildPhaseId]; if (frameworksBuildPhase && frameworksBuildPhase.files) { for (const fileId of frameworksBuildPhase.files) { const buildFileObject = xcodeProjectJSON.objects[fileId]; if (buildFileObject) { - processedLines.push(printFilesForBuildPhase(fileId, buildFileObject, xcodeProjectJSON.objects)); + processedLines.push( + printFilesForBuildPhase( + fileId, + buildFileObject, + xcodeProjectJSON.objects, + ), + ); } } } @@ -627,7 +715,6 @@ function updatePBXFrameworksBuildPhaseFiles(textualProject, xcodeProjectJSON) { if (i < lines.length) { processedLines.push(lines[i]); } - inFilesSection = false; continue; } diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj index 733d391337e..4ceae9d500a 100644 --- a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj +++ b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj @@ -9,20 +9,17 @@ /* Begin PBXBuildFile section */ 0EA618032BE537D3001875EF /* RNTesterBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0EA618022BE537D3001875EF /* RNTesterBundle.bundle */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 29FDD7ACD0EED86C4CD45E0B /* PushNotification in Frameworks */ = {isa = PBXBuildFile; productRef = E4CC3671F206482FC0EDA7CE /* PushNotification */; }; 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */; }; - 30C8AC139EC77B26D85EE30B /* React in Frameworks */ = {isa = PBXBuildFile; productRef = 9338378C508470DCA89DC137 /* React */; }; + 3584606AB7F8ADF7A07A3E14 /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF9F45393190A3F008764D08 /* libPods-RNTesterIntegrationTests.a */; }; 383889DA23A7398900D06C3E /* RCTConvert_UIColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 383889D923A7398900D06C3E /* RCTConvert_UIColorTests.m */; }; 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 499D85269FB4E4A441D7602A /* ReactAppDependencyProvider in Frameworks */ = {isa = PBXBuildFile; productRef = 89F8F2FEC466BAE2E866C515 /* ReactAppDependencyProvider */; }; 5C60EB1C226440DB0018C04F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C60EB1B226440DB0018C04F /* AppDelegate.mm */; }; 8145AE06241172D900A3F8DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */; }; 832F45BB2A8A6E1F0097B4E6 /* SwiftTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 832F45BA2A8A6E1F0097B4E6 /* SwiftTest.swift */; }; - 8E7012DBC2F600D00E2430DF /* NativeComponentExample in Frameworks */ = {isa = PBXBuildFile; productRef = EB12214D49AEE6C5B1F47F46 /* NativeComponentExample */; }; + A36E4394472D388C2F6BBABA /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 48A747D61749335D863001E9 /* libPods-RNTester.a */; }; A975CA6C2C05EADF0043F72A /* RCTNetworkTaskTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A975CA6B2C05EADE0043F72A /* RCTNetworkTaskTests.m */; }; - BB2F124DC36981B77FF018CC /* ReactCodegen in Frameworks */ = {isa = PBXBuildFile; productRef = 3B4620A225DE72BCA5FCBF92 /* ReactCodegen */; }; + BF2C34488C1E5FF62D331DD4 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E89C730A8F64BC35672D4D81 /* libPods-RNTesterUnitTests.a */; }; CD10C7A5290BD4EB0033E1ED /* RCTEventEmitterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CD10C7A4290BD4EB0033E1ED /* RCTEventEmitterTests.m */; }; - D5577B46043558B8D991B484 /* NativeCxxModuleExample in Frameworks */ = {isa = PBXBuildFile; productRef = DECCBECE8BF01ABF236E5832 /* NativeCxxModuleExample */; }; E62F11832A5C6580000BF1C8 /* FlexibleSizeExampleView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.mm */; }; E62F11842A5C6584000BF1C8 /* UpdatePropertiesExampleView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.mm */; }; E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */; }; @@ -89,17 +86,25 @@ 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNTester/main.m; sourceTree = ""; }; 272E6B3B1BEA849E001FCF37 /* UpdatePropertiesExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UpdatePropertiesExampleView.h; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.h; sourceTree = ""; }; 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UpdatePropertiesExampleView.mm; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.mm; sourceTree = ""; }; + 2734C5E31C1D7A09BF872585 /* Pods-RNTester.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.debug.xcconfig"; path = "Target Support Files/Pods-RNTester/Pods-RNTester.debug.xcconfig"; sourceTree = ""; }; 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FlexibleSizeExampleView.mm; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.mm; sourceTree = ""; }; 27F441EA1BEBE5030039B79C /* FlexibleSizeExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlexibleSizeExampleView.h; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.h; sourceTree = ""; }; 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RNTester/Images.xcassets; sourceTree = ""; }; + 359825B9A5AE4A3F4AA612DD /* Pods-RNTesterUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.debug.xcconfig"; path = "Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.debug.xcconfig"; sourceTree = ""; }; 383889D923A7398900D06C3E /* RCTConvert_UIColorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_UIColorTests.m; sourceTree = ""; }; 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "legacy_image@2x.png"; path = "RNTester/legacy_image@2x.png"; sourceTree = ""; }; + 48A747D61749335D863001E9 /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 5C60EB1B226440DB0018C04F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = RNTester/AppDelegate.mm; sourceTree = ""; }; + 66C3087F2D5BF762FE9E6422 /* Pods-RNTesterIntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.debug.xcconfig"; path = "Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.debug.xcconfig"; sourceTree = ""; }; + 7CDA7A212644C6BB8C0D00D8 /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = ""; }; 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = RNTester/LaunchScreen.storyboard; sourceTree = ""; }; 832F45BA2A8A6E1F0097B4E6 /* SwiftTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SwiftTest.swift; path = RNTester/SwiftTest.swift; sourceTree = ""; }; + 8BFB9C61D7BDE894E24BF24F /* Pods-RNTesterUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.release.xcconfig"; path = "Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.release.xcconfig"; sourceTree = ""; }; + 9B8542B8C590B51BD0588751 /* Pods-RNTester.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.release.xcconfig"; path = "Target Support Files/Pods-RNTester/Pods-RNTester.release.xcconfig"; sourceTree = ""; }; A975CA6B2C05EADE0043F72A /* RCTNetworkTaskTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTNetworkTaskTests.m; sourceTree = ""; }; AC474BFB29BBD4A1002BDAED /* RNTester.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = RNTester.xctestplan; path = RNTester/RNTester.xctestplan; sourceTree = ""; }; CD10C7A4290BD4EB0033E1ED /* RCTEventEmitterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventEmitterTests.m; sourceTree = ""; }; + DF9F45393190A3F008764D08 /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E771AEEA22B44E3100EA1189 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = ""; }; E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests.m; sourceTree = ""; }; E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -161,6 +166,7 @@ E7DB215E22B2F3EC005AC45F /* RCTLoggingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLoggingTests.m; sourceTree = ""; }; E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerScenarioTests.m; sourceTree = ""; }; E7DB218B22B41FCD005AC45F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XCTest.framework; sourceTree = DEVELOPER_DIR; }; + E89C730A8F64BC35672D4D81 /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; F0D621C22BBB9E38005960AC /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; /* End PBXFileReference section */ @@ -169,18 +175,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8E7012DBC2F600D00E2430DF /* NativeComponentExample in Frameworks */, - - D5577B46043558B8D991B484 /* NativeCxxModuleExample in Frameworks */, - - 29FDD7ACD0EED86C4CD45E0B /* PushNotification in Frameworks */, - - 30C8AC139EC77B26D85EE30B /* React in Frameworks */, - - BB2F124DC36981B77FF018CC /* ReactCodegen in Frameworks */, - - 499D85269FB4E4A441D7602A /* ReactAppDependencyProvider in Frameworks */, - + A36E4394472D388C2F6BBABA /* libPods-RNTester.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -189,7 +184,7 @@ buildActionMask = 2147483647; files = ( E7DB213122B2C649005AC45F /* JavaScriptCore.framework in Frameworks */, - + BF2C34488C1E5FF62D331DD4 /* libPods-RNTesterUnitTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -198,9 +193,8 @@ buildActionMask = 2147483647; files = ( E7DB218C22B41FCD005AC45F /* XCTest.framework in Frameworks */, - E7DB216722B2F69F005AC45F /* JavaScriptCore.framework in Frameworks */, - + 3584606AB7F8ADF7A07A3E14 /* libPods-RNTesterIntegrationTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -271,6 +265,9 @@ E7DB211822B2BD53005AC45F /* libReact-RCTText.a */, E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */, E7DB212222B2BD53005AC45F /* libyoga.a */, + 48A747D61749335D863001E9 /* libPods-RNTester.a */, + DF9F45393190A3F008764D08 /* libPods-RNTesterIntegrationTests.a */, + E89C730A8F64BC35672D4D81 /* libPods-RNTesterUnitTests.a */, ); name = Frameworks; sourceTree = ""; @@ -311,6 +308,12 @@ E23BD6487B06BD71F1A86914 /* Pods */ = { isa = PBXGroup; children = ( + 2734C5E31C1D7A09BF872585 /* Pods-RNTester.debug.xcconfig */, + 9B8542B8C590B51BD0588751 /* Pods-RNTester.release.xcconfig */, + 66C3087F2D5BF762FE9E6422 /* Pods-RNTesterIntegrationTests.debug.xcconfig */, + 7CDA7A212644C6BB8C0D00D8 /* Pods-RNTesterIntegrationTests.release.xcconfig */, + 359825B9A5AE4A3F4AA612DD /* Pods-RNTesterUnitTests.debug.xcconfig */, + 8BFB9C61D7BDE894E24BF24F /* Pods-RNTesterUnitTests.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -375,11 +378,14 @@ isa = PBXNativeTarget; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RNTester" */; buildPhases = ( + ABDE2A52ACD1B95E14790B5E /* [CP] Check Pods Manifest.lock */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 68CD48B71D2BCB2C007E06A9 /* Build JS Bundle */, 79E8BE2B119D4C5CCD2F04B3 /* [RN] Copy Hermes Framework */, + 02B6FEF7E86B613B42F31284 /* [CP] Embed Pods Frameworks */, + 5625E703156DD564DE9175B0 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -394,9 +400,12 @@ isa = PBXNativeTarget; buildConfigurationList = E7DB20A622B2BA84005AC45F /* Build configuration list for PBXNativeTarget "RNTesterUnitTests" */; buildPhases = ( + 4F76596957F7356516B534CE /* [CP] Check Pods Manifest.lock */, E7DB209B22B2BA84005AC45F /* Sources */, E7DB209C22B2BA84005AC45F /* Frameworks */, E7DB209D22B2BA84005AC45F /* Resources */, + A904658C20543C2EDC217D15 /* [CP] Embed Pods Frameworks */, + 01934C30687B8C926E4F59CD /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -412,9 +421,12 @@ isa = PBXNativeTarget; buildConfigurationList = E7DB215A22B2F332005AC45F /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */; buildPhases = ( + B7EB74515CDE78D98087DD53 /* [CP] Check Pods Manifest.lock */, E7DB214F22B2F332005AC45F /* Sources */, E7DB215022B2F332005AC45F /* Frameworks */, E7DB215122B2F332005AC45F /* Resources */, + 4F27ACC9DB890B37D6C267F1 /* [CP] Embed Pods Frameworks */, + E446637427ECD101CAACE52B /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -456,12 +468,6 @@ Base, ); mainGroup = 83CBB9F61A601CBA00E9B192; - packageReferences = ( - 77FB63CB6289F642D3211344 /* XCLocalSwiftPackageReference "../rn-tester" */, - E0AB0E98BDE9BF5752718E63 /* XCLocalSwiftPackageReference "../react-native/Libraries" */, - 8E8E50F217A0D2126D4A7D63 /* XCLocalSwiftPackageReference "../react-native" */, - 89CAA42E30A1DA3DCBD75B6D /* XCLocalSwiftPackageReference "build/generated/ios" */, - ); productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -504,6 +510,96 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 01934C30687B8C926E4F59CD /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 02B6FEF7E86B613B42F31284 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4F27ACC9DB890B37D6C267F1 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4F76596957F7356516B534CE /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RNTesterUnitTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 5625E703156DD564DE9175B0 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 68CD48B71D2BCB2C007E06A9 /* Build JS Bundle */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -538,6 +634,84 @@ shellPath = /bin/sh; shellScript = ". ../react-native/sdks/hermes-engine/utils/copy-hermes-xcode.sh\n"; }; + A904658C20543C2EDC217D15 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + ABDE2A52ACD1B95E14790B5E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RNTester-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + B7EB74515CDE78D98087DD53 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RNTesterIntegrationTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + E446637427ECD101CAACE52B /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -620,9 +794,9 @@ /* Begin XCBuildConfiguration section */ 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 2734C5E31C1D7A09BF872585 /* Pods-RNTester.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; DEVELOPMENT_TEAM = ""; HEADER_SEARCH_PATHS = ( @@ -658,9 +832,9 @@ }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9B8542B8C590B51BD0588751 /* Pods-RNTester.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; DEVELOPMENT_TEAM = ""; EXCLUDED_ARCHS = ""; @@ -697,7 +871,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++20"; CLANG_CXX_LIBRARY = "libc++"; @@ -783,7 +956,7 @@ "-ObjC", "-lc++", ); - REACT_NATIVE_PATH = "${PROJECT_DIR}/../react-native"; + REACT_NATIVE_PATH = "${PODS_ROOT}/../../react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; USE_HERMES = true; @@ -799,7 +972,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++20"; CLANG_CXX_LIBRARY = "libc++"; @@ -877,7 +1049,7 @@ "-ObjC", "-lc++", ); - REACT_NATIVE_PATH = "${PROJECT_DIR}/../react-native"; + REACT_NATIVE_PATH = "${PODS_ROOT}/../../react-native"; SDKROOT = iphoneos; USE_HERMES = true; VALIDATE_PRODUCT = YES; @@ -891,9 +1063,9 @@ }; E7DB20A722B2BA84005AC45F /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 359825B9A5AE4A3F4AA612DD /* Pods-RNTesterUnitTests.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_OBJC_WEAK = YES; @@ -929,9 +1101,9 @@ }; E7DB20A822B2BA84005AC45F /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 8BFB9C61D7BDE894E24BF24F /* Pods-RNTesterUnitTests.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_OBJC_WEAK = YES; @@ -967,10 +1139,10 @@ }; E7DB215B22B2F332005AC45F /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 66C3087F2D5BF762FE9E6422 /* Pods-RNTesterIntegrationTests.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_OBJC_WEAK = YES; @@ -1006,10 +1178,10 @@ }; E7DB215C22B2F332005AC45F /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 7CDA7A212644C6BB8C0D00D8 /* Pods-RNTesterIntegrationTests.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ENABLE_OBJC_WEAK = YES; @@ -1079,52 +1251,6 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ - -/* Begin XCLocalSwiftPackageReference section */ - 77FB63CB6289F642D3211344 /* XCLocalSwiftPackageReference "../rn-tester" */ = { - isa = XCLocalSwiftPackageReference; - relativePath = ../rn-tester; - }; - 89CAA42E30A1DA3DCBD75B6D /* XCLocalSwiftPackageReference "build/generated/ios" */ = { - isa = XCLocalSwiftPackageReference; - relativePath = build/generated/ios; - }; - 8E8E50F217A0D2126D4A7D63 /* XCLocalSwiftPackageReference "../react-native" */ = { - isa = XCLocalSwiftPackageReference; - relativePath = ../react-native; - }; - E0AB0E98BDE9BF5752718E63 /* XCLocalSwiftPackageReference "../react-native/Libraries" */ = { - isa = XCLocalSwiftPackageReference; - relativePath = ../react-native/Libraries; - }; -/* End XCLocalSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - 3B4620A225DE72BCA5FCBF92 /* ReactCodegen */ = { - isa = XCSwiftPackageProductDependency; - productName = ReactCodegen; - }; - 89F8F2FEC466BAE2E866C515 /* ReactAppDependencyProvider */ = { - isa = XCSwiftPackageProductDependency; - productName = ReactAppDependencyProvider; - }; - 9338378C508470DCA89DC137 /* React */ = { - isa = XCSwiftPackageProductDependency; - productName = React; - }; - DECCBECE8BF01ABF236E5832 /* NativeCxxModuleExample */ = { - isa = XCSwiftPackageProductDependency; - productName = NativeCxxModuleExample; - }; - E4CC3671F206482FC0EDA7CE /* PushNotification */ = { - isa = XCSwiftPackageProductDependency; - productName = PushNotification; - }; - EB12214D49AEE6C5B1F47F46 /* NativeComponentExample */ = { - isa = XCSwiftPackageProductDependency; - productName = NativeComponentExample; - }; -/* End XCSwiftPackageProductDependency section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; } diff --git a/packages/rn-tester/swiftpm.config.js b/packages/rn-tester/swiftpm.config.js index 386b48a5517..5a1e8a38b17 100644 --- a/packages/rn-tester/swiftpm.config.js +++ b/packages/rn-tester/swiftpm.config.js @@ -14,7 +14,13 @@ const path = require('path'); const config = { appPath: path.resolve(__dirname, '.'), - reactNativePath: path.resolve(__dirname, '..', '..', 'packages', 'react-native'), + reactNativePath: path.resolve( + __dirname, + '..', + '..', + 'packages', + 'react-native', + ), appXcodeProject: 'RNTesterPods.xcodeproj', targetName: 'RNTester', additionalPackages: [ @@ -27,6 +33,6 @@ const config = { targets: ['PushNotification'], }, ], -} +}; module.exports = config;