bazelbuild / bazelbuild/bazel

Add package_metadata targets to FileInput.getLicense()

Open
#29,462 0 comments 0 reactions 0 assignees View on GitHub
team-Core type: feature request untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

When files are exposed through `export_files` it isn't currently adding targets exposed from the REPO.build or package scoped package metadata.

However, export_files supports providing licenses and FileInput does have a getLicense() function, however trying to specify a generic target results in `invalid license type: '//:package_metadata'`.

Either getLicenses should be expanded to support package_metadata or we should add a new function to expose those package_metadata

### Which category does this issue belong to?

Core

### What underlying problem are you trying to solve with this feature?

Provide package metadata everywhere, with export_files it's currently impossible to propagate it and need to convert to filegroup, however that will bring false negative and makes it quite the burden to track in bigger repo if transitive modules use export_files instead of filegroup

### Which operating system are you running Bazel on?

Irrelevant

### What is the output of `bazel info release`?

Irrelevant

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text

```

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing export_files and FileInput.getLicense() in Bazel core, then inspect how REPO.build and package-scoped package metadata targets are exposed. Done means export_files can propagate package_metadata without reporting invalid license type for a generic target, with tests covering the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.