Skip to content

Commit

Permalink
Fix no support Schemes names contain spaces (#39009)
Browse files Browse the repository at this point in the history
Summary:
i just moved to the new react native 0.72.1 with the new Architecture and I encountered a problem when tried to archive my develop version(i have 2 Schemes one for prod and one for dev).

so i did some digging and got to the problem that was found in script file named "generate-artifacts-executor.js".

i found that after generating lib content into the temp directory(tmpOutputDir)
it copy all the content into the real output directory(iosOutputDir).

the problem was that the real output directory(iosOutputDir) containing the selected scheme name and mine was with backspace(AppTest Develop) so the cp -r command was failing.

in order to fix that i wrapped the real output directory(iosOutputDir) with double quotes.

Also updated the related test ("executeNodes with the right arguments") to include the double quotes.

## Changelog:

[GENERAL] [FIXED] - Add support to archive Schemes names with backspaces

Pull Request resolved: #39009

Test Plan:
1. After updating the related test ("executeNodes with the right arguments") to include the double quotes i run all tests by
run yarn test and yarn flow and All tests passed.

2. Also after i changed locally the script file in my project from the node_modules
    i successfully Archived both my Schemes dev and prod (one with backspace and one without).

Reviewed By: cipolleschi

Differential Revision: D48414256

Pulled By: NickGerleman

fbshipit-source-id: 829440b33799251fe5ef1c0f83d0fdef7a1cc254
  • Loading branch information
yardenPhy authored and facebook-github-bot committed Aug 22, 2023
1 parent 826e74f commit a384e07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('generateCode', () => {
expect(child_process.execSync).toHaveBeenCalledTimes(1);
expect(child_process.execSync).toHaveBeenNthCalledWith(
1,
`cp -R ${tmpOutputDir}/* ${iosOutputDir}`,
`cp -R ${tmpOutputDir}/* "${iosOutputDir}"`,
);

expect(fs.mkdirSync).toHaveBeenCalledTimes(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function generateCode(iosOutputDir, library, tmpDir, node, pathToSchema) {
const outputDir =
CORE_LIBRARIES_WITH_OUTPUT_FOLDER[library.config.name] ?? iosOutputDir;
fs.mkdirSync(outputDir, {recursive: true});
execSync(`cp -R ${tmpOutputDir}/* ${outputDir}`);
execSync(`cp -R ${tmpOutputDir}/* "${outputDir}"`);
console.log(`[Codegen] Generated artifacts: ${iosOutputDir}`);
}

Expand Down

0 comments on commit a384e07

Please sign in to comment.