Code Monkey home page Code Monkey logo

Comments (8)

BryceCicada avatar BryceCicada commented on September 27, 2024

Try with scalaSource from sbt, like:

PB.targets in Compile := Seq(
  scalapb.gen() -> (scalaSource in Compile).value
)

from sbt-protoc.

nvartolomei avatar nvartolomei commented on September 27, 2024

@BryceCicada almost, it just deleted scalaSource folder. :)

from sbt-protoc.

BryceCicada avatar BryceCicada commented on September 27, 2024

Ah, I see. I tried this out on a project used exclusively for compiling .proto files, on which other projects depend. That is, I had no code in scalaSource so I hadn't noticed this behaviour.

You could try with:

PB.deleteTargetDirectory := false

but then you'd have to do the housekeeping of generated code yourself.

from sbt-protoc.

nvartolomei avatar nvartolomei commented on September 27, 2024

We are getting closer. Last problem, now compile errors out with duplicate class definitions., because sbt-protoc messes with libraryDependencies.

from sbt-protoc.

BryceCicada avatar BryceCicada commented on September 27, 2024

Sad times. I'm not much more help I'm afraid... I've only been a user of this library for a few hours. Hopefully, a more experienced person can step in.

On a side note; I guess you have reasons for putting generated code into your src folder, but I imagine this is not a well-trodden path. For example, one might typically have own code under version control but not generated code, and then have a build (under version control) that creates the generated code. I guess that's what target/src_managed is for, if you exclude target from version control.

from sbt-protoc.

nvartolomei avatar nvartolomei commented on September 27, 2024

@BryceCicada in my case I need to have all code under source control, including generated one.

from sbt-protoc.

thesamet avatar thesamet commented on September 27, 2024

Maybe a subdirectory of src/main then?

PB.targets in Compile := Seq(
  scalapb.gen() -> baseDirectory.value / "src/main/scala-protos"
)

from sbt-protoc.

nvartolomei avatar nvartolomei commented on September 27, 2024

@thesamet hm, this solution is good enough. Thanks.

from sbt-protoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.