bazel-contrib / bazel-contrib/rules_scala

scalapb_proto_library additional scala sources

Open
#753 8 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Starlark
Stars
384
Forks
292
Avg merge
2d 21h
Merged PRs (30d)
46

Description

Now it is impossible to add some custom scala sources into scalapb library. So i could not do something like this:

trait TagRecordCompanionTrait {
    implicit val ordering: Ordering[TagRecord] = (x: TagRecord, y: TagRecord) => {
     if (x.count < y.count) 1
     else if (x.count > y.count) -1
     else x.name compareTo y.name
   }
}
message TagRecord {
    option (scalapb.message).companion_extends = "TagRecordCompanionTrait";

    required string name = 1;
    required int64 count = 2;
}

The only way to do this is to use preamble in proto file

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the scalapb_proto_library rule and compare its current source inputs with the preamble-based workaround described in the issue. Trace how custom Scala sources are passed into the generated library, then verify that a companion extension such as TagRecordCompanionTrait can be supplied without using a proto preamble.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system
Issue type
Feature
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.