Skip to content

Commit

Permalink
Enable buildifier presubmit check (bazelbuild#245)
Browse files Browse the repository at this point in the history
This migrates the repo to satisfy buildifier and adds buildifier as a presubmit.
  • Loading branch information
Marcel Hlopko authored and brandjon committed Oct 23, 2019
1 parent f46e953 commit 230f6d1
Show file tree
Hide file tree
Showing 21 changed files with 196 additions and 131 deletions.
3 changes: 3 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# TODO(#144): When Bazel 0.29 is released, the docgen workflow will work, and
# we can go back to using `...` for build_targets.
---
buildifier:
version: latest
warnings: "all"
all_targets: &all_targets
build_targets:
- "//examples/..."
Expand Down
5 changes: 4 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

exports_files(["LICENSE", "version.bzl"])
exports_files([
"LICENSE",
"version.bzl",
])

filegroup(
name = "distribution",
Expand Down
10 changes: 7 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel_federation",
url = "https://github.com/bazelbuild/bazel-federation/releases/download/0.0.1/bazel_federation-0.0.1.tar.gz",
sha256 = "506dfbfd74ade486ac077113f48d16835fdf6e343e1d4741552b450cfc2efb53",
url = "https://github.com/bazelbuild/bazel-federation/releases/download/0.0.1/bazel_federation-0.0.1.tar.gz",
)

load("@bazel_federation//:repositories.bzl", "rules_python_deps")

rules_python_deps()

load("@bazel_federation//setup:rules_python.bzl", "rules_python_setup")
rules_python_setup(use_pip=True)
load("@bazel_federation//setup:rules_python.bzl", "rules_python_setup")

rules_python_setup(use_pip = True)

# Everything below this line is used only for developing rules_python. Users
# should not copy it to their WORKSPACE.

load("//:internal_deps.bzl", "rules_python_internal_deps")

rules_python_internal_deps()

load("//:internal_setup.bzl", "rules_python_internal_setup")

rules_python_internal_setup()
2 changes: 1 addition & 1 deletion distro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package(
default_visibility = ["//visibility:private"],
)

load("@rules_python//:version.bzl", "version")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//releasing:defs.bzl", "print_rel_notes")
load("@rules_python//:version.bzl", "version")

# Build the artifact to put on the github release page.
pkg_tar(
Expand Down
8 changes: 4 additions & 4 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
bzl_library(
name = "bazel_python_tools",
srcs = [
"@bazel_tools//tools/python:private/defs.bzl",
"@bazel_tools//tools/python:srcs_version.bzl",
"@bazel_tools//tools/python:toolchain.bzl",
"@bazel_tools//tools/python:utils.bzl",
"@bazel_tools//tools/python:private/defs.bzl",
],
)

Expand All @@ -49,8 +49,8 @@ bzl_library(

stardoc(
name = "core-docs",
input = "//python:defs.bzl",
out = "python.md",
input = "//python:defs.bzl",
deps = [":defs"],
)

Expand All @@ -60,12 +60,12 @@ stardoc(

stardoc(
name = "pip-docs",
input = "//python:pip.bzl",
out = "pip.md",
input = "//python:pip.bzl",
)

stardoc(
name = "whl-docs",
input = "//python:whl.bzl",
out = "whl.md",
input = "//python:whl.bzl",
)
2 changes: 1 addition & 1 deletion examples/extras/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ load("//python:defs.bzl", "py_test")
py_test(
name = "extras_test",
srcs = ["extras_test.py"],
python_version = "PY2",
deps = [
requirement("google-cloud-language"),
# Make sure that we can resolve the "extra" dependency
requirement("googleapis-common-protos[grpc]"),
],
python_version = "PY2",
)
2 changes: 1 addition & 1 deletion examples/helloworld/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ py_library(
py_test(
name = "helloworld_test",
srcs = ["helloworld_test.py"],
deps = [":helloworld"],
python_version = "PY2",
deps = [":helloworld"],
)
38 changes: 19 additions & 19 deletions experimental/examples/wheel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

load("//python:defs.bzl", "py_library", "py_test")
load("//experimental/python:wheel.bzl", "py_package", "py_wheel")
load("//python:defs.bzl", "py_library", "py_test")

py_library(
name = "main",
Expand Down Expand Up @@ -91,54 +91,54 @@ py_wheel(
# Package data. We're building "custom_package_root-0.0.1-py3-none-any.whl"
distribution = "example_custom_package_root",
python_tag = "py3",
strip_path_prefixes = [
"experimental",
],
version = "0.0.1",
deps = [
":example_pkg"
":example_pkg",
],
strip_path_prefixes = [
"experimental"
]
)

py_wheel(
name = "custom_package_root_multi_prefix",
# Package data. We're building "custom_custom_package_root_multi_prefix-0.0.1-py3-none-any.whl"
distribution = "example_custom_package_root_multi_prefix",
python_tag = "py3",
strip_path_prefixes = [
"experimental/examples/wheel/lib",
"experimental/examples/wheel",
],
version = "0.0.1",
deps = [
":example_pkg"
":example_pkg",
],
strip_path_prefixes = [
"experimental/examples/wheel/lib",
"experimental/examples/wheel"
]
)

py_wheel(
name = "custom_package_root_multi_prefix_reverse_order",
# Package data. We're building "custom_custom_package_root_multi_prefix_reverse_order-0.0.1-py3-none-any.whl"
distribution = "example_custom_package_root_multi_prefix_reverse_order",
python_tag = "py3",
strip_path_prefixes = [
"experimental/examples/wheel",
"experimental/examples/wheel/lib", # this is not effective, because the first prefix takes priority
],
version = "0.0.1",
deps = [
":example_pkg"
":example_pkg",
],
strip_path_prefixes = [
"experimental/examples/wheel" ,
"experimental/examples/wheel/lib" # this is not effective, because the first prefix takes priority
]
)

py_test(
name = "wheel_test",
srcs = ["wheel_test.py"],
data = [
":custom_package_root",
":custom_package_root_multi_prefix",
":custom_package_root_multi_prefix_reverse_order",
":customized",
":minimal_with_py_library",
":minimal_with_py_package",
":custom_package_root",
":custom_package_root_multi_prefix",
":custom_package_root_multi_prefix_reverse_order"
]
],
)
Loading

0 comments on commit 230f6d1

Please sign in to comment.