diff --git a/rules/license.bzl b/rules/license.bzl index 16d38ad..7e80018 100644 --- a/rules/license.bzl +++ b/rules/license.bzl @@ -55,7 +55,6 @@ _license = rule( ), "license_text": attr.label( allow_single_file = True, - default = "LICENSE", doc = "The license file.", ), "package_name": attr.string( diff --git a/tests/BUILD b/tests/BUILD index dc1bcfa..e6db493 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -49,6 +49,13 @@ license( license_text = "LICENSE.extra", ) +license( + name = "license_without_file", + package_name = "A test case package", + license_kinds = ["//licenses/spdx:Apache-2.0"], + license_text = None, +) + cc_binary( name = "hello", srcs = ["hello.cc"], @@ -89,6 +96,9 @@ java_binary( java_library( name = "j_bar", srcs = ["Bar.java"], + applicable_licenses = [ + ":license_without_file", + ], javacopts = ["-Xep:DefaultPackage:OFF"], ) @@ -113,8 +123,8 @@ py_test( name = "hello_licenses_test", srcs = ["hello_licenses_test.py"], data = [ - ":hello_licenses.json", ":hello_cc_copyrights.txt", + ":hello_licenses.json", ], python_version = "PY3", deps = [ @@ -139,11 +149,10 @@ check_license( ], ) - license( name = "license_with_generated_text", - license_text = ":created_license", license_kinds = [":generic_notice_license"], + license_text = ":created_license", ) genrule( @@ -151,4 +160,3 @@ genrule( outs = ["something.text"], cmd = "echo hello >$@", ) -