Merge pull request #21 from hlopko:add_buildifier
PiperOrigin-RevId: 275003557
Change-Id: I26f19b24628b291c9c7e7f678ad0ad8a41cda176
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index d529df1..1d35384 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -1,4 +1,7 @@
---
+buildifier:
+ version: latest
+ warnings: "all"
tasks:
ubuntu1604:
build_targets:
diff --git a/BUILD b/BUILD
index 1f6a0cf..f59256b 100644
--- a/BUILD
+++ b/BUILD
@@ -4,9 +4,10 @@
filegroup(
name = "distribution",
- srcs = glob([
+ srcs = [
"BUILD",
"LICENSE",
+ ] + glob([
"*.bzl",
]),
visibility = ["@//distro:__pkg__"],
diff --git a/WORKSPACE b/WORKSPACE
index 2dfeff0..e4bdea6 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,25 +1,30 @@
workspace(name = "rules_java")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
http_archive(
name = "bazel_federation",
- url = "https://github.com/bazelbuild/bazel-federation/archive/f0e5eda7f0cbfe67f126ef4dacb18c89039b0506.zip", # 2019-09-30
sha256 = "33222ab7bcc430f1ff1db8788c2e0118b749319dd572476c4fd02322d7d15792",
strip_prefix = "bazel-federation-f0e5eda7f0cbfe67f126ef4dacb18c89039b0506",
type = "zip",
+ url = "https://github.com/bazelbuild/bazel-federation/archive/f0e5eda7f0cbfe67f126ef4dacb18c89039b0506.zip", # 2019-09-30
)
load("@bazel_federation//:repositories.bzl", "rules_java_deps")
+
rules_java_deps()
load("@bazel_federation//setup:rules_java.bzl", "rules_java_setup")
+
rules_java_setup()
#
# Dependencies for development of rules_java itself.
#
load("//:internal_deps.bzl", "rules_java_internal_deps")
+
rules_java_internal_deps()
load("//:internal_setup.bzl", "rules_java_internal_setup")
+
rules_java_internal_setup()
diff --git a/java/defs.bzl b/java/defs.bzl
index 6d24f52..ed62fc1 100644
--- a/java/defs.bzl
+++ b/java/defs.bzl
@@ -32,6 +32,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_binary(**_add_tags(attrs))
def java_import(**attrs):
@@ -42,6 +44,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_import(**_add_tags(attrs))
def java_library(**attrs):
@@ -52,6 +56,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_library(**_add_tags(attrs))
def java_lite_proto_library(**attrs):
@@ -62,6 +68,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_lite_proto_library(**_add_tags(attrs))
def java_proto_library(**attrs):
@@ -72,6 +80,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_proto_library(**_add_tags(attrs))
def java_test(**attrs):
@@ -82,6 +92,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_test(**_add_tags(attrs))
def java_package_configuration(**attrs):
@@ -92,6 +104,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_package_configuration(**_add_tags(attrs))
def java_plugin(**attrs):
@@ -102,6 +116,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_plugin(**_add_tags(attrs))
def java_runtime(**attrs):
@@ -112,6 +128,8 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_runtime(**_add_tags(attrs))
def java_toolchain(**attrs):
@@ -122,4 +140,6 @@
Args:
**attrs: Rule attributes
"""
+
+ # buildifier: disable=native-java
native.java_toolchain(**_add_tags(attrs))
diff --git a/java/repositories.bzl b/java/repositories.bzl
index 93a4b92..21583cd 100644
--- a/java/repositories.bzl
+++ b/java/repositories.bzl
@@ -21,6 +21,8 @@
# Ideally we'd remove anything in this file except for rules_java_toolchains(),
# which is being invoked as part of the federation setup.
+"""Development and production dependencies of rules_java."""
+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
@@ -127,14 +129,16 @@
)
def remote_jdk9_repos():
- # OpenJDK distributions that should only be downloaded on demand (e.g. when
- # building a java_library or a genrule that uses java make variables).
- # This will allow us to stop bundling the full JDK with Bazel.
- # Note that while these are currently the same as the openjdk_* rules in
- # Bazel's WORKSPACE file, but they don't have to be the same.
+ """OpenJDK distributions that should only be downloaded on demand.
- # The source-code for this OpenJDK can be found at:
- # https://openjdk.linaro.org/releases/jdk9-src-1708.tar.xz
+ E.g. when building a java_library or a genrule that uses java make
+ variables). This will allow us to stop bundling the full JDK with Bazel.
+ Note that while these are currently the same as the openjdk_* rules in
+ Bazel's WORKSPACE file, but they don't have to be the same.
+
+ The source-code for this OpenJDK can be found at:
+ https://openjdk.linaro.org/releases/jdk9-src-1708.tar.xz
+ """
maybe(
http_archive,
name = "remote_jdk9_linux_aarch64",