Skip to content

kt_jvm_library resources from generated targets include bazel-out prefix #1605

Description

@alxlyj

When a kt_jvm_library target includes a generated file (e.g. from a filegroup with output_group) in its resources attribute, the resource is embedded in the JAR with the full bazel-out/<config>/bin/... prefix rather than stripping it to the source-relative path.

In rules_kotlin 2.1.10, generated resources were embedded at their source-relative path (e.g. src/main/python/.../file.zip). In 2.2.2, they are embedded at the full output path (e.g. bazel-out/k8-fastbuild/bin/src/main/python/.../file.zip).

The <config> portion of the prefix (e.g. k8-fastbuild, k8-opt) varies by build configuration, making it impossible to hardcode the resource path.

Reproduction:

Expected: Resource at src/main/python/tools/my_file.zip inside JAR
Actual: Resource at bazel-out/k8-fastbuild/bin/src/main/python/tools/my_file.zip inside JAR

Workaround: Scan JAR entries by suffix at runtime.

Version: rules_kotlin 2.2.2 (via rules_kotlin_jvm 0.13.0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions