Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix build scripts on macOS #33854

Closed
wants to merge 1 commit into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Nov 15, 2019

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 for a cross-platform implementation of Unix shell commands where necessary).

This is the same as #33840. Opened a new PR, because #33840 was cluttered with irrelevant preview comments and force-pushes, while I was investigating.

@mary-poppins
Copy link

You can preview 56f3074 at https://pr33854-56f3074.ngbuilds.io/.

@gkalpak gkalpak added area: build & ci Related the build and CI infrastructure of the project action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release type: bug/fix labels Nov 15, 2019
@ngbot ngbot bot added this to the needsTriage milestone Nov 15, 2019
@gkalpak gkalpak marked this pull request as ready for review November 15, 2019 17:02
@gkalpak gkalpak requested review from IgorMinar and a team as code owners November 15, 2019 17:02
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice LGTM!

const srcDir = `${bazelBin}/packages/${pkg}/npm_package`;
const destDir = `${absDestPath}/${pkg}`;

if (existsSync(srcDir) && statSync(srcDir).isDirectory()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional idea: You could also use shelljs.test('-d', srcDir) (same for other calls to existsSync).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I had forgitten about test().
(Too bad I saw this too late 😞)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up making the change in #33895 (because it keeps the code closer to the original bash script and might be easier for people to follow) 😃

@IgorMinar
Copy link
Contributor

@gkalpak did you say that this change came with a significant performance penalty for running bazel? can you please clarify / share details?

@IgorMinar
Copy link
Contributor

ah.. nevermind. I see that the issue is now resolved.

@IgorMinar
Copy link
Contributor

@gkalpak can you please rebase?

In angular#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).
@IgorMinar
Copy link
Contributor

@gkalpak nvm, I rebased it for you

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! thank you @gkalpak

@mary-poppins
Copy link

You can preview 659d835 at https://pr33854-659d835.ngbuilds.io/.

@alxhub alxhub closed this in 7eb3e3b Nov 16, 2019
alxhub pushed a commit that referenced this pull request Nov 16, 2019
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
@gkalpak gkalpak deleted the build-fix-build-on-mac branch November 17, 2019 19:16
gkalpak added a commit to gkalpak/angular that referenced this pull request Nov 18, 2019
This makes the JS script more similar to the original bash script it
replaced (see angular#33854) and will be easier to follow for people that are
less familiar with Node.js scripting.

Discussed in:
angular#33854 (comment)
alxhub pushed a commit that referenced this pull request Nov 18, 2019
This makes the JS script more similar to the original bash script it
replaced (see #33854) and will be easier to follow for people that are
less familiar with Node.js scripting.

Discussed in:
#33854 (comment)

PR Close #33895
alxhub pushed a commit that referenced this pull request Nov 18, 2019
This makes the JS script more similar to the original bash script it
replaced (see #33854) and will be easier to follow for people that are
less familiar with Node.js scripting.

Discussed in:
#33854 (comment)

PR Close #33895
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project cla: yes target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants