bazelbuild / bazelbuild/rules_license

Mechanism to exclude generating rules as target dependencies

Open
#81 1 comment 0 reactions 0 assignees View on GitHub
bug P2
Dominant language
Starlark
Stars
85
Forks
37
PR merge metrics
No merged PRs in 30d

Description

## The JSON output produced by [`gather_licenses_info_and_write`](https://github.com/bazelbuild/rules_license/blob/main/rules/gather_licenses_info.bzl#L94) includes unnexpected dependencies and licenses.

## Actual Behavior
There should be a way to filter these targets out

## Steps to Reproduce the Problem
1. Apply `gather_licenses_info_and_write` aspect to a `pkg_rpm()` target like:
```
pkg_rpm(
name = "xyz-rpm",
srcs = [...]
...
)
```
, which transitively consumes some deps like postgresql, javax-mail etc.
2. The JSON output produces by the aspect reports `@rules_pkg//pkg:make_rpm` as a dependency target in addition to correctly identifying postgresql, javax-mail etc. There should be a way to filter out these targets as dependencies and their associated licenses.

Sample output can be found here:
https://gist.github.com/rtabassum/b9de682c2939f7e0b882d86f8686ed12#file-xyz-licenses-json

# Specifications

- Version:
- Platform:

Contributor guide

Open the contributing guide

Research direction

Start in rules/gather_licenses_info.bzl at gather_licenses_info_and_write and reproduce the aspect on the pkg_rpm example described in the issue. Inspect the generated JSON and the linked sample to determine how generating-rule targets such as @rules_pkg//pkg:make_rpm enter the dependency list. Done means the output provides a way to exclude those targets and their associated licenses while retaining real dependencies such as postgresql and javax-mail.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.