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

feat(esbuild): add support for toolchains #2704

Merged
merged 1 commit into from
Jun 2, 2021

Conversation

mattem
Copy link
Collaborator

@mattem mattem commented May 26, 2021

BREAKING CHANGE

Add toolchain support for esbuild, removing the need for the tool attribute. Users can load the esbuild_repositories macro and call it within their WORKSPACE, this will by default define esbuild binaries for Windows, MacOS and Linux (all amd64).

TODO:

  • Update docs
  • Update esbuild version updater script

Thanks to @dae for the discussion in #2592 and the prototype repo

Relnotes:

esbuild package now uses toolchains, and the tools attribute has been removed. By default, toolchains for Windows, Mac (amd64, arm64) and Linux (amd64, arm64) are included.

See the docs for configure_esbuild_toolchain for defining custom toolchains

Add the following to the WORKSPACE file (changing @npm as required), see the docs for an alternate load method

load("@npm//@bazel/esbuild:esbuild_repositories.bzl", "esbuild_repositories")

esbuild_repositories()

@google-cla google-cla bot added the cla: yes label May 26, 2021
@mattem mattem force-pushed the feat/breaking_esbuild_toolchains branch 2 times, most recently from caac006 to e61e0c8 Compare May 28, 2021 22:53
@mattem mattem force-pushed the feat/breaking_esbuild_toolchains branch from e61e0c8 to b7c2be6 Compare May 28, 2021 22:57
@mattem mattem changed the base branch from stable to 4.x May 28, 2021 22:57
@mattem mattem changed the base branch from 4.x to stable May 28, 2021 22:58
@mattem mattem force-pushed the feat/breaking_esbuild_toolchains branch from b7c2be6 to c6c2e56 Compare May 28, 2021 22:59
@mattem mattem changed the base branch from stable to 4.x May 28, 2021 22:59
@google-cla
Copy link

google-cla bot commented May 28, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels May 28, 2021
@mattem mattem added cla: yes and removed cla: no labels May 28, 2021
@google-cla
Copy link

google-cla bot commented May 28, 2021

☹️ Sorry, but only Googlers may change the label cla: yes.

@google-cla google-cla bot removed the cla: yes label May 28, 2021
@mattem
Copy link
Collaborator Author

mattem commented May 28, 2021

Oh, well, we seem to be at an impasse @googlebot

@google-cla google-cla bot added the cla: yes label May 28, 2021
@mattem
Copy link
Collaborator Author

mattem commented May 28, 2021

Yeah... that showed you 🤖

@mattem mattem marked this pull request as ready for review May 28, 2021 23:29
@dae
Copy link
Contributor

dae commented May 28, 2021

Re the update script, any objections to adding esbuild-darwin-arm64 and esbuild-linux-arm64 as well? I can add them in a follow-up PR if that's easier.

@mattem
Copy link
Collaborator Author

mattem commented May 30, 2021

Makes sense to me, I'll add them in here

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

pretty simple change, the user WORKSPACE is so much nicer now :)

packages/esbuild/esbuild_repositories.bzl Outdated Show resolved Hide resolved
packages/esbuild/esbuild_repositories.bzl Outdated Show resolved Hide resolved
packages/esbuild/esbuild_repositories.bzl Show resolved Hide resolved
packages/esbuild/index.docs.bzl Outdated Show resolved Hide resolved
@mattem
Copy link
Collaborator Author

mattem commented Jun 1, 2021

Allowing users to specify their own esbuild version and adding plugin support don't mix well, so I think I'm going to remove that part, which simplifies this feature quite a bit.

@mattem mattem force-pushed the feat/breaking_esbuild_toolchains branch 2 times, most recently from f88ea58 to 56f1f60 Compare June 1, 2021 22:48
@mattem mattem added this to the 4.0 milestone Jun 1, 2021
binary_path = "bin/esbuild",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
Copy link
Contributor

@dae dae Jun 1, 2021

Choose a reason for hiding this comment

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

I think this needs to be aarch64. I had a user report that arm64 did not work as an alias in these constraints - not sure if that also applies to the darwin_arm64 build as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I put the wrong one for linux here (copy paste). Does arm64 work? I don't have a machine to test this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Me either :-) But the user reported arm64 did not work: ankitects/esbuild_toolchain#2

Copy link
Collaborator Author

@mattem mattem Jun 1, 2021

Choose a reason for hiding this comment

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

Oh interesting, I see, thanks

@mattem mattem force-pushed the feat/breaking_esbuild_toolchains branch 2 times, most recently from 8317b5f to 389feaf Compare June 2, 2021 01:31
@mattem mattem force-pushed the feat/breaking_esbuild_toolchains branch from 389feaf to 099a667 Compare June 2, 2021 01:40
@mattem mattem merged commit ae011bf into bazel-contrib:4.x Jun 2, 2021
@mattem mattem deleted the feat/breaking_esbuild_toolchains branch June 2, 2021 10:42
twheys pushed a commit to twheys/rules_nodejs that referenced this pull request Jan 13, 2022
Add toolchain support for esbuild, removing the need for the tool attribute. Users can load the esbuild_repositories macro and call it within their WORKSPACE, this will by default define esbuild binaries for Windows, MacOS and Linux (all amd64).

esbuild package now uses toolchains, and the tools attribute has been removed. By default, toolchains for Windows, Mac (amd64, arm64) and Linux (amd64, arm64) are included.

See the docs for configure_esbuild_toolchain for defining custom toolchains

Add the following to the `WORKSPACE` file (changing `@npm` as required), see the docs for an alternate load method

```
load("@npm//@bazel/esbuild:esbuild_repositories.bzl", "esbuild_repositories")

esbuild_repositories()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants