build: fix build scripts on macOS (#33854)

In #33823, `scripts/package-builds.sh` (which is used by both
`build-packages-dist.sh` and `build-ivy-npm-packages.sh`) was updated to
use `realpath`. It turns out that `realpath` does not exist on macOS, so
the build scripts do not work there.

In order to fix this (and also reduce the likelihood of introducing
similar issues in the future), this commit changes these bash scripts to
Node.js scripts (using [ShellJS](https://github.com/shelljs/shelljs) for
a cross-platform implementation of Unix shell commands where necessary).

PR Close #33854
This commit is contained in:
George Kalpakas
2019-11-15 02:56:55 +02:00
committed by Alex Rickabaugh
parent c89eed56b6
commit 7eb3e3bce6
19 changed files with 203 additions and 134 deletions

View File

@ -24,12 +24,12 @@ if $CI; then
# Determines the tests that need to be run for this shard index.
TEST_DIRS=$(node ./get-sharded-tests.js --shardIndex ${SHARD_INDEX} --maxShards ${MAX_SHARDS})
# NB: we don't run build-packages-dist.sh because we expect that it was done
# NB: we don't run build-packages-dist.js because we expect that it was done
# by an earlier job in the CircleCI workflow.
else
# Not on CircleCI so let's build the packages-dist directory.
# This should be fast on incremental re-build.
${basedir}/scripts/build-packages-dist.sh
node ${basedir}/scripts/build-packages-dist.js
# If we aren't running on CircleCI, we do not shard tests because this would be the job of
# Bazel eventually. For now, we just run all tests sequentially when running locally.