Skip to content

Commit

Permalink
Run buildifier. No logical changes (#658)
Browse files Browse the repository at this point in the history
This is a formatting-only change, created by running:

buildifier -r -lint fix  .
  • Loading branch information
shs96c authored Jan 27, 2022
1 parent 2754341 commit 9278777
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 112 deletions.
64 changes: 31 additions & 33 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ bazel_skylib_workspace()

# End Skylib dependencies

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
name = "io_bazel_stardoc",
sha256 = "4a355dccc713458071f441f3dafd7452b3111c53cde554d0847b9a82d657149e",
Expand Down Expand Up @@ -118,16 +116,16 @@ maven_install(
name = "exclusion_testing",
artifacts = [
maven.artifact(
group = "com.google.guava",
artifact = "guava",
version = "27.0-jre",
exclusions = [
maven.exclusion(
group = "org.codehaus.mojo",
artifact = "animal-sniffer-annotations",
group = "org.codehaus.mojo",
),
"com.google.j2objc:j2objc-annotations",
],
group = "com.google.guava",
version = "27.0-jre",
),
],
repositories = [
Expand All @@ -144,8 +142,8 @@ maven_install(
],
excluded_artifacts = [
maven.exclusion(
group = "org.codehaus.mojo",
artifact = "animal-sniffer-annotations",
group = "org.codehaus.mojo",
),
"com.google.j2objc:j2objc-annotations",
],
Expand Down Expand Up @@ -241,15 +239,15 @@ maven_install(
name = "testonly_testing",
artifacts = [
maven.artifact(
group = "com.google.guava",
artifact = "guava",
group = "com.google.guava",
version = "27.0-jre",
),
maven.artifact(
group = "com.google.auto.value",
testonly = True,
artifact = "auto-value-annotations",
group = "com.google.auto.value",
version = "1.6.3",
testonly = True,
),
],
repositories = [
Expand Down Expand Up @@ -294,10 +292,10 @@ maven_install(
"org.apache.tomcat:tomcat-catalina:9.0.24",
# https://github.com/bazelbuild/rules_jvm_external/issues/255
maven.artifact(
group = "org.eclipse.jetty",
artifact = "jetty-http",
version = "9.4.20.v20190813",
classifier = "tests",
group = "org.eclipse.jetty",
version = "9.4.20.v20190813",
),
],
repositories = [
Expand Down Expand Up @@ -372,16 +370,16 @@ maven_install(
"com.fasterxml.jackson.core:jackson-annotations:2.11.2",
"com.github.jnr:jffi:1.3.4",
maven.artifact(
group = "com.github.jnr",
artifact = "jffi",
version = "1.3.3",
classifier = "native",
group = "com.github.jnr",
version = "1.3.3",
),
maven.artifact(
group = "com.github.jnr",
artifact = "jffi",
version = "1.3.2",
classifier = "native",
group = "com.github.jnr",
version = "1.3.2",
),
],
repositories = [
Expand All @@ -396,16 +394,16 @@ maven_install(
"com.fasterxml.jackson.core:jackson-annotations:2.10.1",
"com.fasterxml.jackson.core:jackson-annotations:2.10.1",
maven.artifact(
group = "com.github.jnr",
artifact = "jffi",
version = "1.3.3",
classifier = "native",
group = "com.github.jnr",
version = "1.3.3",
),
maven.artifact(
group = "com.github.jnr",
artifact = "jffi",
version = "1.3.3",
classifier = "native",
group = "com.github.jnr",
version = "1.3.3",
),
],
repositories = [
Expand All @@ -426,60 +424,60 @@ maven_install(

maven_install(
name = "starlark_aar_import_with_sources_test",
# Not actually necessary since this is the default value, but useful for
# testing.
aar_import_bzl_label = "@build_bazel_rules_android//android:rules.bzl",
artifacts = [
"androidx.work:work-runtime:2.6.0",
],
fetch_sources = True,
jetify = False,
repositories = [
"https://repo1.maven.org/maven2",
"https://maven.google.com",
],
fetch_sources = True,
jetify = False,
use_starlark_android_rules = True,
# Not actually necessary since this is the default value, but useful for
# testing.
aar_import_bzl_label = "@build_bazel_rules_android//android:rules.bzl",
)

maven_install(
name = "starlark_aar_import_test",
# Not actually necessary since this is the default value, but useful for
# testing.
aar_import_bzl_label = "@build_bazel_rules_android//android:rules.bzl",
artifacts = [
"com.android.support:appcompat-v7:28.0.0",
],
fetch_sources = False,
repositories = [
"https://repo1.maven.org/maven2",
"https://maven.google.com",
],
fetch_sources = False,
use_starlark_android_rules = True,
# Not actually necessary since this is the default value, but useful for
# testing.
aar_import_bzl_label = "@build_bazel_rules_android//android:rules.bzl",
)

maven_install(
name = "starlark_aar_import_with_jetify_test",
# Not actually necessary since this is the default value, but useful for
# testing.
aar_import_bzl_label = "@build_bazel_rules_android//android:rules.bzl",
artifacts = [
"com.android.support:appcompat-v7:28.0.0",
],
jetify = True,
repositories = [
"https://repo1.maven.org/maven2",
"https://maven.google.com",
],
use_starlark_android_rules = True,
# Not actually necessary since this is the default value, but useful for
# testing.
aar_import_bzl_label = "@build_bazel_rules_android//android:rules.bzl",
jetify = True,
)

# for the above "starlark_aar_import_test" maven_install with
# use_starlark_android_rules = True
http_archive(
name = "build_bazel_rules_android",
urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"],
sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
strip_prefix = "rules_android-0.1.1",
urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"],
)

# https://github.com/bazelbuild/rules_jvm_external/issues/351
Expand Down
8 changes: 4 additions & 4 deletions coursier.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

load("//third_party/bazel_json/lib:json_parser.bzl", _json_parse = "json_parse")
load("//private/rules:jetifier.bzl", "jetify_artifact_dependencies", "jetify_maven_coord")
load("//:specs.bzl", "maven", "parse", "utils")
load("//:specs.bzl", "parse", "utils")
load("//private:artifact_utilities.bzl", "deduplicate_and_sort_artifacts")
load("//private:coursier_utilities.bzl", "SUPPORTED_PACKAGING_TYPES", "escape")
load("//private:dependency_tree_parser.bzl", "JETIFY_INCLUDE_LIST_JETIFY_ALL", "parser")
Expand Down Expand Up @@ -988,7 +988,7 @@ def _coursier_fetch_impl(repository_ctx):
exec_result = _execute(
repository_ctx,
hasher_command + ["--argsfile", repository_ctx.path("hasher_argsfile")],
progress_message = "Calculating sha256 checksums.."
progress_message = "Calculating sha256 checksums..",
)
if exec_result.return_code != 0:
fail("Error while obtaining the sha256 checksums: " + exec_result.stderr)
Expand Down Expand Up @@ -1083,8 +1083,8 @@ def _coursier_fetch_impl(repository_ctx):
repository_ctx.file(
"unsorted_deps.json",
content = "{dependency_tree_json}".format(
dependency_tree_json = dependency_tree_json
)
dependency_tree_json = dependency_tree_json,
),
)
repository_ctx.template(
"pin.sh",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@rules_jvm_external//:defs.bzl", "artifact", "java_export")
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "export",
Expand Down
2 changes: 0 additions & 2 deletions examples/protobuf-java/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_proto",
sha256 = "73ebe9d15ba42401c785f9d0aeebccd73bd80bf6b8ac78f74996d31f2c0ad7a6",
Expand Down
2 changes: 0 additions & 2 deletions examples/simple/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

android_library(
name = "my_lib",
exports = [
Expand Down
2 changes: 1 addition & 1 deletion examples/spring_boot/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ maven_install(
"org.springframework:spring-web:5.1.5.RELEASE",
],
fetch_sources = True,
version_conflict_policy = "pinned",
maven_install_json = "//:maven_install.json",
repositories = [
"https://repo1.maven.org/maven2",
],
version_conflict_policy = "pinned",
)

load("@maven//:defs.bzl", "pinned_maven_install")
Expand Down
1 change: 1 addition & 0 deletions private/coursier_utilities.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def strip_packaging_and_classifier(coord):

def strip_packaging_and_classifier_and_version(coord):
coordinates = coord.split(":")

# Support for simplified versionless groupId:artifactId coordinate format
if len(coordinates) == 2:
return ":".join(coordinates)
Expand Down
9 changes: 4 additions & 5 deletions private/dependency_tree_parser.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ def _generate_imports(repository_ctx, dep_tree, explicit_artifacts, neverlink_ar
if srcjar_paths != None and target_label in srcjar_paths:
target_import_string.append("\tsrcjar = \"%s\"," % srcjar_paths[target_label])
if jetify and repository_ctx.attr.use_starlark_android_rules:
# Because jetifier.bzl cannot conditionally import the starlark rules
# (it's not a generated file), inject the aar_import rule from
# the load statement in the generated file.
target_import_string.append("\t_aar_import = aar_import,")
# Because jetifier.bzl cannot conditionally import the starlark rules
# (it's not a generated file), inject the aar_import rule from
# the load statement in the generated file.
target_import_string.append("\t_aar_import = aar_import,")

# 4. Generate the deps attribute with references to other target labels.
#
Expand Down Expand Up @@ -232,7 +232,6 @@ def _generate_imports(repository_ctx, dep_tree, explicit_artifacts, neverlink_ar
target_import_string.append("\t\t\"maven_url=%s\"," % artifact["url"])
target_import_string.append("\t],")


# 6. If `neverlink` is True in the artifact spec, add the neverlink attribute to make this artifact
# available only as a compile time dependency.
#
Expand Down
7 changes: 3 additions & 4 deletions private/rules/artifact.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("//:specs.bzl", "parse")
load("//private:constants.bzl", "DEFAULT_REPOSITORY_NAME")
load("//private:coursier_utilities.bzl", "strip_packaging_and_classifier_and_version")

Expand All @@ -18,8 +17,8 @@ def _make_artifact_str(artifact_obj):
coord = [artifact_obj["group"], artifact_obj["artifact"]]
if "version" in artifact_obj:
if "packaging" in artifact_obj:
coord.extend([artifact_obj["packaging"]])
if "classifier" in artifact_obj:
coord.extend([artifact_obj["classifier"]])
coord.extend([artifact_obj["packaging"]])
if "classifier" in artifact_obj:
coord.extend([artifact_obj["classifier"]])
coord.extend([artifact_obj["version"]])
return ":".join(coord)
12 changes: 6 additions & 6 deletions private/rules/has_maven_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ def _has_maven_deps_impl(target, ctx):

transitive_exports_from_exports = depset()
if hasattr(ctx.rule.attr, "exports"):
transitive_exports_from_exports = depset(
[e.label for e in ctx.rule.attr.exports],
transitive =
[e[MavenInfo].transitive_exports for e in ctx.rule.attr.exports]
)
transitive_exports_from_exports = depset(
[e.label for e in ctx.rule.attr.exports],
transitive =
[e[MavenInfo].transitive_exports for e in ctx.rule.attr.exports],
)

info = MavenInfo(
coordinates = coordinates,
Expand All @@ -165,7 +165,7 @@ def _has_maven_deps_impl(target, ctx):
artifact_infos = depset(direct = artifact_infos),
dep_infos = depset(direct = dep_infos, transitive = [i.dep_infos for i in all_infos]),
label_to_javainfo = label_to_javainfo,
transitive_exports = depset(transitive = [transitive_exports_from_exports] + transitive_exports_from_deps)
transitive_exports = depset(transitive = [transitive_exports_from_exports] + transitive_exports_from_deps),
)

return [
Expand Down
8 changes: 4 additions & 4 deletions private/rules/jetifier.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//:specs.bzl", "maven", "parse")
load("//:specs.bzl", "parse")
load(":jetifier_maven_map.bzl", "jetifier_maven_map")
load(":jvm_import.bzl", "jvm_import")

Expand Down Expand Up @@ -37,15 +37,15 @@ jetify = rule(
implementation = _jetify_impl,
)

def jetify_aar_import(name, aar, _aar_import=None, visibility=None, **kwargs):
def jetify_aar_import(name, aar, _aar_import = None, visibility = None, **kwargs):
jetify(
name = "jetified_" + name,
srcs = [aar],
visibility = visibility,
)

if not _aar_import:
_aar_import = native.aar_import
_aar_import = native.aar_import

_aar_import(
name = name,
Expand All @@ -54,7 +54,7 @@ def jetify_aar_import(name, aar, _aar_import=None, visibility=None, **kwargs):
**kwargs
)

def jetify_jvm_import(name, jars, visibility=None, **kwargs):
def jetify_jvm_import(name, jars, visibility = None, **kwargs):
jetify(
name = "jetified_" + name,
srcs = jars,
Expand Down
1 change: 1 addition & 0 deletions private/rules/jvm_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def _jvm_import_impl(ctx):
compilejar = ctx.actions.declare_file("header_" + injar.basename, sibling = injar)
args = ctx.actions.args()
args.add_all(["--source", outjar, "--output", compilejar])

# We need to remove the `Class-Path` entry since bazel 4.0.0 forces `javac`
# to run `-Xlint:path` no matter what other flags are passed. Bazel
# manages the classpath for us, so the `Class-Path` manifest entry isn't
Expand Down
3 changes: 1 addition & 2 deletions private/rules/maven_install.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//:coursier.bzl", "coursier_fetch", "pinned_coursier_fetch", "DEFAULT_AAR_IMPORT_LABEL")
load("//:coursier.bzl", "DEFAULT_AAR_IMPORT_LABEL", "coursier_fetch", "pinned_coursier_fetch")
load("//:specs.bzl", "json", "parse")
load("//private:constants.bzl", "DEFAULT_REPOSITORY_NAME")
load("//private:dependency_tree_parser.bzl", "JETIFY_INCLUDE_LIST_JETIFY_ALL")
Expand Down Expand Up @@ -147,4 +147,3 @@ def maven_install(
fail_if_repin_required = fail_if_repin_required,
duplicate_version_warning = duplicate_version_warning,
)

4 changes: 2 additions & 2 deletions private/rules/maven_project_jar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def _maven_project_jar_impl(ctx):
ctx.executable._merge_jars,
artifact_jars,
depset(transitive =
[ji.transitive_runtime_jars for ji in info.dep_infos.to_list()] +
[jar[JavaInfo].transitive_runtime_jars for jar in ctx.attr.deploy_env]).to_list(),
[ji.transitive_runtime_jars for ji in info.dep_infos.to_list()] +
[jar[JavaInfo].transitive_runtime_jars for jar in ctx.attr.deploy_env]).to_list(),
bin_jar,
)

Expand Down
Loading

0 comments on commit 9278777

Please sign in to comment.