bazelbuild / bazelbuild/rules_license

gather_licenses_info does not seem to capture license of external packages

Open
#140 2 comments 0 reactions 0 assignees View on GitHub
P3 question
Dominant language
Starlark
Stars
85
Forks
37
PR merge metrics
No merged PRs in 30d

Description

## Expected Behavior

`gather_licenses_info.bzl` should also gather license from external packages (fetched thru `WORKSPACE` or `Bzlmod`).

## Actual Behavior

`gather_licenses_info.bzl` only gathers license from in-tree project sources and vendored dependencies.

## Steps to Reproduce the Problem

```
git clone https://github.com/google/xls
cd xls
bazel build //xls/dslx:interpreter_main --aspects=@rules_license//rules:gather_licenses_info.bzl%gather_licenses_info_and_write --output_groups=licenses
```
```
xls 🍡 cat bazel-bin/xls/dslx/interpreter_main_licenses_info.json | grep @
"target": "@rules_license//licenses/spdx:Apache-2.0",
```
```
xls 🍙 bazel query --color=no --noshow_progress --noshow_loading_progress --notool_deps --noimplicit_deps 'kind(cc_library, filter("^@", deps(//xls/dslx:interpreter_main)))' --output package | grep @ | wc -l
39
```

## Specifications

- Version: `bazel 6.4.0`
- Platform: `Linux penguin 6.1.64-09049-g010fe86d9eae #1 SMP PREEMPT_DYNAMIC Thu, 1 Feb 2024 01:25:43 +0000 x86_64 GNU/Linuxw`

Contributor guide

Open the contributing guide

Research direction

Start by reading gather_licenses_info.bzl and reproduce the issue with the provided Bazel build and license output commands. Compare the external dependencies reported by the Bazel query with the generated licenses_info.json. Done means licenses from external packages fetched through WORKSPACE or Bzlmod are included, not only in-tree and vendored dependencies.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.