Scalapb: JS project pulls in JVM version of 'scalapb-runtime'

Created on 30 Jan 2018  路  4Comments  路  Source: scalapb/ScalaPB

Repro here https://github.com/ngbinh/scalapbCross

barJS/dependencyTree
[info] Updating {file:/home/binh/works/external/scalapbCross/}barJS...
[info] Done updating.
[info] bar:bar_sjs0.6_2.12:0.1-SNAPSHOT [S]
[info]   +-com.thesamet.scalapb:scalapb-runtime_2.12:0.7.0-rc7 [S]
[info]   | +-com.google.protobuf:protobuf-java:3.5.0
[info]   | +-com.lihaoyi:fastparse_2.12:1.0.0 [S]
[info]   | | +-com.lihaoyi:fastparse-utils_2.12:1.0.0 [S]
[info]   | | | +-com.lihaoyi:sourcecode_2.12:0.1.4 [S]
[info]   | | | 
[info]   | | +-com.lihaoyi:sourcecode_2.12:0.1.4 [S]
[info]   | | 
[info]   | +-com.thesamet.scalapb:lenses_2.12:0.7.0-test2 [S]
[info]   | 
[info]   +-org.scala-js:scalajs-library_2.12:0.6.22 [S]
[info]   

Note that barJS is a scala.js project so it should not depend on scalapb-runtime_2.12

help wanted

Most helpful comment

@ragazzojp the dependency on scala-library is added by sbt itself and not by ScalaPB. SBT adds it by default to all projects, and you can remove it by adding autoScalaLibrary := false to your build.sbt.

All 4 comments

This is happening since sbt-protoc adds a dependency on scalapb-runtime for all projects. It's not aware of ScalaJS so the failure happens around here.

As a workaround the commented out code you have seems to work:

.jsSettings(
 libraryDependencies -= "com.thesamet.scalapb" %% "scalapb-runtime" % "0.7.0-rc7"
)

Help on this will be appreciated.

A similar problem is related to java bindings and the scala runtime (not the scalapb-runtime). If only java bindings are compiled, so:

PB.targerts in Compile := Seq(
  PB.gens.java -> (sourceManaged in Compile).value
)

scala-library seems to be added to the dependencies, when there are no actual generated scala files.

@ragazzojp the dependency on scala-library is added by sbt itself and not by ScalaPB. SBT adds it by default to all projects, and you can remove it by adding autoScalaLibrary := false to your build.sbt.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moglideveloper picture moglideveloper  路  19Comments

sideeffffect picture sideeffffect  路  36Comments

matt-christiansen-exa picture matt-christiansen-exa  路  36Comments

ejconlon picture ejconlon  路  9Comments

xuwei-k picture xuwei-k  路  6Comments