bazel-contrib / bazel-contrib/rules_scala

Scrooge Error when defining Thrift exception

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

Description

I noticed when a Thrift file defines an exception, scrooge throws an exception:

For example adding:

```
exception FooBar {
1: string code
}
```

to `test/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/Thrift3.thrift` results in this:

```
ERROR: /absolute/path/to/test/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/BUILD:4:1: Couldn't build file test/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/thrift3_scrooge.jar: scala //test/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3:thrift3 failed (Exit 1)
bazel-out/darwin-fastbuild/bin/test/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/tmp4446905357582031766/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/FooBar.scala:171: error: object finagle is not a member of package com.twitter
extends ThriftException with com.twitter.finagle.SourcedException with ThriftStruct
^
one error found
one error found
java.lang.RuntimeException: Build failed
at io.bazel.rulesscala.scalac.ScalacProcessor.compileScalaSources(ScalacProcessor.java:244)
at io.bazel.rulesscala.scalac.ScalacProcessor.processRequest(ScalacProcessor.java:69)
at io.bazel.rulesscala.worker.GenericWorker.runPersistentWorker(GenericWorker.java:45)
at io.bazel.rulesscala.worker.GenericWorker.run(GenericWorker.java:111)
at io.bazel.rulesscala.scalac.ScalaCInvoker.main(ScalaCInvoker.java:41)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by adding the FooBar exception to test/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/Thrift3.thrift, then inspect the corresponding BUILD file and generated FooBar.scala. Determine why compilation requires com.twitter.finagle and verify that the example exception builds successfully without the reported error.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.