bazelbuild / rules_license

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The checker_demo.py will always write an empty license_texts file

dhmemi opened this issue · 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

def _do_licenses(out, licenses):
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

The demo is totally broken. It needs a replacement.