Skip to content

Commit

Permalink
Merge pull request #162 from adam-azarchs/azarchs/no-license-file
Browse files Browse the repository at this point in the history
fix: allow license_text=None in license declaration
  • Loading branch information
tonyaiuto authored Jan 14, 2025
2 parents 8144e77 + 10314dc commit 66ca42a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion rules/license.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ _license = rule(
),
"license_text": attr.label(
allow_single_file = True,
default = "LICENSE",
doc = "The license file.",
),
"package_name": attr.string(
Expand Down
16 changes: 12 additions & 4 deletions tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -89,6 +96,9 @@ java_binary(
java_library(
name = "j_bar",
srcs = ["Bar.java"],
applicable_licenses = [
":license_without_file",
],
javacopts = ["-Xep:DefaultPackage:OFF"],
)

Expand All @@ -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 = [
Expand All @@ -139,16 +149,14 @@ check_license(
],
)


license(
name = "license_with_generated_text",
license_text = ":created_license",
license_kinds = [":generic_notice_license"],
license_text = ":created_license",
)

genrule(
name = "created_license",
outs = ["something.text"],
cmd = "echo hello >$@",
)

0 comments on commit 66ca42a

Please sign in to comment.