diff --git a/packages/create-react-native-library/src/index.ts b/packages/create-react-native-library/src/index.ts index 5d0b0ba1d..3585d7071 100644 --- a/packages/create-react-native-library/src/index.ts +++ b/packages/create-react-native-library/src/index.ts @@ -813,7 +813,7 @@ async function create(_argv: yargs.Arguments) { exampleCommunityCLIVersion; if (arch !== 'legacy') { - addCodegenBuildScript(folder, options.project.name); + addCodegenBuildScript(folder); } } } diff --git a/packages/create-react-native-library/src/utils/addCodegenBuildScript.ts b/packages/create-react-native-library/src/utils/addCodegenBuildScript.ts index 110200c76..cf534d0a3 100644 --- a/packages/create-react-native-library/src/utils/addCodegenBuildScript.ts +++ b/packages/create-react-native-library/src/utils/addCodegenBuildScript.ts @@ -16,18 +16,6 @@ if (isNewArchitectureEnabled()) { preBuild.dependsOn invokeLibraryCodegen }`; -// This is added to the example app's xcscheme file to invoke codegen before every build -const XCODE_INVOKE_CODEGEN_ACTION = ` - - - - - - `; - // You need to have the files before calling pod install otherwise they won't be registered in your pod. // So we add a pre_install hook to the podfile that invokes codegen const PODSPEC_INVOKE_CODEGEN_SCRIPT = ` @@ -40,10 +28,7 @@ const PODSPEC_INVOKE_CODEGEN_SCRIPT = ` * Codegen isn't invoked for libraries with `includesGeneratedCode` set to `true`. * This patches the example app to invoke library codegen on every app build. */ -export async function addCodegenBuildScript( - libraryPath: string, - projectName: string -) { +export async function addCodegenBuildScript(libraryPath: string) { const appBuildGradlePath = path.join( libraryPath, 'example', @@ -51,15 +36,6 @@ export async function addCodegenBuildScript( 'app', 'build.gradle' ); - const exampleAppBuildSchemePath = path.join( - libraryPath, - 'example', - 'ios', - `${projectName}Example.xcodeproj`, - 'xcshareddata', - 'xcschemes', - `${projectName}Example.xcscheme` - ); const podfilePath = path.join(libraryPath, 'example', 'ios', 'Podfile'); // Add a gradle task that runs before every build @@ -68,25 +44,6 @@ export async function addCodegenBuildScript( await fs.writeFile(appBuildGradlePath, appBuildGradle); - // Add an XCode prebuild action. - const exampleAppBuildScheme = (await fs.readFile(exampleAppBuildSchemePath)) - .toString() - .split('\n'); - // Used XCode and inspected the result to determine where it inserts the actions - const actionTargetLineIndex = exampleAppBuildScheme.findIndex((line) => - line.includes('') - ); - exampleAppBuildScheme.splice( - actionTargetLineIndex, - 0, - XCODE_INVOKE_CODEGEN_ACTION - ); - - await fs.writeFile( - exampleAppBuildSchemePath, - exampleAppBuildScheme.join('\n') - ); - // Add a preinstall action to the podfile that invokes codegen const podfile = (await fs.readFile(podfilePath)).toString().split('\n'); const podfilePostInstallIndex = podfile.findIndex((line) =>