Skip to content

use aspects for scrooge / thrift support for scala. #510

@johnynek

Description

@johnynek

we currently implement scrooge by adding a generic mechanism to see all dependencies in with a field called "extra_information" tacked onto the scala rules. By using that, we can see the full transitive dependencies of any target.

https://github.com/bazelbuild/rules_scala/blob/master/twitter_scrooge/twitter_scrooge.bzl#L76

We use this to make sure scrooge is called on a full covering of the thrift graph.

An alternative could be to use aspects to generate the scrooge:
https://docs.bazel.build/versions/master/skylark/aspects.html#advanced-example

in this picture, aspects help us generate 1 scrooge target for each thrift target. This way, we have a 1:1 mapping. This fixes the need to verify that we cover all the thrifts with a scrooge target, and potentially improves performance (but since scrooge parses so slowly, and we may need to parse many times now it could actually slow down performance).

It would be really nice for old code to continue to build, it may not be possible and may need a migration. In any case, using aspects seems like the right direction since this is what they were designed for.

Metadata

Metadata

Assignees

No one assigned

    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