-
Notifications
You must be signed in to change notification settings - Fork 48
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
Add recipes for just #468
Add recipes for just #468
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #468 +/- ##
=======================================
Coverage 91.94% 91.94%
=======================================
Files 340 340
Lines 26838 26838
Branches 1946 1946
=======================================
+ Hits 24675 24677 +2
+ Misses 2149 2147 -2
Partials 14 14 ☔ View full report in Codecov by Sentry. |
justfile
Outdated
@@ -0,0 +1,57 @@ | |||
[doc('Build all targets in the project')] | |||
build-all: | |||
bazel build //... |
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.
My 2c, we shouldn't have any build //*/...
commands in here because:
- They'll build a lot of intermediate targets that may not be necessary for checking if the code works
- Not all targets are buildable by themselves. Some of them require the context of what they're being built for, i.e.
cc_library
compilation changes depending on whether it's for JVM or Android. If there is no default set up, likely because is doesn't make sense to build that target by itself, then this would fail.
These scripts should be intent based, "what are you building for" -- testing, publishing, executing.
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 agree with the general sentiment, but I'm not sure I'd go so far to say we shouldn't have any //...
commands here. I don't expect them to be used very often, but for things like testing, we may want to test the full project.
Not all targets are buildable by themselves
I'll admit I'm not as familiar with the standard patterns for cc_library
-- but if that truly is the case, then I'd expect we should exclude those targets from the build-all
target. Maybe it's more beneficial to convert this into a macro for building all of the sub-systems:
build-core
build-plugins
build-android
build-react
build-ios
which I assume is similar to what we'd want to do for lint-all
, test-all
, etc
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'm not sure I'd go so far to say we shouldn't have any //... commands here. I don't expect them to be used very often, but for things like testing
Using ...
expansion for testing is fine, but that's because tests explicitly declare how the dependencies should be built. But I'm sticking to avoiding it for build
commands -- you probably don't need to build the targets used for publishing locally, at least at the build-all
level. It's somewhat misleading to expect all the tooling targets to also be build with a build-all
command.
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.
This also isn't limited to just the cc_library
targets - any Bazel target may be transitioned upon to change the underlying toolchain. It's called out in the iOS docs for the Swift-based targets:
https://github.com/player-ui/player/tree/main/ios#bazel
bazel test //core/... | ||
|
||
[doc('Lint all JS/TS files')] | ||
lint-js: |
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.
Do we want to have language discrimination for common language things? Practically for performance, maybe, but if I want to lint the project, ideally I'd just lint the whole project.
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 don't see any downside to having per language targets in addition to global targets.
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 feel like people are more likely to want to lint smaller subsets of the project based on what they're updating rather than the full project all the time -- but to @KetanReddy's point, we can include other targets as needed.
@@ -23,6 +23,9 @@ If the changes are larger (API design, architecture, etc), [opening an issue](ht | |||
* [Signed Commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification). For convenience it is recommended to set git to sign all commits by default as mentioned [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key) | |||
|
|||
## Building and Testing Locally (All platforms) | |||
|
|||
> This project also contains [just](https://github.com/casey/just) recipes for many common commands. They can be listed using `just -l` |
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.
Should installing just
get added to the setup/contributing guides?
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 figured we would first see how well we like using just
before fully converting the usage guides over. Then we can update the examples commands and stuff to reference it.
just has come about as one of the more popular ways of organizing project specific scripts. Given the multi-language and hard-to-find nature of bazel targets, this gives us a clean way of saving and reusing scripts for users.