-
-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: install buildifier pre-commit (#310)
Co-authored-by: Yun Peng <[email protected]>
- Loading branch information
1 parent
151bf39
commit 0fc9749
Showing
71 changed files
with
252 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See CONTRIBUTING.md for instructions. | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
# Use a slightly older version of node by default | ||
# as the default uses a very new version of GLIBC | ||
default_language_version: | ||
node: 16.18.0 | ||
|
||
repos: | ||
# Check formatting and lint for starlark code | ||
- repo: https://github.com/keith/pre-commit-buildifier | ||
rev: 6.3.3 | ||
hooks: | ||
- id: buildifier | ||
- id: buildifier-lint | ||
args: | ||
- --warnings=-module-docstring,-provider-params,-name-conventions,-unnamed-macro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
load("@bazel_skylib//:version.bzl", "hello_msg") | ||
|
||
# buildifier: disable=print | ||
print(hello_msg) | ||
|
||
cc_binary( | ||
name = "main", | ||
srcs = ["main.cc"], | ||
deps = [ | ||
"@lib_a//:lib_a", | ||
"@com_github_google_glog//:glog", | ||
], | ||
name = "main", | ||
srcs = ["main.cc"], | ||
deps = [ | ||
"@com_github_google_glog//:glog", | ||
"@lib_a", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
# Count how many cities are listed in the file | ||
genrule( | ||
name = "city_count", | ||
cmd = "wc -l < $< > $@", | ||
outs = ["city_number"], | ||
srcs = ["@world_cities//file"], | ||
outs = ["city_number"], | ||
cmd = "wc -l < $< > $@", | ||
) | ||
|
||
# Count how many emojis are listed in the file | ||
genrule( | ||
name = "emoji_count", | ||
cmd = "wc -l < $< > $@", | ||
outs = ["emoji_number"], | ||
# To build without --expiremental_enable_bzlmod, this has to be | ||
# srcs = ["@emojis//file"], | ||
srcs = ["@com_foo_bar_emojis//file"], | ||
outs = ["emoji_number"], | ||
cmd = "wc -l < $< > $@", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
bzlmod/03-introduce_dependencies_with_module_extension/lib_a/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
genrule( | ||
name = "emoji_count", | ||
cmd = "wc -l < $< > $@", | ||
outs = ["emoji_number"], | ||
srcs = ["@emojis//file"], | ||
outs = ["emoji_number"], | ||
cmd = "wc -l < $< > $@", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
load("//:local_config_sh.bzl", "sh_configure") | ||
|
||
sh_configure() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,15 @@ local_repository( | |
name = "librarian", | ||
path = "../utils/librarian", | ||
) | ||
|
||
local_repository( | ||
name = "lib_a", | ||
path = "./lib_a", | ||
) | ||
|
||
load("@lib_a//:deps.bzl","fetch_book_for_lib_a") | ||
|
||
load("@lib_a//:deps.bzl", "fetch_book_for_lib_a") | ||
load("@librarian//:librarian.bzl", "fetch_book") | ||
|
||
fetch_book( | ||
name = "the_great_gatsby", | ||
edition = "1995.12", | ||
|
@@ -31,7 +32,9 @@ local_repository( | |
name = "lib_b", | ||
path = "./lib_b", | ||
) | ||
load("@lib_b//:deps.bzl","fetch_book_for_lib_b") | ||
|
||
load("@lib_b//:deps.bzl", "fetch_book_for_lib_b") | ||
|
||
fetch_book_for_lib_b() | ||
|
||
# Answer: You'll get [email protected] and [email protected]. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,18 +18,22 @@ bazel_dep( | |
name = "bazel_skylib", | ||
version = "1.1.1", | ||
) | ||
|
||
bazel_dep(name = "librarian", version = "") | ||
local_path_override( | ||
module_name = "librarian", | ||
path = "../utils/librarian", | ||
) | ||
|
||
librarian_extension = use_extension("@librarian//:librarian.bzl", "librarian_extension") | ||
librarian_extension.book( | ||
name = "the_great_gatsby", | ||
edition = "1995.12", | ||
) | ||
|
||
librarian_extension.book(name="the_great_gatsby", edition="1995.12") | ||
# The root module will get [email protected] because [email protected] is only a dev dependency of lib_a. | ||
librarian_extension.book(name="hamlet", edition="1800.1") | ||
|
||
librarian_extension.book( | ||
name = "hamlet", | ||
edition = "1800.1", | ||
) | ||
use_repo(librarian_extension, "the_great_gatsby") | ||
use_repo(librarian_extension, "hamlet") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.