Skip to content

Commit

Permalink
Fix path to react-native-codegen
Browse files Browse the repository at this point in the history
Summary:
The wrong value for the path to react-native-codegen was being used. The issue was introduced during the refactoring of this script for use in FBReactNativeSpec.podspec.

Changelog: [Internal]

Motivation:

Reviewed By: fkgozali

Differential Revision: D25290355

fbshipit-source-id: 5a46c680e7ea41157b03cf54a640a8816fb682b3
  • Loading branch information
hramos authored and grabbou committed Dec 3, 2020
1 parent d823aef commit 15f2413
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions scripts/generate-native-modules-specs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ set -e
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
TEMP_DIR=$(mktemp -d /tmp/react-native-codegen-XXXXXXXX)
RN_DIR=$(cd "$THIS_DIR/.." && pwd)
CODEGEN_PATH="${CODEGEN_PATH:-$(cd "$RN_DIR/packages" && pwd)}"
CODEGEN_DIR="$CODEGEN_PATH/react-native-codegen"

CODEGEN_PATH="${CODEGEN_PATH:-$(cd "$RN_DIR/packages/react-native-codegen" && pwd)}"
YARN_BINARY="${YARN_BINARY:-$(command -v yarn)}"

cleanup () {
Expand All @@ -40,33 +38,23 @@ describe () {
printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"
}

step_build_codegen () {
if [ ! -d "$CODEGEN_DIR/lib" ]; then
describe "Building react-native-codegen package"
pushd "$CODEGEN_DIR" >/dev/null || exit
"$YARN_BINARY"
"$YARN_BINARY" build
popd >/dev/null || exit
fi
}

run_codegen () {
SRCS_DIR=$1
LIBRARY_NAME=$2
OUTPUT_DIR=$3

SCHEMA_FILE="$TEMP_DIR/schema-$LIBRARY_NAME.json"

if [ ! -d "$CODEGEN_DIR/lib" ]; then
if [ ! -d "$CODEGEN_PATH/lib" ]; then
describe "Building react-native-codegen package"
pushd "$CODEGEN_DIR" >/dev/null || exit
pushd "$CODEGEN_PATH" >/dev/null || exit
"$YARN_BINARY"
"$YARN_BINARY" build
popd >/dev/null || exit
fi

describe "Generating schema from flow types"
"$YARN_BINARY" node "$CODEGEN_DIR/lib/cli/combine/combine-js-to-schema-cli.js" "$SCHEMA_FILE" "$SRCS_DIR"
"$YARN_BINARY" node "$CODEGEN_PATH/lib/cli/combine/combine-js-to-schema-cli.js" "$SCHEMA_FILE" "$SRCS_DIR"

describe "Generating native code from schema (iOS)"
pushd "$RN_DIR" >/dev/null || exit
Expand Down

0 comments on commit 15f2413

Please sign in to comment.