Skip to content

Commit

Permalink
fix //xplat/js/react-native-github:codegen_rn_components_schema_rncore (
Browse files Browse the repository at this point in the history
facebook#33518)

Summary:
Pull Request resolved: facebook#33518

Changelog: [Internal]

When building with buck2, `setup_env_vars.sh` cannot be found. exporting setup_env_vars.sh and adding it as a dep to `write_to_json` fixes it.

Reviewed By: d16r

Differential Revision: D35188154

fbshipit-source-id: e1e1be4c83a57e443a181efaf1af3e6c8e6452f9
  • Loading branch information
Wei Han authored and facebook-github-bot committed Mar 30, 2022
1 parent 28064ee commit 0353852
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fb_native.genrule(
) + [
react_native_root_target("packages/rn-tester:nativecomponent-srcs"),
],
labels = ["uses_hg"],
cmd = "$(exe {}) $OUT $SRCS".format(react_native_root_target("packages/react-native-codegen:write_to_json")),
out = "schema-rncore.json",
)
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-codegen/DEFS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def rn_codegen_cli():
"src/cli/combine/combine_js_to_schema.sh",
":yarn-workspace",
"//xplat/js:setup_env",
"//xplat/js:setup_env_vars",
],
visibility = ["PUBLIC"],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ set -u

THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)

SETUP_ENV_VARS_PATH="$BUCK_PROJECT_ROOT/env-utils/setup_env_vars.sh"

# Somehow this path this doesn't work in BUCK1, so falling back to the exisiting path that we use in BUCK1.
if [ ! -f "${SETUP_ENV_VARS_PATH}" ]; then
SETUP_ENV_VARS_PATH="$BUCK_PROJECT_ROOT/xplat/js/env-utils/setup_env_vars.sh"
fi

# shellcheck source=xplat/js/env-utils/setup_env_vars.sh
source "$THIS_DIR/../../../../../../env-utils/setup_env_vars.sh"
source "${SETUP_ENV_VARS_PATH}"

pushd "$JS_DIR" >/dev/null
"$INSTALL_NODE_MODULES"
Expand Down

0 comments on commit 0353852

Please sign in to comment.