bazelbuild / bazelbuild/rules_license
The checker_demo.py will always write an empty license_texts file
- Dominant language
- Starlark
- Stars
- 85
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
The License json object is like:
```json
[
{
"top_level_target": "//target:target",
"dependencies": [
{
"target_under_license": "@com_github_fmtlib_fmt//:lib",
"licenses": [
"@com_github_fmtlib_fmt//:license"
]
}
],
"licenses": [
{
"label": "@com_github_fmtlib_fmt//:license",
"rule": "@com_github_fmtlib_fmt//:license",
"license_kinds": [
{
"target": "@rules_license//licenses/spdx:MIT",
"name": "MIT",
"conditions": []
}
],
"copyright_notice": "",
"package_name": "fmtlib",
"package_url": "",
"package_version": "",
"license_text": "external/com_github_fmtlib_fmt/LICENSE.rst",
"used_by": [
"@com_github_fmtlib_fmt//:lib"
]
}
]
}
]
```
The `licenses` argument of `_do_licenses` at https://github.com/bazelbuild/rules_license/blob/e3bdc544ef373156da36638b774d65ff2d978bfa/tools/checker_demo.py#L97 is
```json
[
{
"label": "@com_github_fmtlib_fmt//:license",
"rule": "@com_github_fmtlib_fmt//:license",
"license_kinds": [
{
"target": "@rules_license//licenses/spdx:MIT",
"name": "MIT",
"conditions": []
}
],
"copyright_notice": "",
"package_name": "fmtlib",
"package_url": "",
"package_version": "",
"license_text": "external/com_github_fmtlib_fmt/LICENSE.rst",
"used_by": [
"@com_github_fmtlib_fmt//:lib"
]
}
]
```
but the `unique_licenses` function try to get `licenses` field from each item in the licenses list, so it will always be empty.
## Specifications
- Version: 0.0.4
- Platform: Windows
Contributor guide
Research direction
Start in tools/checker_demo.py at _do_licenses and inspect how unique_licenses reads each license entry. Compare that access with the provided License JSON shape, then run the checker demo with the example data and confirm that the generated license_texts file contains the referenced license text instead of being empty.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100