rules_license icon indicating copy to clipboard operation
rules_license copied to clipboard

The checker_demo.py will always write an empty license_texts file

Open dhmemi opened this issue 2 years ago • 1 comments

The License json object is like:

[
  {
    "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

[
      {
        "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

dhmemi avatar Nov 03 '22 04:11 dhmemi

The demo is totally broken. It needs a replacement.

aiuto avatar Oct 17 '23 01:10 aiuto