bazel-contrib / bazel-contrib/rules_scala

scala_library with generated resources and no srcs fails to build

Open
#693 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
384
Forks
292
Avg merge
2d 22h
Merged PRs (30d)
47

Description

A `scala_library` rule that has no `srcs` but generated `resources` will fail to build.

Pure resource jars seem to be a valid use-case, and indeed rules_scala seems to support them if the resource is not generated but a plain file.

Consider the following example
```
scala_library(
name = "lib",
resources = [":generated.txt"],
)
genrule(
name = "generated",
outs = ["generated.txt"],
cmd = "echo test > $(OUTS)",
)
```

Trying to build the `lib` target will fail with the following error.
```
File generated.txt does not seem to exist.
```
Even though building `generated.txt` succeeds and produces an output.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by building the `lib` target from the supplied `scala_library` and `genrule` example, then trace how generated `resources` are checked. Done means a `scala_library` with no `srcs` builds successfully when its resource is generated, while plain-file resources remain supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.