Skip to content

Commit

Permalink
Only run lint_tests on java_library not java_export
Browse files Browse the repository at this point in the history
Running list_tests on java_export will run afoul by trying to run
spotbugs on included dependency that will clearly fail like
`java_proto_library`.

Instead, the lint tests should only operate on the sources that comprise
the `java_library` the export target eventually creates.

fixes #314
  • Loading branch information
fzakaria committed Dec 2, 2024
1 parent 50fec79 commit 2e5aaeb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion java/private/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def java_test(name, **kwargs):

def java_export(name, maven_coordinates, pom_template = None, deploy_env = None, visibility = None, **kwargs):
"""Adds linting tests to `rules_jvm_external`'s `java_export`"""
create_lint_tests(name, **kwargs)
# Only run the lint tests on the java_library target and not the java_export target which will include
# other sources within it.
# https://github.com/bazel-contrib/rules_jvm_external/blob/534e62d14655e01048b90ef89ab1acaf0caa7348/private/rules/java_export.bzl#L85C5-L85C31
lib_name = "%s-lib" % name
create_lint_tests(lib_name, **kwargs)
_java_export(
name = name,
maven_coordinates = maven_coordinates,
Expand Down

0 comments on commit 2e5aaeb

Please sign in to comment.