Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google/protobuf/empty.proto: File not found. #1659

Closed
rabejens opened this issue Mar 11, 2024 · 1 comment
Closed

google/protobuf/empty.proto: File not found. #1659

rabejens opened this issue Mar 11, 2024 · 1 comment

Comments

@rabejens
Copy link

rabejens commented Mar 11, 2024

I am trying to factor out my Protobuf stuff into a SBT submodule. Here is my build.sbt for that:

import Versions.{commonProtosVersion, grpcVersion, protobufVersion}

name := "processingconfig"

PB.protocVersion := protobufVersion

Compile / PB.targets := Seq(
//  PB.gens.java(protobufVersion) -> (Compile / sourceManaged).value,
  scalapb.gen(javaConversions = true) -> (Compile / sourceManaged).value / "scalapb",
//  PB.gens.plugin("grpc-java") -> (Compile / sourceManaged).value,
  )

Compile / PB.protoSources := Seq(
  sourceDirectory.value / "main" / "protobuf" / "processingconfig" / "protocol"
  )

libraryDependencies += "com.google.api.grpc" % "proto-google-common-protos" % commonProtosVersion intransitive()
libraryDependencies += "io.grpc" % "protoc-gen-grpc-java" % grpcVersion asProtocPlugin()
libraryDependencies += "io.grpc" % "grpc-protobuf" % grpcVersion
libraryDependencies += "io.grpc" % "grpc-netty-shaded" % grpcVersion
libraryDependencies += "io.grpc" % "grpc-core" % grpcVersion
libraryDependencies += "io.grpc" % "grpc-stub" % grpcVersion

When I try to build this, it complains:

google/protobuf/empty.proto: File not found.
ProcessingConfig.proto:5:1: Import "google/protobuf/empty.proto" was not found or had errors.
ProcessingConfig.proto:228:21: "google.protobuf.Empty" is not defined.

How can I reference the common protocols correctly?

Edit: These are my versions:

  lazy val commonProtosVersion = "2.23.0"
  lazy val grpcVersion         = "1.61.0"
  lazy val protobufVersion     = "3.25.2"

Followup

I now added the Google Protobuf source code as a Git Submodule to my project and did something like this:

Compile / PB.includePaths ++= Seq(
  baseDirectory.value.getParentFile / "external" / "protobuf" / "src"
  )

However I think this is a workaround. Or is this the way it actually should be done?

@thesamet
Copy link
Contributor

See the installation notes https://scalapb.github.io/docs/installation#installing-in-sbt-recommended:

libraryDependencies ++= Seq(
    "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants