Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
refactor!: bazel build #442
refactor!: bazel build #442
Changes from all commits
7f5b7cb
1e8ba2f
3097fce
d3e1812
a614838
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idiomatic way for bazel is to have BUIDL.bazel file in each sub-folder (which turns that folder and all its subfolders without their own BUILD.bazel files into a "package" from bazel's perspective).
For example, please consider putting proto_library targets which compile stuff under
node_modules/google-gax/build/protos
into a BUIDL.bazel file under same directory (i.e.node_modules/google-gax/build/protos
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me postpone this as a possible refactor - I see your point but for now I would prefer not to introduce any
BUILD.bazel
files togoogle-gax
(the reason for that is thatbuild/protos
folder ingoogle-gax
is auto-generated and I cannot just put stuff there; also, it's a user-facing folder).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this interact with the dependencies defined in
package.json
? Do you need to maintain this list in two places?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. https://bazelbuild.github.io/rules_nodejs/Built-ins.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ... what happens here when renovate comes along and updates our
package.json
andpackage-lock.json
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing bad - next time bazel build is run, it will figure out that
package-lock.json
has changed, and will fetch new dependencies. (I assume renovate knows how to deal withpackage-lock.json
, I think it does)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that here in
BUILD
file it's just a list of packages without versions, so version updates by renovate are not going to affect this in any way.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhhh - what happens when you add a new package to
package.json
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You go here, decide if it's a compile, or test, or runtime dependency, and add it manually to one of the lists. They call it "fine grained npm dependencies", you see.
How it works internally: after they do
yarn install
ornpm install
(whatever), they actually bazelify all the dependencies (auto-generateBUILD.bazel
file for all of them) so that they become "targets" in bazel world (thinkmake
targets). Making bazel task depend on "just all the crap fromnode_modules
" is not something they approve (that was deprecated long time ago), so yes, we list dependencies in two places.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the fact that we need to declare our deps twice pretty ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this effectively copying what's happening in
tsconfig.json
? Do we need to coordinate changes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript support is really wobbly in bazel :) They use
tsconfig.json
to get some compiler options from there, but the tasks must still specifically define their inputs so that bazel could've built a dependency tree (thinkmake
on steroids).