Various fixes for Hermes build-from-source behaviour

Summary:
Original title: **[RN] Do not encode path to cmake in hermes-engine Pod, build hermesc in prepare_pods**

The result of `#{%x(command -v cmake | tr -d '\n')}` was being encoded into the `hermes-engine` Pod. This can lead to conflicts in the CocoaPods cache when `pod install` is run on different machines.

Instead of running the command during `pod install`, we defer to the actual build scripts so they can find `cmake` when `$CMAKE_BINARY` is not set.

More importantly, this fixes an issue that crept into the Sandcastle CocoaPods offline mirrors, but which would only manifest itself when people run `js1 oss prepare-pods`.

RNTester would not build due to RNTesterPods.xcworkspace being configured to use cmake from an arbitrary path instead of using the cmake from $PATH.

This does not affect Sandcastle due to `CMAKE_BINARY` getting overriden in Sandcastle.
 ---

**Update** by dmytrorykun:

It is impossible to address the problem described in the original title by simply adding `CMAKE_BINARY=${CMAKE_BINARY:-cmake}` to `build-hermes-xcode.sh`. This script is supposed to run from Xcode. Since Xcode doesn't have access to system `PATH` variable, it is unable to locate `cmake`, and build fails.

However this diff contains other useful changes:

1. Remove trailing newline in `cmake` path in `build-hermes-xcode.sh`.
2. Fix inverted logic in `copy-hermes-xcode.sh`.
3. Fix typo in `remove xcuserdata` step in Sandcastle.
4. Remove unused `HERMES_DISABLE_HERMESC_BUILD`.

Changelog:
[iOS] [Fixed] - Various fixes for Hermes build-from-source behaviour.

Reviewed By: cipolleschi

Differential Revision: D41139384

fbshipit-source-id: 4a4a44a7ac201d279718d84cd02d60b4eaf3956b
This commit is contained in:
Dmitry Rykun
2022-11-22 11:29:56 +00:00
committed by Lorenzo Sciandra
parent 362e1974fe
commit 572ada9308
2 changed files with 2 additions and 2 deletions
@@ -8,7 +8,7 @@ set -x
hermesc_dir_path="$1"
CMAKE_BINARY=${CMAKE_BINARY:-cmake}
CMAKE_BINARY=${CMAKE_BINARY:-$(command -v cmake | tr -d '\n')}
if ! "$CMAKE_BINARY" -S . -B "$hermesc_dir_path"
then
@@ -8,7 +8,7 @@ set -x
source="${PODS_ROOT}/hermes-engine/destroot/Library/Frameworks/${PLATFORM_NAME}/hermes.framework"
if [[ ! -f "$source" ]]; then
if [[ -f "$source" ]]; then
cp -R "$source" "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes/hermes.framework"
cp -R "$source" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
fi